Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
Today I fixed this probelm simply by upgrading to virtualbox 4.0.12. So I guess my problem was not a missconfiguration, but a bug in vboxes networking. –  Isaac Jul 17 '11 at 12:38

2 Answers 2

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.

share|improve this answer
    
If I understand you correctly, then if I would bridge my virtual eth1 to wlan0 (yes you are right, its usually bridged to eth0) at home, it should work. I tried that, but it did not work. Maybe then I still have a routing problem? Because my wlan0 is in a 192.168.2.0 net. –  Isaac Feb 21 '11 at 10:55
    
The reason why I have NAT AND a bridged adapter is mostly due to my ignorance of virtual networks and being desperate to get things to work. So once I had a connection, I did not bother to rethink ... Anyway, I had the feeling that I need the eth0:1 interface, to have an entry into my virtual 192.168.0.0 net. –  Isaac Feb 21 '11 at 10:57

Sorry for the delay in response, I didn't realize (or wasn't notified of a reply)..

I think you are correct with still having a routing problem, after looking through your original post I picked up some more details that may need to be changed.

On my own VBox configurations I have the host-only network range different than the bridged range...

I will offer a solution to try:

Since you have a static IP at work, we will leave your host at eth0: 192.168.0.1

Now edit the IPv4 host-only address under the VBoxManager->File->Prerences...->Network->vboxnet0

Change that IP address to: 192.168.120.1

Then for your guest set the first adapter to NAT and then the second adapter to Host-only

When you turn on this virtual you should get an IP address for the guest eth1 with something in the 192.168.120.X range, if not try either refreshing or statically setting that IP address.

When you have that complete try SSHing into the virtual by using you new 192.168.120.x range IP address. You should be golden. If this works, but isn't what you wanted accomplished be more specific and maybe I can shed some light in the right direction.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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