VirtualBox - guest Ubuntu loses DNS when host connects to VPN

10

5

I have Ubuntu guest OS in VirtualBox using default NAT for eth0.

Works fine at the office and at home EXCEPT when on office VPN from home.

When the host OS (Windows 7) is connected to the VPN, DNS lookups don't work within the Virtualbox guest. DNS lookups are fine on the host. Within Virtualbox, I can ping IPs directly both within the VPN and the outside, so it's not a connectivity problem.

It looks like the Ubuntu guest is using localhost as the DNS entry point, according to /etc/resolv.conf and nslookup. So it looks like something locally is then dispatching to other underlying DNS.

How do I troubleshoot this?

wrschneider

Posted 2013-03-25T01:20:32.847

Reputation: 391

What are you using for VPN? Do you have access to the VPN settings on the device these machines are connecting to? Typically the machines connecting to the VPN draw their settings from the VPN device. – jmreicha – 2013-03-25T15:24:37.327

To clarify the DNS lookups on the host are working fine - it's only the Virtualbox guest that is affected. – wrschneider – 2013-03-25T18:18:45.850

Answers

16

This worked for some reason

C:\...\VirtualBox\VBoxManage modifyvm "VM name" --natdnshostresolver1 on

I suspect it's because when the VPN is active, the host is doing something special for DNS lookups besides just forwarding requests to the specified DNS servers that VirtualBox picked up from the Windows config.

wrschneider

Posted 2013-03-25T01:20:32.847

Reputation: 391

Worked perfectly for me! – Hai Minh Nguyen – 2017-08-26T03:15:32.770

1You saved the day dude. – CantGetANick – 2013-06-06T06:04:04.623

1

I had a very similar situation with Lubuntu 16.04 (should be identical in other Ubuntus) but this fix did not improve the situation. At least with 16.04, the problem appears to be that NetworkManager uses a local DNS proxy (dnsmasq), and this doesn't play nice with VPN connections, at least in the default configuration.

Commenting/deleting dns=dnsmasq in /etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile,ofono
# dns=dnsmasq

There is probably a way to configure dnsmasq but this gives (me) equivalent access to the host (dns, etc.), so I haven't investigated. YMMV.

AntonOfTheWoods

Posted 2013-03-25T01:20:32.847

Reputation: 33