Ubuntu 12.04's use of networkmanager+dnsmasq breaks DNS for virtualbox VMs

Bug #1031217 reported by Stephanie Daugherty on 2012-07-31
98
This bug affects 23 people
Affects Status Importance Assigned to Milestone
virtualbox (Ubuntu)
Undecided
Unassigned
Precise
Undecided
Unassigned
Quantal
Undecided
Unassigned
Raring
Undecided
Unassigned

Bug Description

In Ubuntu 12.04, the way NetworkManager defaults to using dnsmasq as a local forwarding resolver breaks VM configuration using VirtualBox.

In 12.04, VirtualBox's DHCP server provides the host's resolver's list of nameserver address to the guest. When the host's resolver is configured to communicate with a local nameserver via a loopback address, the guest will receive loopback IP addresses as nameserver addresses; but this does not work because there is no nameserver running on the guest. The guest's resolver should be configured to use the nameserver running on the *host*.

[Impact]
DNS doesn't work in guests
- when it uses the DNS server from the DHCP response and
- the host uses NetworkManager

[Test Case]
Running "host ubuntu.com" on the command line fails.

[Development Fix]
Fixed during Raring cycle.

[Stable Fix]
Is being fixed in 4.1.12-dfsg-2ubuntu0.3 upload to precise-proposed and
4.1.18-dfsg-1ubuntu1.2 upload to quantal-proposed.

[Regression Potential]
We should verify that DNS in guests still works when the host
doesn't use networkmanager.

Thomas Hood (jdthood) wrote :

See also

   https://forums.virtualbox.org/viewtopic.php?f=7&t=49519

and

    http://www.virtualbox.org/manual/ch09.html#nat_host_resolver_proxy

which says

=== BEGIN QUOTATION ===
For resolving network names, the DHCP server of the NAT engine offers a list of registered DNS servers of the host. If for some reason you need to hide this DNS server list and use the host's resolver settings, thereby forcing the VirtualBox NAT engine to intercept DNS requests and forward them to host's resolver, use the following command:

    VBoxManage modifyvm "VM name" --natdnshostresolver1 on

Note that this setting is similar to the DNS proxy mode, however whereas the proxy mode just forwards DNS requests to the appropriate servers, the resolver mode will interpret the DNS requests and use the host's DNS API to query the information and return it to the guest.
=== END QUOTATION ===

Thomas Hood (jdthood) wrote :

Reassigning to virtualbox which should probably default to "natdnshostresolver1 on" on Ubuntu.

Upstream says

    https://forums.virtualbox.org/viewtopic.php?f=26&t=50387

that this can be done as follows.

=== BEGIN QUOTATION ===
If you want to set this globally use the following in a host terminal.

    VBoxManage setextradata global natdnshostresolver1 on
=== END QUOTATION ===

affects: network-manager (Ubuntu) → virtualbox (Ubuntu)
Changed in virtualbox (Ubuntu):
status: New → Confirmed

Also affects vagrant due to it's use of virtualbox, Seems to be accounted for upstream https://github.com/mitchellh/vagrant/pull/909

Haven't tried to see if VMWare is affected by this too.

Thomas Hood (jdthood) on 2012-08-07
summary: - networkmanager+dnsmasq implementation seems to break DNS resolution for
- virtualbox VMs
+ Ubuntu 12.04's use of networkmanager+dnsmasq breaks DNS for virtualbox
+ VMs
Bruno Girin (brunogirin) wrote :

Note that I have the same problem on 12.10 beta 2 amd64 (both host and VM).

Bruno Girin (brunogirin) wrote :

And I can also confirm that the workaround in comment #2 (namely VBoxManage modifyvm "VM name" --natdnshostresolver1 on) works perfectly well therefore it looks like that option should be enabled by default.

The workaround almost works for me. The only thing is that no matter what I ask, I get the A record for the item as a reply.
For example, doing a 'dig zonetransfer.me ns' on Ubuntu 12.10 outside the virtual machine, I get the expected:

-------[snip]-------
; <<>> DiG 9.8.1-P1 <<>> zonetransfer.me ns
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42598
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2

;; QUESTION SECTION:
;zonetransfer.me. IN NS

;; ANSWER SECTION:
zonetransfer.me. 5689 IN NS ns16.zoneedit.com.
zonetransfer.me. 5689 IN NS ns12.zoneedit.com.

;; ADDITIONAL SECTION:
ns16.zoneedit.com. 5689 IN A 69.64.68.41
ns12.zoneedit.com. 5635 IN A 209.62.64.46

;; Query time: 2 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Fri Oct 19 14:38:40 2012
;; MSG SIZE rcvd: 115
-------[/snip]--------

Inside a virtual machine with natdnshostresolver1 on, the same command yields the utterly unexpected:
-------[snip]-------
; <<>> DiG 9.7.0-P1 <<>> zonetransfer.me ns
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58758
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;zonetransfer.me. IN NS

;; ANSWER SECTION:
zonetransfer.me. 3600 IN A 217.147.180.162

;; Query time: 3 msec
;; SERVER: 10.0.2.3#53(10.0.2.3)
;; WHEN: Fri Oct 19 14:38:54 2012
;; MSG SIZE rcvd: 49
-------[/snip]-------

A tcpdump on the Ubuntu host says:
-------[snip]-------
14:50:24.700197 IP 127.0.0.1.33430 > 127.0.1.1.53: 53611+ A? zonetransfer.me. (33)
14:50:24.701638 IP 127.0.1.1.53 > 127.0.0.1.33430: 53611 1/2/2 A 217.147.180.162 (131)
-------[/snip]-------

So this seems to be a problem with the NAT engine asking the wrong question.

Does anybody have a workaround for this one?

Turns out that disabling dnsmasq (as described in http://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/ - just disable it in /etc/NetworkManager/NetworkManager.conf) and turning off natdnshostresolver1 in my VM got me the desired behavior back.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package virtualbox - 4.1.22-dfsg-0ubuntu2

---------------
virtualbox (4.1.22-dfsg-0ubuntu2) raring; urgency=low

  * Fix broken DNS in guests when the NetworkManager dnsmasq resolver
    is used on the host. (LP: #1031217)
  * Add an init script to virtuabox-guest-x11 which loads the vboxvideo
    kernel module. The X Server 1.13 doesn't load it anymore. (LP: #1049067)
 -- Felix Geyer <email address hidden> Tue, 27 Nov 2012 14:08:10 +0100

Changed in virtualbox (Ubuntu Raring):
status: Confirmed → Fix Released
Clint Byrum (clint-fewbar) wrote :

Hello! This bug is missing the required information as specified in the Ubuntu Stable Release Updates policy:

https://wiki.ubuntu.com/StableReleaseUpdates

Please add the required information. The queued upload to quantal-proposed cannot be accepted until this is completed.

ealthuis (ealthuis) wrote :

As of a bout a week ago I installed on 3 machines "virtualbox-4.2_4.2.4--82684-Ubuntu-quantal_i386.deb"

both 32 bit and 64 bit. All installations worked correctly using NAT.

I have had no further problems. Comment #9 stated that the problem was fixed, and as far as I am concerned it is.

This bug should be changed to "solved"

ealthuis (ealthuis) wrote :

Correction: Version of VBox should read: "virtualbox-4.2._4.2.6-82870-Ubuntu-quantal_i386.deb".

I happen to have both versions in my Download directory.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in virtualbox (Ubuntu Precise):
status: New → Confirmed
Changed in virtualbox (Ubuntu Quantal):
status: New → Confirmed
Steve Langasek (vorlon) wrote :

Per comment #10 from Clint, this bug is missing information needed in order to accept this SRU. Rather than leaving this package in the precise/quantal upload queues, I'm rejecting it.

Also, the changelog uses incorrect syntax for a bug closure (bug #1071344), resulting in a missing reference; this needs to be fixed and the package reuploaded.

Felix Geyer (debfx) on 2013-03-31
description: updated

Hello Stephanie, or anyone else affected,

Accepted virtualbox into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/virtualbox/4.1.12-dfsg-2ubuntu0.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in virtualbox (Ubuntu Precise):
status: Confirmed → Fix Committed
tags: added: verification-needed
Brian Murray (brian-murray) wrote :

Hello Stephanie, or anyone else affected,

Accepted virtualbox into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/virtualbox/4.1.18-dfsg-1ubuntu1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in virtualbox (Ubuntu Quantal):
status: Confirmed → Fix Committed

Just tested the new package virtualbox_4.1.18-dfsg-1ubuntu1.2 on Quantal with Windows as guest system.
No dns problems any more.

Felix Geyer (debfx) on 2013-04-06
tags: added: verification-done-quantal

No longer using Ubuntu anywhere except my already-virtualized AWS instance, so I'm unable to verify for this, but I appreciate the effort to fix this. Hopefully someone else who's affected can verify.

Thomas Hood (jdthood) on 2013-04-09
description: updated
Dmitry Shachnev (mitya57) wrote :

Can anybody using 12.04 please confirm that this bug is fixed there?

Dave-B (david-balch) wrote :

I can confirm that virtualbox 4.1.18-dfsg-1ubuntu1.2 fixed VM network access for my 12.10 install.

Felix Geyer (debfx) wrote :

I can't reproduce the original problem described in this bug on precise.
However I have tested that DNS still works with these changes.

@SRU team:
If this is not enough, please let me know and I'll upload a new SRU that contains only the fix for bug #1081307

tags: added: verification-done-precise
removed: verification-needed

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package virtualbox - 4.1.18-dfsg-1ubuntu1.2

---------------
virtualbox (4.1.18-dfsg-1ubuntu1.2) quantal-proposed; urgency=low

  * Fix broken DNS in guests when the NetworkManager dnsmasq resolver
    is used on the host. (LP: #1031217)
  * Add an init script to virtuabox-guest-x11 which loads the vboxvideo
    kernel module. The X Server 1.13 doesn't load it anymore. (LP: #1049067)
 -- Felix Geyer <email address hidden> Sun, 31 Mar 2013 15:49:35 +0200

Changed in virtualbox (Ubuntu Quantal):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package virtualbox - 4.1.12-dfsg-2ubuntu0.3

---------------
virtualbox (4.1.12-dfsg-2ubuntu0.3) precise-proposed; urgency=low

  [ Felix Geyer ]
  * Fix build errors with kernel 3.5. (LP: #1081307)
    - Add 39-kernel-35.patch
  * Fix crash when running 64-bit guests on a 32-bit host system.
    (LP: #1071344)
    - Add 40-fix-crash-64bit-guests.patch
  * Fix broken DNS in guests when the NetworkManager dnsmasq resolver
    is used on the host. (LP: #1031217)
    - Add 38-fix-nat-local-dns-resolver.patch

  [ Dmitry Shachnev ]
  * Fix the changelog, refresh patches and re-upload to precise-proposed.
 -- Felix Geyer <email address hidden> Sun, 31 Mar 2013 19:01:17 +0200

Changed in virtualbox (Ubuntu Precise):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers