NAT guest loses connection when host's wireless net changes

Discussions related to using VirtualBox on Windows hosts.
Post Reply
vouxz
Posts: 3
Joined: 5. May 2009, 23:53
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04

NAT guest loses connection when host's wireless net changes

Post by vouxz »

Hello,

Forgive me for this noob question. I've done my level best to try and find a solution by searching and playing with settings first, but can't seem to come up with anything.

VBox 2.2.2
Host: Windows Vista Home Basic
Guest: Ubuntu 9.04

I've got standard NAT networking that works fine out of the box, i.e. Ubuntu guest has network access just fine. However, when I switch wireless networks, for example from my home wireless network to my work wireless network (suspend host, get on bus, get of bus, resume host), the guest loses it's connection, though the host switches just fine. I can't seem to get the guest to connect unless I reboot the guest. Is there an easier way to reset the connection in the guest without rebooting, or better yet an automated way?

Thanks.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: NAT guest loses connection when host's wireless net changes

Post by Perryg »

run dhclient on the guest
vouxz
Posts: 3
Joined: 5. May 2009, 23:53
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04

Re: NAT guest loses connection when host's wireless net changes

Post by vouxz »

Perryg,

Thanks for your reply. However, I need a little more clarification.

If you mean, run dhclient all the time, well, it's of course running on the guest already:

Code: Select all

root       386  0.0  0.0   2276   992 ?        S    21:32   0:00 /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/dhclient-eth0.pid -lf /var/lib/dhcp3/dhclient-eth0.lease -cf /var/run/nm-dhclient-eth0.conf eth0
If you mean, kill and restart dhclient, then that doesn't seem to solve my problem.

I'm a bit confused about how changing guest settings will help, actually. Doesn't the guest IP, DNS, etc. all stay exactly the same from the guest's perspective?

Thanks much.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: NAT guest loses connection when host's wireless net changes

Post by Perryg »

From the terminal:

Code: Select all

$ sudo dhclient -r
$ sudo dhclient 
For more info google "dhclient renew"
vouxz
Posts: 3
Joined: 5. May 2009, 23:53
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04

Re: NAT guest loses connection when host's wireless net changes

Post by vouxz »

Thanks for the reply.

However this still didn't fix my problem. I have a workaround, though. The clue came from the VirtualBox User_FAQ (the last place I looked, rather than the first):
If you configure a VM to use NAT networking (the default), the DNS relay in VirtualBox forwards all DNS queries to the first configured DNS server. Unfortunately on Windows the first configured DNS server is frequently not working (e.g. because it corresponds to a currently not connected interface). To work around this problem, configure a working DNS server in the network configuration inside the guest OS.
Renewing the DHCP lease didn't change the way the guest sees DNS: 10.0.2.3. It seems virtualbox can't deal with switching to alternate DNS servers (like in my home-work case). So manually setting the DNS to a working server that the host currently sees is required in the guest (in Ubuntu 9.04 you can use the gui to choose "Automatic (DHCP) addresses only" and enter the DNS server, then disable and enable networking). Now that I know it's a DNS issue, there seems to be more google hints for consumption.

I hope future versions with a Windows host can take care of this behind the scenes.
Post Reply