Ubuntu server virtual machine on a Mac Mini can’t ping servers on the Internet

2

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 10.0.1.203 /*this is outside the DHCP range*/
netmask 255.255.255.0
gateway 10.0.1.1
network 10.0.1.0
broadcast 10.0.1.255
dns-nameservers: 8.8.8.8 8.8.8.4

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?

jessh

Posted 2012-09-07T06:52:43.267

Reputation: 329

2Please 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 – 2012-09-07T07:10:06.507

[Obvious question] Have you checked the results of ping 10.0.1.1 and ping 8.8.8.8/ping 8.8.8.4 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 – 2012-09-07T17:07:00.953

says 'connect: Network is unreachable' when i Ping 10.0.1.1 I'm positive this is my router's address though. I'm looking at in my Mac host's network settings – jessh – 2012-09-07T17:08:04.430

@jessh in your ifconfig screenshots -- your eth0 interface is down. Have you tried ifconfig eth0 up? – Sean C. – 2012-09-07T17:37:33.130

@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: http://wiki.debian.org/NetworkConfiguration#Configuring_the_interface_manually

– Sean C. – 2012-09-07T17:43:56.790

You can't build out a network behind a WiFi client connection. Per the WiFi specification, an AP will only send traffic to a client if the traffic is addressed to that client (or broadcast). Since the vm isn't a client of the AP, traffic to the vm will not be sent to the host machine by the AP. (This is why you need WDS. Otherwise, you could just bridge WiFi connections like you do Ethernet connections.) – David Schwartz – 2013-10-26T07:25:38.780

Answers

0

There's a few things I see which could be the cause of your issue. The first is that your dns-nameservers: 8.8.8.8 8.8.8.4 line has a colon in it, and that could be causing an issue. Second, 8.8.8.4 is not a valid Google DNS server, (it should be 8.8.4.4 as per this), but that shouldn't matter if the 8.8.8.8 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.

Blerg

Posted 2012-09-07T06:52:43.267

Reputation: 1 094

0

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.

Sean C.

Posted 2012-09-07T06:52:43.267

Reputation: 554

hmm. still not working: https://dl.dropbox.com/u/2241201/locker/Screen%20Shot%202012-09-07%20at%201.53.46%20PM.png

– jessh – 2012-09-07T17:54:07.933

Does ifconfig eth0 show that the connection is up? – Sean C. – 2012-09-07T17:55:03.830

I don't think so.. (no ip address) https://dl.dropbox.com/u/2241201/locker/Screen%20Shot%202012-09-07%20at%202.03.01%20PM.png

– jessh – 2012-09-07T18:03:26.393

@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. – 2012-09-07T18:08:28.463

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 – 2012-09-07T18:13:12.903

@jessh take a look at the bottom of the VirtualBox window. There is a little icon with two computers. That represents the network interface. If you ctrl+click (MAC) or right-click (PC) you'll get a menu to enable/disable it. That's the same as physically disconnecting the cable on a normal machine and it can be done while the VM is running. – Sean C. – 2012-09-07T18:18:42.850

@jessh as for NAT. You can use NAT, but you'll need to set up Port Forwarding in VirtualBox to make the machine available from the Internet. – Sean C. – 2012-09-07T18:19:37.997

let us continue this discussion in chat

– jessh – 2012-09-07T18:31:35.157