Ticket #10864 (closed enhancement: fixed)

Opened 3 years ago

Last modified 33 hours ago

VirtualBox NAT-DNS fails if DNS service is listening on -> fixed as of 17 Oct 2012 for 4.1, 4.2 and later

Reported by: rocko Owned by:
Priority: major Component: network/NAT
Version: VirtualBox 4.1.20 Keywords: NAT DNS
Cc: Guest type: all
Host type: Linux


NAT-DNS does not work for guests running in virtualbox 4.2RC2 (I can't see that version in the version dropdown, btw, so I'm reporting against 4.1.20) in an Ubuntu 12.10 host with the default DNS setup, because virtualbox is sending DNS queries to the wrong address.

The host's /etc/resolv.conf contains

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

The host's /etc/hosts contains:	localhost	sierra

And "sudo netstat -nl46p | grep :53" shows dnsmasq listening on

tcp        0      0  *               LISTEN      1971/dnsmasq    
udp        0      0  *                           1336/avahi-daemon: 
udp        0      0 *                           4493/VirtualBox 
udp        0      0  *                           1971/dnsmasq    
udp6       0      0 :::5353                 :::*                                1336/avahi-daemon:

However, wireshark shows that VirtualBox is incorrectly trying to query instead of

A workaround is to manually force every VM to use the host's resolver with "VBoxManage modifyvm "VM name" --natdnshostresolver1 on" or to modify the guest's /etc/resolv.conf file with an external nameserver.

Change History

comment:1 Changed 3 years ago by penalvch

Issue confirmed via downstream bug, which may be found at:

1) HOST:

lsb_release -rd
Description: Ubuntu quantal (development branch)
Release: 12.10

2) HOST:

apt-cache policy virtualbox
  Installed: 4.1.18-dfsg-1ubuntu1
  Candidate: 4.1.18-dfsg-1ubuntu1
  Version table:
 *** 4.1.18-dfsg-1ubuntu1 0
        500 quantal/universe i386 Packages
        100 /var/lib/dpkg/status

3) What is expected to happen is when one starts VMs that worked in Precise:

+ Microsoft Windows Vista Business 6.0.6002 Service Pack 2 Build 6002


lsb_release -rd
Description: Ubuntu quantal (development branch)
Release: 12.10

one may open a browser (IE or Firefox) and it successfully connects to the internet.

4) What happens instead is it does not. This was also tested with brand new virtualbox VMS.

One may still ping ip addresses when connected with a NAT virtual NIC, but not do DNS lookup.

WORKAROUND: Execute at a terminal:

VBoxManage modifyvm VMNAME --natdnshostresolver1 on

comment:2 Changed 3 years ago by Hachiman

  • Type changed from defect to enhancement

NAT wasn't designed to work with host network and I don't see any easy way to change this behaviour except explicit adding mapping addresses from to NAT's address space, like <->

comment:3 Changed 3 years ago by TiCPU

This will get even more common with Ubuntu Network Manager. Even if NAT wasn't designed to, DNS was designed to work with Why not enable the workaround option by default? Maybe add it to the interface.

comment:4 Changed 3 years ago by michael

  • Summary changed from VirtualBox NAT-DNS fails if DNS service is listening on to VirtualBox NAT-DNS fails if DNS service is listening on -> fixed as of 17 Oct 2012 for 4.1, 4.2 and later

We have indeed decided to do that. Any future 4.1, 4.2 or later releases should detect this and enable the work-around by default.

comment:5 Changed 3 years ago by frank

  • Status changed from new to closed
  • Resolution set to fixed

Fix/workaround is part of 4.2.2.

comment:6 Changed 3 days ago by cmol

I have just had this issue with OpenBSD 5.7, and VirtualBox 5.0.


VBoxManage modifyvm VMNAME --natdnshostresolver1 on

manually for the VM indeed changes the DNS in the from to, however it seems like a portion of addresses cannot be resolved in application use, but can by dig.

The preliminary results gave me problems with any "*.com" domain, except for (which is either very funny or the opposite...).

Also, I don't know if I should post this here or open a new ticket, please advice me if I should do something else.

Thank you :)

comment:7 Changed 33 hours ago by penalvch

cmol, as the originally scoped issue was fixed 3 years ago, and this report is closed, if you want your issue addressed please file a new report (not comment on closed reports).


Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use