VirtualBox

Opened 12 years ago

Closed 11 years ago

Last modified 9 years ago

#10864 closed enhancement (fixed)

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

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

Description

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)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1

The host's /etc/hosts contains:

127.0.0.1	localhost
127.0.1.1	sierra

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

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

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

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 (8)

comment:1 by Christopher M. Penalver, 11 years ago

Issue confirmed via downstream bug, which may be found at: https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/1048783

1) HOST:

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

2) HOST:

apt-cache policy virtualbox
virtualbox:
  Installed: 4.1.18-dfsg-1ubuntu1
  Candidate: 4.1.18-dfsg-1ubuntu1
  Version table:
 *** 4.1.18-dfsg-1ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ 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 by vasily Levchenko, 11 years ago

Type: defectenhancement

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

comment:3 by Jerome Poulin, 11 years ago

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

comment:4 by Michael Thayer, 11 years ago

Summary: VirtualBox NAT-DNS fails if DNS service is listening on 127.0.1.1VirtualBox NAT-DNS fails if DNS service is listening on 127.0.1.1 -> 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 by Frank Mehnert, 11 years ago

Resolution: fixed
Status: newclosed

Fix/workaround is part of 4.2.2.

comment:6 by cmol, 9 years ago

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

Setting:

VBoxManage modifyvm VMNAME --natdnshostresolver1 on

manually for the VM indeed changes the DNS in the from 127.0.1.1 to 10.0.2.3, 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 oracle.com (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 by Christopher M. Penalver, 9 years ago

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).

Thanks!

in reply to:  6 comment:8 by Valery Ushakov, 9 years ago

Replying to cmol:

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

Setting:

VBoxManage modifyvm VMNAME --natdnshostresolver1 on

manually for the VM indeed changes the DNS in the from 127.0.1.1 to 10.0.2.3, 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 oracle.com (which is either very funny or the opposite...).

Don't use host resolver unless you know why you need it (you most likely don't). Use --natdnsproxy1 instead.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use