I’m attemtping to host my own development web server in a VirtualBox guest virtual machine running Ubuntu Server. I would like this virtual machine to be accessible from not only my home network, but outside the LAN as well.

As such, I’ve set up a static IP so I can later forward ports to this static IP. My VirtualBox settings have this virtual machine only using one adapter in bridged mode.

Here’s what my /etc/network/interfaces looks like:

iface eth0 inet static
address /*this is outside the DHCP range*/

Here’s what the output of ifconfig looks like:

enter image description here

Here’s ifconfig -a:

enter image description here

Here’s the output of lspci:

enter image description here

And here’s my VirtualBox settings:

enter image description here

My host system is a Mac Mini, running Mac OS X 10.7.

From within the guest OS, if I ping google.com:

$ ping google.com
# outputs 'ping: unknown host google.com' immediately

Why am I unable to access the web?

  • 2
    Please update your post with these outputs: ifconfig and lspci. This will tell us if your guest vm detects the virtual network device. Also tell us if you have installed the VB guest additions. – invert Sep 7 '12 at 7:10
  • [Obvious question] Have you checked the results of ping and ping to ensure you are reaching the gateway and the nameserver(s)? The immediate unknown host response indicates that your VM isn't resolving 'google.com'. – StarNamer Sep 7 '12 at 17:07
  • says 'connect: Network is unreachable' when i Ping I'm positive this is my router's address though. I'm looking at in my Mac host's network settings – jessh Sep 7 '12 at 17:08
  • @jessh in your ifconfig screenshots -- your eth0 interface is down. Have you tried ifconfig eth0 up? – Sean C. Sep 7 '12 at 17:37
  • @jessh in addition, after looking at your /etc/network/interfaces you're missing the auto eth0 statement that brings the interface online at boot, so I suspect that the interface is just down and ifconfig eth0 up will fix it. See: wiki.debian.org/… – Sean C. Sep 7 '12 at 17:43

Based on the information provided, it looks as though the eth0 interface is offline. Per the Debian wiki on /etc/network/interfaces you need to add:

auto eth0

to the top of your configuration in order to bring the card online at boot.

To bring the interface online after boot time, you can issue the command:

ifconfig eth0 up

If you happen to prefer iproute2 to the standard tools, you can use the command:

ip link set eth0 up

During discussions with @jessh a bug with MAC OS and bridging Wifi was found posted at VirtualBox. This may be what was causing the issue, but it's unconfirmed thus far.

  • hmm. still not working: dl.dropbox.com/u/2241201/locker/… – jessh Sep 7 '12 at 17:54
  • Does ifconfig eth0 show that the connection is up? – Sean C. Sep 7 '12 at 17:55
  • I don't think so.. (no ip address) dl.dropbox.com/u/2241201/locker/… – jessh Sep 7 '12 at 18:03
  • @jessh monitor the kernel log tail -f /var/log/syslog then toggle the virtual interface between disconnected and bridged, or off and bridged. Watch for a message in the log which indicates eth0 NIC Link is Up. I suspect there may be an issue with getting a carrier on the interface. You tried using ifconfig eth0 up already I assume? – Sean C. Sep 7 '12 at 18:08
  • Yep I tried the last thing you said. Unfortunately, I won't be able to tail the kernel log, as the vm must be off for me to make network changes. Here's an alternative idea. If i set the network mode to NAT, will it show up as a nother PC on my LAN? – jessh Sep 7 '12 at 18:13

There's a few things I see which could be the cause of your issue. The first is that your dns-nameservers: line has a colon in it, and that could be causing an issue. Second, is not a valid Google DNS server, (it should be as per this), but that shouldn't matter if the address is working. Next, I don't see anywhere in your logs where you restarted the networking on your Ubuntu machine after changing the IP address, so the changes may not be taking hold yet. Lastly, if you're using one of the newer versions of Ubuntu, your dns-nameservers line may be depreciated in favor of the resolv.conf file. You can read up how to fix this issue, here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.