NatNetwork does not get DNS when bound to an IP-address

Discussions related to using VirtualBox on Linux hosts.
Post Reply
sunrider
Posts: 15
Joined: 10. Sep 2015, 11:45

NatNetwork does not get DNS when bound to an IP-address

Post by sunrider »

Host: Ubuntu 14.04 LTS
VirtualBox 5.0.8 with Extension Pack 5.0.8
NatNetwork configured with name NNP, 192.168.9.0/24, DHCP support enabled, no port forwarding.
Guest: Ubuntu 14.04 LTS with VB Guest Additions 5.0.8

Host eth0 connected to internet via DHCP and DNS set and everything working fine.

Guest connected via NatNetwork NNP and no additional settings; connects to internet with no problems. Everything working fine.

Then I set
VBoxManage setextradata global "NAT/NNP/SourceIp4" x.x.x.x
where x.x.x.x is the actual IP address of host eth0.

Then I refresh the guest network connection, e.g. within guest disconnect via networkmanager; on Host reconfigure the guest to "not attached", disable and re-enable NNP, and then configure guest networking back to NatNetwork NNP and then in the guest reconnect via networkmanager.

At that point the guest does not get any replies from any DNS.
Note that the guest can ping the host's primary DNS server without errors. But even a "nslookup http://www.google.com x.x.x.x" (where x.x.x.x is the host's primary DNS server address) fails in the guest. (On the host this command works ok.)

Then I manually configure an "additional DNS server" in the guest's networkmanager to point to the host's primary DNS server. Refresh guest network connection.
Guest still does not get any replies from any DNS server.
Note that the guest can still ping the host's primary DNS server without errors.

Do I get something wrong with usage of the above setextradata command? Anything more I need to configure?
Or is this a bug?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: NatNetwork does not get DNS when bound to an IP-address

Post by mpack »

Moved to "Linux Hosts".
sunrider
Posts: 15
Joined: 10. Sep 2015, 11:45

Re: NatNetwork does not get DNS when bound to an IP-address

Post by sunrider »

Maybe I should have mentioned in my original posting:

All of this relates to the VirtualBox User Manual chapter 6.4, where it reads:
"It’s possible to bind NAT service to specified interface:
VBoxManage setextradata global "NAT/win-nat-test-0/SourceIp4" 192.168.1.185"

Maybe my perception of this passage is wrong.
I interpret "bind NAT service to specified interface" such that all IP traffic of the NatNetwork in question will be presented directly to the local device that is labeled with the specified IP address, instead of being subject to whatever standard routing practice is active on the host.

I admit that from thereon I have no idea of what magic VirtualBox is using then to forward the IP packets.
From my understanding of networks, bringing IP packets onto a network segment alone is useless, unless you are addressing a gateway. And it is unclear to me how VirtualBox finds that gateway - but it somehow must do it, otherwise I could not ping the DNS server, which clearly is not in the device's actual IP range. On the other hand a traceroute to the DNS server yields no result (i.e. only finds the interface address and then surrenders to ***).


Probably too much writing for anybody to get down here, but I want to mention:
My original intent was to "bind" a certain NatNetwork to a specific network adapter (in this case: a WLAN or WWAN (PPP) interface), such that all IP traffic from guests on that NatNetwork will be routed through said network adapter, while default traffic from anywhere else on the host (including VBox guests on other NatNetworks or via direct NAT) will be routed according to the host's routing table.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: NatNetwork does not get DNS when bound to an IP-address

Post by mpack »

Why didn't you just use bridged networking? Binding to a specific host NIC is exactly what it does. It doesn't have to be a NIC the host uses.
sunrider
Posts: 15
Joined: 10. Sep 2015, 11:45

Re: NatNetwork does not get DNS when bound to an IP-address

Post by sunrider »

It is impossible to use bridged networking with a PPP interface.
sunrider
Posts: 15
Joined: 10. Sep 2015, 11:45

Re: NatNetwork does not get DNS when bound to an IP-address

Post by sunrider »

Further investigation revealed that no gateway seems to exist when the NatNetwork has been bound to an IP as illustrated in my original posting.
No IP-address seems to be reachable, except for the host's primary DNS server, which - I repeat - is NOT in the guest's subnet.

Maybe, can someone explain in more detail, what effect the setextradata command in the User Manual's chapter 6.4 is supposed to have at all?
Post Reply