Ubuntu – VirtualBox bridged adapter not working under certain circumstances

bridgeubuntu-10.04virtualbox

I have VirtualBox 3.2.12 running on an Ubuntu 10.04 host. Usually, at work, I have my eth0 connected to a LAN with a static IP. If I bring my laptop home, I connect to the Internet via WiFi, with my WLAN card configured with DHCP.

On my guest system, I have eth0 configured with NAT, and eth1 as a bridged adapter.

Now at work (cable connected to eth0 on host), I have network connection to my guests, I can ping, ssh, whatever. At home, I don't get a network connection. NAT is working, I can access the Internet from within my guest, but there is no direct connection between the host and the guest. I can't ping my guest from the host or vice versa.

First I thought it could be a routing problem, but that did not seem to be the case: the routes are the same (or I can make them the same, with no effect) at work or at home.

Also, several guests on the virtual 192.168.0.0 network can reach each other. Its just the host that is not reachable.

On my host, I have two virtual network adapters:

eth0:1    Link encap:Ethernet  HWaddr 00:22:68:11:32:f8  
      inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0


vboxnet0  Link encap:Ethernet  HWaddr 0a:00:27:00:00:00  
      inet addr:192.168.0.101  Bcast:192.168.0.255  Mask:255.255.255.0

Both seem to work, I can ping their addresses (maybe that does not mean so much?).

Now I am a bit clueless on where to continue to search. Any suggestions would be appreciated.

Best Answer

On the guest side networking settings:

Adapter 1 = eth0 = NAT (you already have this setup, that's why you always get internet)

Adapter 2 = eth1 = bridged, here is your problem, my guess is your HOST networking device are you bridged too is eth0 (that is why it works at work), but when you get home your wifi is NOT the HOST eth0 networking device, it is maybe wlan0, or eth1 depending on your computers NIC).

If your setup is how you described then you are not using vboxnet0 at all, that vbox networking interface is used only whey you do a 'host-only' Ethernet adapter setting for the guest.

What I dont understand is why you have NAT AND a bridged adapter?? It makes no sense to have both the way your setup is configured. If you use your virtual strictly for internal services (for instance hosting an iscsi volume, or maybe as an svn server local to your host computer only) then what you should do is NAT the first adapter (as you have), and then "Host-Only" the second guest adapter... This second adapter is not visible to the internet but is visible to both your host AND any other virtuals that are configured to share that host-only network. Your virtual will still be able to access the internet through NAT, but will be more secure because the internet wont be able to access it.

I would also ditch that virtual eth0.1 interface because I dont see a point in that either, and will most likely screw with your tcp/ip stack because it may get confused as to which interface to send requests out, since eth0.1 is same ip range as vboxnet0... bad idea. ( I think the technical term is multi-homing your network.. but im not 100% sure)

Let me know if this helps you... If your setup or reason for your virtuals is different, you could explain in more detail of their purpose and I could assist in suggesting the best network configuration setup.