VirtualBox

Ticket #1470 (new defect)

Opened 8 months ago

Last modified 1 month ago

DNS Resolver/NAT does not work if a local DNS is running (Linux Host, Any Guest)

Reported by: znerol Assigned to:
Priority: major Component: network
Version: VirtualBox 1.5.6 Keywords:
Cc: Guest type: other
Host type: Linux

Description

If the host system is setup in a way that it uses its own (caching) DNS server (i.e. /etc/resolv.conf contains only the line "nameserver 127.0.0.1") virtualbox guests using nat will not be able to resolve names using the DNS assigned by dhcp (10.0.2.3). However resolving using the standart gateway (10.0.2.2) works without problems from within guest systems. This issue is probably related to #377 and #421.

The relevant entry in the log looks like this for guests refusing to resolve via 10.0.N.3:

00:03:29.873 NAT: DNS address: 127.0.0.1

Im running virtualbox 1.5.6_OSE on Debian Lenny (testing). I did not test version 1.6.0.

Attachments

resolv.conf_from_stephanecharette (191 bytes) - added by stephanecharette on 11/11/08 10:05:21.
/etc/resolv.conf from Stéphane Charette
ifconfig_output.txt (1.0 kB) - added by stephanecharette on 11/11/08 12:10:11.
ifconfig output from Stéphane Charette

Change History

05/05/08 19:56:12 changed by zebul6

i confirm that bug in vbox 1.5.6 binary version and 1.6.0 binary edition too (linux host, windows xp guest, opensolaris guest)

i have used wireshark to try to found out what is happening :

if 10.0.2.3 is used as the dns server in the guest, the dns request is passed to my local IP 192.168.1.10 (eth0) on the host instead of 127.0.0.1. but the dns cache server (dnrd) is listening on 127.0.0.1 only and not on the 192.168.1.1 network. and it does not have to.

if 10.0.2.2 is used for dns server in the guest, then the query is sent to 127.0.0.1 in the host as it should in the previous setup

06/04/08 03:13:53 changed by stephanecharette

This is a serious bug for me. Every time I restart one of my virtual machines (several times per day for development environments) I have to fix up /etc/resolv.conf in my guest for name resolution to work. Is there a workaround available?

Host is Ubuntu 8.04-64bit, running VirtualBox v1.6.0, 64-bit. Guests are Ubuntu 7.10 & 8.04, and Fedora 8 & 9.

06/07/08 11:54:51 changed by zebul6

i gave a work around just above. use 10.0.2.2 as dns instead of 10.0.2.3

you might need to tweak your dhcp client configuration in the guest so that it does not ask for dns but use the one you defined. if not you will continue to use 10.0.2.3

07/07/08 16:50:06 changed by frank

  • host changed from other to Linux.

07/10/08 09:18:47 changed by frank

  • owner changed.
  • component changed from other to network.

(follow-up: ↓ 7 ) 09/16/08 19:35:08 changed by stephanecharette

This is still a problem in VB 2.0.2.

Makes it hard to do a network-based installation of a new OS; e.g., Debian has a minimal boot disk that DHCPs an address and grabs the rest of the installation files from the 'net. But when it DHCPs the address, it doesn't provide an easy way to override the DNS entry. Installation just hangs there forever as it tries to resolve names.

As for the "work around" stated above: in Ubuntu, even when you override the DNS from 10.0.2.3 to 10.0.2.2, when the DHCP lease is renewed the override is overwritten, and your guest OS reverts back to 10.0.2.3, obviously leading to name resolution issues.

(in reply to: ↑ 6 ) 11/03/08 06:20:02 changed by dummytaurus

To make sure resolv.conf does not change, you can follow http://www.cyberciti.biz/faq/dhclient-etcresolvconf-hooks/. Option #1 works for me.

11/11/08 00:08:22 changed by cdhowie

It seems to me that the issue here is in the fact that VirtualBox sends requests to a non-loopback address assigned to the host, according to klaus in #vbox. It's picking something other than 127.0.0.1 (for whatever reason, makes no sense to me but I'm not a dev) and on my setup dnsmasq is listening only on 127.0.0.1. In other words, vbox should not assume that it can reach the DNS server by any other address than the one it finds in resolv.conf. That's the point of resolv.conf, no? :)

I will do some tests later to confirm that this is in fact the case.

11/11/08 01:59:28 changed by cdhowie

Ok, based on my sniffing tests, VirtualBox is sending queries to 127.0.1.1 instead of 127.0.0.1, and since my DNS server is only listening on 127.0.0.1, the queries go nowhere. What's the rationale for using 127.0.1.1 when resolv.conf contains 127.0.0.1?

11/11/08 09:10:00 changed by frank

cdhowie, please could you attach your resolv.conf file (not cut'n'paste please)?

11/11/08 10:04:03 changed by stephanecharette

I suffer from this same problem (see my posting near the top of this ticket). I'll attach my resolv.conf file as well.

11/11/08 10:05:21 changed by stephanecharette

  • attachment resolv.conf_from_stephanecharette added.

/etc/resolv.conf from Stéphane Charette

11/11/08 11:17:38 changed by frank

Thanks. Could you attach the output of 'ifconfig' as well?

11/11/08 12:10:11 changed by stephanecharette

  • attachment ifconfig_output.txt added.

ifconfig output from Stéphane Charette

11/11/08 12:14:28 changed by stephanecharette

This ticket is easy to reproduce. E.g., install Ubuntu as the host, then start Synaptic Package Manager, search for and install the package named "bind9".

Next install VirtualBox. Install any type of guest (linux, windows); select NAT networking. When the guest comes up and DHCPs an address, the dns server it tries to use wont work.

11/11/08 14:01:08 changed by frank

/etc/hosts and hostname are important. The slirp code determines the host name with gethostname() and determines the host IP with gethostbyname() from that name. If one of both functions does not work, 127.0.0.1 is used. cdhowie, I assume your /etc/hosts contains a 127.0.1.1 entry. We will think about a proper fix.

11/11/08 16:17:04 changed by cdhowie

frank: You are correct, my hostname maps to 127.0.1.1. I still do not understand why this matters at all. Why should vbox proxy the requests to any other address but the one in resolv.conf? What's so special about 127.0.0.1 that it must suddenly behave differently?

(follow-up: ↓ 17 ) 11/17/08 10:42:55 changed by frank

cdhowie, my previous comment should be clear enough why this failed for several users. The reason for this behavior is unknwon as the VBox NAT code is inherited from slirp.

(in reply to: ↑ 16 ) 11/17/08 15:26:14 changed by cdhowie

frank: I understand why it's failing. I was simply expressing my confusion as to the rationale for this behavior. It looks like we are actually saying the same thing, just different ways.

(follow-up: ↓ 19 ) 11/22/08 18:28:34 changed by themadsens

Yes this is a problem for me too. Using resolvconf (ie openresolv) and dnsmasq on Arch linux.

I have been able to resolve the issuue like this:

1) Add another lo if for the 127.0.1.1 address:

ifconfig lo:0 127.0.1.1

2) Make dnsmasq listen on both addresses: Add line to /etc/dnsmasq.conf:

listen-address=127.0.0.1,127.0.1.1

Thanx for your wireshark work guys! This really got me puzzled

(in reply to: ↑ 18 ; follow-up: ↓ 20 ) 11/22/08 23:17:32 changed by cdhowie

Replying to themadsens:

I have been able to resolve the issuue like this

Yeah, that's roughly what I've had to do as well. But it's not actually a resolution, only a workaround. VirtualBox should not be doing any kind of special interpretation of what's in resolv.conf, it should use exactly the addresses it contains.

(in reply to: ↑ 19 ) 11/23/08 18:21:17 changed by themadsens

Replying to cdhowie:

it should use exactly the addresses it contains.

Agreed!

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy