qemu 0.12.3 default networking DNS broken

Bug #577908 reported by Thomas Orgis
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Invalid
Undecided
Unassigned

Bug Description

This might be something simple and known, but I don't find such information... I installed qemu 0.12.3 from source on a Linux/x86-64 host and observe that, running a debian testing guest (squeeze netinst, also the installed system), the DNS setup that qemu's DHCP provides is not working.

Namely, nameserver 10.0.2.3 in /etc/resolv.conf (as created by DHCP) does not help name resolution, but replacing the IP with my actual DNS server does work. Now this is still unfortunate as it is very cumbersome to replace the DNS for every system I run in qemu for testing... it used to work before with earlier versions.

If there is some easy means to help debug this, I'll try to help... but right now I am rather clueless.

Revision history for this message
Anthony Liguori (anthony-codemonkey) wrote :

Can you provide the full command line you are using?

Ryan Harper (raharper)
Changed in qemu:
status: New → Incomplete
Revision history for this message
Thomas Orgis (thomas-forum) wrote :

Well... with the debian VM stored in debian.qcow, the minimal command line to trigger the behaviour is

qemu -hda debian.qcow

I do not try anything fancy -- just the default, which worked in earlier times.

Revision history for this message
Thomas Orgis (thomas-forum) wrote :

Just tested again with 0.12.5: It seems to work now. Closing?

Revision history for this message
Irek Szczesniak (irek-szczesniak) wrote :

I tested the SLIRP's DNS server of compiled QEMU v. 0.12.5 and v. 0.13.

I created the thread on the Qemu-devel mailing list (http://lists.nongnu.org/archive/html/qemu-devel/2010-12/msg01893.html), but I think it's good to restate what I wrote there, especially since the thread stalled.

I have a problem with the SLIRP's DNS server. I built from sources
QEMU v 0.13 on Linux debian 2.6.26-2-686 with gcc version 4.3.2
(Debian 4.3.2-1.1).

When I don't pass any network options to QEMU, then I should get a
user networking with SLIRP. According to the man page, QEMU should
create a private network 10.0.2.0/24, and run a DHCP server on
10.0.2.2, and a DNS server on 10.0.2.3. And indeed such a network is
created, the DHCP server assigns the 10.0.2.15 IP address, but in the
DHCP transaction it seems there is no DNS server mentioned, and my
system complains about a missing DNS server.

Let me describe how I got this problem. I start the CentOS installer this way:

qemu -cdrom CentOS-5.5-i386-netinstall.iso

The installer runs, asks questions, and something goes wrong. On the
third console (Alt + F3 in the virtual machine), I can read errors:

DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPOFFER from 10.0.2.2
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 10.0.2.2
bound to 10.0.2.15 -- renewal in 33026 seconds.
DHCPv4 eth0 - obtained lease 10.0.2.15
DHCPv4 eth0 - option subnet-mask: 255.255.255.0
DHCPv4 eth0 - option subnet-mask: - prefix_len: 24 broadcast: 10.0.2.255
DHCPv4 eth0 - option routers:
no DNS servers, can't look up hostname

The installer complains that a DNS server is missing, but it seems
that the DHCP also doesn't provide a default gateway.

I ran the installer again, asking it to manually configure the network. There I put 10.0.2.15/24 as my address, 10.0.2.2 as the default gateway, and my DNS server. With those settings, the network worked fine. Later in the setup process, I was able to use a shell, and test the DNS at 10.0.2.3.

The interesting thing is that when I tried nslookup with the 10.0.2.3 server, then my requests got resolved. The installer later in the process spawns a root shell on tty2, where I issued the nslookup command. So it seems that the DNS server works (or starts working after sometime), but that the DHCP server doesn't mention the DNS server.

Can I help somehow diagnose the problem further?

Revision history for this message
Stefan Hajnoczi (stefanha) wrote : Re: [Qemu-devel] [Bug 577908] Re: qemu 0.12.3 default networking DNS broken

Can you try 'info network' on the QEMU monitor (Ctrl+Alt+2)?

You should get something like this:

VLAN 0 devices:
  user.0: net=10.0.2.0, restricted=n
  e1000.0: model=e1000,macaddr=52:54:00:12:34:56
Devices not on any VLAN:

QEMU's user networking will not provide the DNS and gateway
information if restricted=y.

Stefan

Revision history for this message
Irek Szczesniak (irek-szczesniak) wrote :

I got the very same result as you did:

VLAN 0 devices:
  user.0: net=10.0.2.0, restricted=n
  e1000.0: model=e1000,macaddr=52:54:00:12:34:56
Devices not on any VLAN:

Revision history for this message
Stefan Hajnoczi (stefanha) wrote :

On Wed, Dec 29, 2010 at 10:38 AM, Irek Szczesniak
<email address hidden> wrote:
> I got the very same result as you did:
>
> VLAN 0 devices:
>  user.0: net=10.0.2.0, restricted=n
>  e1000.0: model=e1000,macaddr=52:54:00:12:34:56
> Devices not on any VLAN:

In that case QEMU's user networking should provide the DNS server and
gateway addresses.

I captured the network traffic using the following command-line:

$ qemu-system-x86_64 -m 512 -net nic -net user -net
dump,file=/tmp/dump.log -cdrom path/to/rhel.iso
$ wireshark /tmp/dump.log

The DHCP server is providing the DNS server IP address in my case
(Debian qemu 0.12.5+dfsg-3). Wireshark shows the DHCP Offer/Ack
packet fields and makes it possible to verify that QEMU's DHCP server
is operating as expected.

Can you do the same with the CentOS iso to see if the DNS server IP is
being sent in the DHCP Offer and Ack packets?

Stefan

Revision history for this message
Irek Szczesniak (irek-szczesniak) wrote :

Thanks for your instructions, Stefan.

Wireshark showed me that in DHCPOFFER and DHCPACK there are given the DNS server and the router addresses. Then I saw that the CentOS installer uses the assigned IP address to query the 10.0.2.3 DNS server. So the CentOS insaller got the DNS address and uses it to try to reverse-resolve its IP (10.0.2.15) address.

Why the installer logs "DHCPv4 eth0 - option routers: ", i.e. no routers, that I don't know.

Moreover, why the installer logs "no DNS servers, can't look up hostname" I also don't know. It was given the address, and it even used the server. I interpreted "can't look up hostname" as "can't look up some hostname", while it probably means "can't figure out my hostname".

In my previous tests I didn't continue, because I assumed something went wrong, but now I tried again, and things just work: the installer can resolve names and reach the Internet.

In conclusion, I raised a false alarm based on the CentOS installer messages, and with more debugging, it turns out that QEMU works fine.

Thank you, Stefan, for your help. I'm happy now.

Best,
Irek
(irkos.org)

Revision history for this message
Stefan Hajnoczi (stefanha) wrote :

On Wed, Dec 29, 2010 at 10:29 PM, Irek Szczesniak
<email address hidden> wrote:
> In my previous tests I didn't continue, because I assumed something went
> wrong, but now I tried again, and things just work: the installer can
> resolve names and reach the Internet.
>
> In conclusion, I raised a false alarm based on the CentOS installer
> messages, and with more debugging, it turns out that QEMU works fine.
>
> Thank you, Stefan, for your help.  I'm happy now.

Okay, I'm glad it works for you.

Stefan

Aurelien Jarno (aurel32)
Changed in qemu:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.