VirtualBox

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#9492 closed defect (invalid)

Guest loses connectivity when host joins new subnet

Reported by: rocko Owned by:
Component: network/NAT Version: VirtualBox 4.1.2
Keywords: Cc:
Guest type: other Host type: other

Description (last modified by Frank Mehnert)

My setup is:

  • VirtualBox on a Windows host
  • Router A on subnet (eg) 192.168.10.x
  • Router B on subnet (eg) 10.1.1.x
  • An Ubuntu server guest using NAT and NAT forwarding.

When the Windows host disconnects from Router A and connects to Router B, it gets a new IP address via DHCP, and NAT forwarding still works, but the Ubuntu guest can no longer connect out to anything. eg although both routers have access to the internet, the guest can no longer ping google.com. There is no indication to the guest, however, that its networking has changed.

I believe the same issue occurs with a Linux host.

Change History (8)

comment:1 by Frank Mehnert, 13 years ago

Description: modified (diff)

comment:2 by rocko, 13 years ago

The issue turns out to be slightly different from what I originally thought.

Once it connects to the new network, the VM can connect to other machines via their IP addresses, but it still has the old nameserver setting in /etc/resolv.conf, so it can't do things like 'ping google.com'.

A dhclient command fixes this. I can get the VM to ping the name server and issue a new dhclient if it fails to ping, but there isn't a good workaround because if the host is not connected to any network, the dhclient command temporarily messes up the NAT forwarding - I'm seeing 15 second delays trying to connect from the host to an apache server on the VM.

So is there a way for the VM to know if the host has connected to a new network, so it can issue the dhclient command at the correct time?

comment:3 by rocko, 13 years ago

ie perhaps what VBox should be doing is when the VM requests a DHCP address and it is configured for NAT, VBox should be returning itself as the nameserver and forwarding DNS requests through to the current host DNS.

in reply to:  3 comment:4 by vasily Levchenko, 13 years ago

Replying to rocko:

ie perhaps what VBox should be doing is when the VM requests a DHCP address and it is configured for NAT, VBox should be returning itself as the nameserver and forwarding DNS requests through to the current host DNS.

Have you tried to

# ifdown eth0
# ifup eth0

on the guest or to restart network service of the guest?

regarding dns service VirtualBox has resolving mechanism which you're describing to enable it please look at http://www.virtualbox.org/manual/ch09.html#nat_host_resolver_proxy

comment:5 by rocko, 13 years ago

Thanks, http://www.virtualbox.org/manual/ch09.html#nat_host_resolver_proxy looks like what I want it to do, I'll try it out. Is there a way to enable this via the GUI?

The problem with restarting networking is that the guest can't tell the difference between the DNS going down and the external network changing address. As far as the guest is concerned, it continues to maintain the same network address, so why should it need to restart networking?

Is there an advantage in only using the external DNS in NAT mode since the proxy DNS should always work? It seems to me that the best path would be to turn on nat_host_resolver_proxy by default and have an option to use external DNS if there's a good reason to use it.

in reply to:  5 comment:6 by vasily Levchenko, 13 years ago

Replying to rocko:

Thanks, http://www.virtualbox.org/manual/ch09.html#nat_host_resolver_proxy looks like what I want it to do, I'll try it out. Is there a way to enable this via the GUI?

The problem with restarting networking is that the guest can't tell the difference between the DNS going down and the external network changing address. As far as the guest is concerned, it continues to maintain the same network address, so why should it need to restart networking?

Unfortunately, there're no mechanisms in DHCP protocol to let DHCP server notify client to change its connection attributes. It's up to OS to detect if it need refresh anything in configuration.

Is there an advantage in only using the external DNS in NAT mode since the proxy DNS should always work? It seems to me that the best path would be to turn on nat_host_resolver_proxy by default and have an option to use external DNS if there's a good reason to use it.

Host Resolver Proxy mechanism hide a some of information from it's clients e.g. expiration of IP - network address mapping, and so on, that why we emulate some fields in response (it's possible that some services depend on this information). The other reason it's not measured but it looks like direct UDP request is faster than Host Resolver Proxy (at least namebench doesn't advice host resolver proxy as first entry in resolver configuration).

comment:7 by vasily Levchenko, 13 years ago

Resolution: invalid
Status: newclosed

comment:8 by rocko, 13 years ago

Thanks for the info.

Re your second point, "Unfortunately, there're no mechanisms in DHCP protocol to let DHCP server notify client to change its connection attributes. It's up to OS to detect if it need refresh anything in configuration.", that IS the problem here. There's no way for the guest OS to tell if it needs to refresh anything in its configuration. And issuing a DHCP request when there is no network connection slows down networking, so it's not a valid workaround.

Is there a way to enable this nat-host-resolver-proxy via the GUI? That would alleviate the problem.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use