All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
@ 2017-04-13 20:17 FONNEMANN Mark
  2017-04-24  8:00 ` Thomas Huth
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-13 20:17 UTC (permalink / raw)
  To: qemu-devel

Hello-

I posted this question on stack overflow and got no response. Stefan recommended asking the question here.

I’ve included a summary of the problem here in this email but more details can be found here:

http://stackoverflow.com/questions/43308310/dns-server-not-working-in-qemu-usermode-networking?noredirect=1#comment73706410_43308310

Basically, I can access the internet using static IP addresses but nameserver resolution is not working. I can ping the router 10.0.2.2 address and my 10.0.2.15 address but not the 10.0.2.3 address of the DNS server or the 10.0.2.4 of the SMB server both of which I need for my project.

Any suggestions?

p.s. I tried 2.9rc3 and it failed as well.

Best Regards / Mit freundlichen Grüßen / 敬具,
Mark.

Mark Fonnemann
Senior Software Engineer – Machine Tool Metrology Solutions
T: +1 401.886.2521  M: +1 248.863.7931
E: mark.fonnemann@hexagonmetrology.com<mailto:mark.fonnemann@hexagonmetrology.com>

Hexagon Manufacturing Intelligence
250 Circuit Drive
North Kingstown, RI  02822
USA
pc-dmis.com<http://www.pc-dmis.com/> | LinkedIn<http://www.linkedin.com/groups/Hexagon-Metrology-Inc-4014294/about> | Facebook<http://www.facebook.com/Hexagon.Metrology.Inc> | Twitter<http://twitter.com/hexmet>


^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
@ 2017-04-15 23:27 FONNEMANN Mark
  2017-04-16  8:09 ` Samuel Thibault
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-15 23:27 UTC (permalink / raw)
  To: qemu-devel

This has been filed as a bug: https://bugs.launchpad.net/qemu/+bug/1683084.

Mark.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-15 23:27 FONNEMANN Mark
@ 2017-04-16  8:09 ` Samuel Thibault
  2017-04-16 22:10   ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-04-16  8:09 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: qemu-devel

Hello,

I hadn't seen the original report on the list, sorry. There is too much
traffic on qemu-devel for me to manage to catch these :/

This problem was fixed by 
e42f869b ("slirp: Make RA build more flexible") and
a2f80fdf ("slirp: Send RDNSS in RA only if host has an IPv6 DNS server")
which will be included in qemu 2.9.

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-16  8:09 ` Samuel Thibault
@ 2017-04-16 22:10   ` FONNEMANN Mark
  2017-04-21 19:58     ` Stefan Weil
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-16 22:10 UTC (permalink / raw)
  To: qemu-devel

This issue still exists for me in 2.9 rc4.  

-----Original Message-----
From: Samuel Thibault [mailto:samuel.thibault@gnu.org] 
Sent: Sunday, April 16, 2017 04:10
To: FONNEMANN Mark <mark.fonnemann@hexagon.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)

Hello,

I hadn't seen the original report on the list, sorry. There is too much traffic on qemu-devel for me to manage to catch these :/

This problem was fixed by
e42f869b ("slirp: Make RA build more flexible") and a2f80fdf ("slirp: Send RDNSS in RA only if host has an IPv6 DNS server") which will be included in qemu 2.9.

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-16 22:10   ` FONNEMANN Mark
@ 2017-04-21 19:58     ` Stefan Weil
  2017-04-22 12:36       ` Samuel Thibault
  2017-04-26 18:51       ` FONNEMANN Mark
  0 siblings, 2 replies; 29+ messages in thread
From: Stefan Weil @ 2017-04-21 19:58 UTC (permalink / raw)
  To: FONNEMANN Mark, qemu-devel, Samuel Thibault

Am 17.04.2017 um 00:10 schrieb FONNEMANN Mark:
> This issue still exists for me in 2.9 rc4.
>
> -----Original Message-----
> From: Samuel Thibault [mailto:samuel.thibault@gnu.org]
> Sent: Sunday, April 16, 2017 04:10
> To: FONNEMANN Mark <mark.fonnemann@hexagon.com>
> Cc: qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
>
> Hello,
>
> I hadn't seen the original report on the list, sorry. There is too much traffic on qemu-devel for me to manage to catch these :/
>
> This problem was fixed by
> e42f869b ("slirp: Make RA build more flexible") and a2f80fdf ("slirp: Send RDNSS in RA only if host has an IPv6 DNS server") which will be included in qemu 2.9.
>
> Samuel

See report on 
http://stackoverflow.com/questions/43308310/dns-server-not-working-in-qemu-usermode-networking.

Mark, did you also get that problem with QEMU running on a Linux host,
or is it specific for QEMU running on Windows?

Regards,
Stefan

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-21 19:58     ` Stefan Weil
@ 2017-04-22 12:36       ` Samuel Thibault
  2017-04-26 18:51       ` FONNEMANN Mark
  1 sibling, 0 replies; 29+ messages in thread
From: Samuel Thibault @ 2017-04-22 12:36 UTC (permalink / raw)
  To: Stefan Weil; +Cc: FONNEMANN Mark, qemu-devel

Stefan Weil, on ven. 21 avril 2017 21:58:18 +0200, wrote:
> Am 17.04.2017 um 00:10 schrieb FONNEMANN Mark:
> > I hadn't seen the original report on the list, sorry. There is too much traffic on qemu-devel for me to manage to catch these :/
> > 
> > This problem was fixed by
> > e42f869b ("slirp: Make RA build more flexible") and a2f80fdf ("slirp: Send RDNSS in RA only if host has an IPv6 DNS server") which will be included in qemu 2.9.
> > 
> > Samuel
> 
> See report on http://stackoverflow.com/questions/43308310/dns-server-not-working-in-qemu-usermode-networking.
> 
> Mark, did you also get that problem with QEMU running on a Linux host,
> or is it specific for QEMU running on Windows?

Ah, I hadn't noticed the report was about windows. The abovementioned
fix should still be fine for windows: there, get_dns6_addr just always
returns -1, and thus the RDNSS option is never added.

So I don't know what to do on my side, more investigation is needed
there.

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-13 20:17 [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP) FONNEMANN Mark
@ 2017-04-24  8:00 ` Thomas Huth
  2017-04-24 23:43   ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Thomas Huth @ 2017-04-24  8:00 UTC (permalink / raw)
  To: FONNEMANN Mark, qemu-devel; +Cc: Samuel Thibault

On 13.04.2017 22:17, FONNEMANN Mark wrote:
> Hello-
> 
> I posted this question on stack overflow and got no response. Stefan recommended asking the question here.
> 
> I’ve included a summary of the problem here in this email but more details can be found here:
> 
> http://stackoverflow.com/questions/43308310/dns-server-not-working-in-qemu-usermode-networking?noredirect=1#comment73706410_43308310
> 
> Basically, I can access the internet using static IP addresses but nameserver resolution is not working. I can ping the router 10.0.2.2 address and my 10.0.2.15 address but not the 10.0.2.3 address of the DNS server or the 10.0.2.4 of the SMB server both of which I need for my project.
> 
> Any suggestions?
> 
> p.s. I tried 2.9rc3 and it failed as well.

IIRC there have been some DNS related fixes shortly before the final 2.9
release ... so does it work if you use the final 2.9.0 version instead?

 Thomas

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-24  8:00 ` Thomas Huth
@ 2017-04-24 23:43   ` FONNEMANN Mark
  2017-04-29 12:44     ` Samuel Thibault
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-24 23:43 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: Samuel Thibault

-----Original Message-----
From: Thomas Huth [mailto:thuth@redhat.com] 
Sent: Monday, April 24, 2017 04:00
To: FONNEMANN Mark <mark.fonnemann@hexagon.com>; qemu-devel@nongnu.org
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)

> IIRC there have been some DNS related fixes shortly before the final 2.9 release ... so does it work if you use the final 2.9.0 version instead?

I just confirmed that the problem exists in 2.9 release using qemu-system-i386.exe as well.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-21 19:58     ` Stefan Weil
  2017-04-22 12:36       ` Samuel Thibault
@ 2017-04-26 18:51       ` FONNEMANN Mark
  1 sibling, 0 replies; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-26 18:51 UTC (permalink / raw)
  To: Stefan Weil, qemu-devel; +Cc: Samuel Thibault

-----Original Message-----
From: Stefan Weil [mailto:sw@weilnetz.de] 
Sent: Friday, April 21, 2017 15:58
To: FONNEMANN Mark <mark.fonnemann@hexagon.com>; qemu-devel@nongnu.org; Samuel Thibault <samuel.thibault@gnu.org>
Subject: Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)

>See report on
>http://stackoverflow.com/questions/43308310/dns-server-not-working-in-qemu-usermode-networking.

>Mark, did you also get that problem with QEMU running on a Linux host, or is it specific for QEMU running on Windows?

I just verified the problem exists on Linux host as well. I cannot ping the DNS or SMB server and the DNS server does not respond to nslookup requests.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-24 23:43   ` FONNEMANN Mark
@ 2017-04-29 12:44     ` Samuel Thibault
  2017-04-29 15:32       ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-04-29 12:44 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Thomas Huth, qemu-devel, Stefan Weil, MCDONALD Margaret

Hello,

FONNEMANN Mark, on mer. 19 avril 2017 18:11:59 +0000, wrote:
> I have tested 2.9-rc4 and the problem still exists there as well.

FONNEMANN Mark, on lun. 24 avril 2017 23:43:02 +0000, wrote:
> I just confirmed that the problem exists in 2.9 release using qemu-system-i386.exe as well.

FONNEMANN Mark, on mer. 26 avril 2017 18:51:00 +0000, wrote:
> I just verified the problem exists on Linux host as well. I cannot ping the DNS or SMB server and the DNS server does not respond to nslookup requests.

One first thing to note: the DNS or SMB servers can not be pinged, since
that was never implemented (I'll post a patch for that), so there is no
surprise on that end.

Also, your issue happens even with explictly requesting ipv4, so it's
probably not a problem with the v6 updates by themselves.

When running with a Linux host (since that's what I'm most familiar
with), what do you have in /etc/resolv.conf?

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-29 12:44     ` Samuel Thibault
@ 2017-04-29 15:32       ` FONNEMANN Mark
  2017-04-29 17:10         ` Samuel Thibault
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-29 15:32 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Thomas Huth, qemu-devel, Stefan Weil, MCDONALD Margaret

Hello-

>One first thing to note: the DNS or SMB servers can not be pinged, since that was never implemented (I'll post a patch for that), so there is no surprise on that end.

OK

>When running with a Linux host (since that's what I'm most familiar with), what do you have in /etc/resolv.conf?

[mfonnemann@localhost ~]$ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 4.2.2.1
nameserver 4.2.2.2

mark.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-29 15:32       ` FONNEMANN Mark
@ 2017-04-29 17:10         ` Samuel Thibault
  2017-04-29 18:25           ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-04-29 17:10 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Thomas Huth, qemu-devel, Stefan Weil, MCDONALD Margaret

FONNEMANN Mark, on sam. 29 avril 2017 15:32:35 +0000, wrote:
> >When running with a Linux host (since that's what I'm most familiar with), what do you have in /etc/resolv.conf?
> 
> [mfonnemann@localhost ~]$ cat /etc/resolv.conf
> # Generated by NetworkManager
> nameserver 4.2.2.1
> nameserver 4.2.2.2

And I guess these do work fine on the host.

Perhaps you should make sure that qemu does emit the DNS lookup request
to these thanks to

tcpdump -i any host 4.2.2.1 or host 4.2.2.2

while you run nslookup from the guest.

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-29 17:10         ` Samuel Thibault
@ 2017-04-29 18:25           ` FONNEMANN Mark
  2017-04-29 19:14             ` Samuel Thibault
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-29 18:25 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Thomas Huth, qemu-devel, Stefan Weil, MCDONALD Margaret

Hello-

>And I guess these do work fine on the host.

Yes:

[mfonnemann@localhost ~]$ nslookup www.google.com
Server:         4.2.2.1
Address:        4.2.2.1#53

Non-authoritative answer:
Name:   www.google.com
Address: 172.217.11.4

>Perhaps you should make sure that qemu does emit the DNS lookup request to these thanks to
>tcpdump -i any host 4.2.2.1 or host 4.2.2.2
>while you run nslookup from the guest.

1. Issue command as requested on linux host:

 [mfonnemann@localhost qemu]$ sudo tcpdump -i any host 4.2.2.1 or host 4.2.2.2
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes

2. Start qemu on linux host:

[mfonnemann@localhost qemu]$ /usr/local/bin/qemu-system-i386 -display curses -readconfig qemu.cfg

3. Do nslookup on linux guest:

root@qemu:~# nslookup www.google.com

                    *** Unknown host

                    nslookup: www.google.com: Unknown host

root@qemu:~# nslookup www.google.com 10.0.2.3
                    *** Unknown host

                    nslookup: www.google.com: Unknown host

4. Exit tcpdump via ctrl-c:

^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

Thanks for your continued assistance!

Mark.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-29 18:25           ` FONNEMANN Mark
@ 2017-04-29 19:14             ` Samuel Thibault
  2017-04-29 20:06               ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-04-29 19:14 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Thomas Huth, qemu-devel, Stefan Weil, MCDONALD Margaret

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

FONNEMANN Mark, on sam. 29 avril 2017 18:25:26 +0000, wrote:
> 0 packets received by filter

Ok, so nothing going out from qemu. Could you try to apply the attached
patch to qemu-2.9 and see what it makes qemu print when you resolve a
domain from the guest?

Samuel

[-- Attachment #2: dns --]
[-- Type: text/plain, Size: 2695 bytes --]

--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -814,11 +814,18 @@ void sotranslate_out(struct socket *so,
 
     switch (addr->ss_family) {
     case AF_INET:
+        fprintf(stderr,"translating %x against %x %x\n",
+                so->so_faddr.s_addr,
+                slirp->vnetwork_mask.s_addr,
+                slirp->vnameserver_addr.s_addr);
         if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) ==
                 slirp->vnetwork_addr.s_addr) {
             /* It's an alias */
+            fprintf(stderr,"it's an alias\n");
             if (so->so_faddr.s_addr == slirp->vnameserver_addr.s_addr) {
+                fprintf(stderr,"it's DNS\n");
                 if (get_dns_addr(&sin->sin_addr) < 0) {
+                    fprintf(stderr,"didn't get DNS address");
                     sin->sin_addr = loopback_addr;
                 }
             } else {
--- a/slirp/udp.c
+++ b/slirp/udp.c
@@ -133,6 +133,10 @@ udp_input(register struct mbuf *m, int i
 	lhost4->sin_addr = ip->ip_src;
 	lhost4->sin_port = uh->uh_sport;
 
+        if (ntohs(uh->uh_dport) == 53 &&
+            ip->ip_dst.s_addr == slirp->vnameserver_addr.s_addr)
+            fprintf(stderr,"UDP packet for DNS server\n");
+
         /*
          *  handle DHCP/BOOTP
          */
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -165,6 +165,7 @@ static int get_dns_addr_resolv_conf(int
 #endif
     while (fgets(buff, 512, f) != NULL) {
         if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) {
+            fprintf(stderr,"got resolv.conf entry '%s'\n", buff2);
             char *c = strchr(buff2, '%');
             if (c) {
                 if_index = if_nametoindex(c + 1);
@@ -174,10 +175,16 @@ static int get_dns_addr_resolv_conf(int
             }
 
             if (!inet_pton(af, buff2, tmp_addr)) {
+                fprintf(stderr,"couldn't parse it\n");
                 continue;
             }
             /* If it's the first one, set it to dns_addr */
             if (!found) {
+                if (af == AF_INET)
+                {
+                    struct sockaddr_in *sin = tmp_addr;
+                    fprintf(stderr,"parsed %x\n", sin->sin_addr.s_addr);
+                }
                 memcpy(pdns_addr, tmp_addr, addrlen);
                 memcpy(cached_addr, tmp_addr, addrlen);
                 if (scope_id) {
@@ -219,6 +226,7 @@ int get_dns_addr(struct in_addr *pdns_ad
 
     if (dns_addr.s_addr != 0) {
         int ret;
+        fprintf(stderr,"dns_addr is cached: %x\n", dns_addr.s_addr);
         ret = get_dns_addr_cached(pdns_addr, &dns_addr, sizeof(dns_addr),
                                   &dns_addr_stat, &dns_addr_time);
         if (ret <= 0) {

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-29 19:14             ` Samuel Thibault
@ 2017-04-29 20:06               ` FONNEMANN Mark
  2017-04-29 22:01                 ` Samuel Thibault
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-29 20:06 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Thomas Huth, qemu-devel, Stefan Weil, MCDONALD Margaret

>Ok, so nothing going out from qemu. Could you try to apply the attached patch to qemu-2.9 and see what it makes qemu print when you resolve a domain from the guest?

After applying patch, compiling, installing and then doing a nslookup request in the guest, I still receive no output in tcpdump and my logfile is empty:

[mfonnemann@localhost qemu-2.9.0]$ make
make  all-recursive
Making all in pixman
make[3]: Nothing to be done for `all'.
Making all in demos
make[3]: Nothing to be done for `all'.
Making all in test
make[3]: Nothing to be done for `all'.
        CHK version_gen.h
  CC      slirp/slirp.o
  CC      slirp/socket.o
  CC      slirp/udp.o
  LINK    i386-softmmu/qemu-system-i386
  LINK    x86_64-softmmu/qemu-system-x86_64

[mfonnemann@localhost qemu-2.9.0]$ sudo make install
[sudo] password for mfonnemann:
make  all-recursive
Making all in pixman
make[3]: Nothing to be done for `all'.
Making all in demos
make[3]: Nothing to be done for `all'.
Making all in test
make[3]: Nothing to be done for `all'.
        CHK version_gen.h
install -d -m 0755 "/usr/local/share/qemu"
install -d -m 0755 "/usr/local/var"/run
install -d -m 0755 "/usr/local/bin"
install -c -m 0755 qemu-ga ivshmem-client ivshmem-server qemu-nbd qemu-img qemu-io  "/usr/local/bin"
strip "/usr/local/bin/qemu-ga" "/usr/local/bin/ivshmem-client" "/usr/local/bin/ivshmem-server" "/usr/local/bin/qemu-nbd" "/usr/local/bin/qemu-img" "/usr/local/bin/qemu-io"
install -d -m 0755 "/usr/local/libexec"
install -c -m 0755 qemu-bridge-helper "/usr/local/libexec"
strip "/usr/local/libexec/qemu-bridge-helper"
set -e; for x in bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin acpi-dsdt.aml ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom efi-e1000e.rom efi-vmxnet3.rom qemu-icon.bmp qemu_logo_no_text.svg bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin s390-ccw.img spapr-rtas.bin slof.bin skiboot.lid palcode-clipper u-boot.e500; do \
        install -c -m 0644 /home/mfonnemann/qemu-2.9.0/pc-bios/$x "/usr/local/share/qemu"; \
done
install -d -m 0755 "/usr/local/share/qemu/keymaps"
set -e; for x in da     en-gb  et  fr     fr-ch  is  lt  modifiers  no  pt-br  sv ar      de     en-us  fi  fr-be  hr     it  lv  nl         pl  ru     th common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr bepo    cz; do \
        install -c -m 0644 /home/mfonnemann/qemu-2.9.0/pc-bios/keymaps/$x "/usr/local/share/qemu/keymaps"; \
done
install -c -m 0644 /home/mfonnemann/qemu-2.9.0/trace-events-all "/usr/local/share/qemu/trace-events-all"
for d in i386-softmmu x86_64-softmmu; do \
make --no-print-directory BUILD_DIR=/home/mfonnemann/qemu-2.9.0 TARGET_DIR=$d/ -C $d install || exit 1 ; \
        done
install -d -m 0755 "/usr/local/bin"
install -c -m 0755 qemu-system-i386  "/usr/local/bin"
strip "/usr/local/bin/qemu-system-i386"
install -d -m 0755 "/usr/local/bin"
install -c -m 0755 qemu-system-x86_64  "/usr/local/bin"
strip "/usr/local/bin/qemu-system-x86_64"

[mfonnemann@localhost qemu]$ /usr/local/bin/qemu-system-i386 -display curses -readconfig qemu.cfg -D logfile

root@qemu:~# nslookup www.google.com

                    *** Unknown host

                    nslookup: www.google.com: Unknown host

[mfonnemann@localhost qemu]$ ls -Al logfile
-rw-rw-r--. 1 mfonnemann mfonnemann 0 Apr 29 15:58 logfile

Mark.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-29 20:06               ` FONNEMANN Mark
@ 2017-04-29 22:01                 ` Samuel Thibault
  2017-04-29 23:15                   ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-04-29 22:01 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Stefan Weil, Thomas Huth, qemu-devel, MCDONALD Margaret

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]

FONNEMANN Mark, on sam. 29 avril 2017 20:06:09 +0000, wrote:
> [mfonnemann@localhost qemu]$ /usr/local/bin/qemu-system-i386 -display curses -readconfig qemu.cfg -D logfile

Ah, you are using curses... I've been putting logs onto stderr for
simplicity, not the proper qemu logs. Here is a fixed patch to get
output in the log.

Samuel

[-- Attachment #2: dns --]
[-- Type: text/plain, Size: 3064 bytes --]

--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -6,6 +6,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/log.h"
 #include "qemu-common.h"
 #include "slirp.h"
 #include "ip_icmp.h"
@@ -814,11 +815,18 @@ void sotranslate_out(struct socket *so,
 
     switch (addr->ss_family) {
     case AF_INET:
+        qemu_log("translating %x against %x %x\n",
+                so->so_faddr.s_addr,
+                slirp->vnetwork_mask.s_addr,
+                slirp->vnameserver_addr.s_addr);
         if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) ==
                 slirp->vnetwork_addr.s_addr) {
             /* It's an alias */
+            qemu_log("it's an alias\n");
             if (so->so_faddr.s_addr == slirp->vnameserver_addr.s_addr) {
+                qemu_log("it's DNS\n");
                 if (get_dns_addr(&sin->sin_addr) < 0) {
+                    qemu_log("didn't get DNS address");
                     sin->sin_addr = loopback_addr;
                 }
             } else {
--- a/slirp/udp.c
+++ b/slirp/udp.c
@@ -39,6 +39,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/log.h"
 #include "slirp.h"
 #include "ip_icmp.h"
 
@@ -133,6 +134,10 @@ udp_input(register struct mbuf *m, int i
 	lhost4->sin_addr = ip->ip_src;
 	lhost4->sin_port = uh->uh_sport;
 
+        if (ntohs(uh->uh_dport) == 53 &&
+            ip->ip_dst.s_addr == slirp->vnameserver_addr.s_addr)
+            qemu_log("UDP packet for DNS server\n");
+
         /*
          *  handle DHCP/BOOTP
          */
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu/log.h"
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
@@ -165,6 +166,7 @@ static int get_dns_addr_resolv_conf(int
 #endif
     while (fgets(buff, 512, f) != NULL) {
         if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) {
+            qemu_log("got resolv.conf entry '%s'\n", buff2);
             char *c = strchr(buff2, '%');
             if (c) {
                 if_index = if_nametoindex(c + 1);
@@ -174,10 +176,16 @@ static int get_dns_addr_resolv_conf(int
             }
 
             if (!inet_pton(af, buff2, tmp_addr)) {
+                qemu_log("couldn't parse it as %d\n", af);
                 continue;
             }
             /* If it's the first one, set it to dns_addr */
             if (!found) {
+                if (af == AF_INET)
+                {
+                    struct in_addr *in = tmp_addr;
+                    qemu_log("parsed %x\n", in->s_addr);
+                }
                 memcpy(pdns_addr, tmp_addr, addrlen);
                 memcpy(cached_addr, tmp_addr, addrlen);
                 if (scope_id) {
@@ -219,6 +227,7 @@ int get_dns_addr(struct in_addr *pdns_ad
 
     if (dns_addr.s_addr != 0) {
         int ret;
+        qemu_log("dns_addr is cached: %x\n", dns_addr.s_addr);
         ret = get_dns_addr_cached(pdns_addr, &dns_addr, sizeof(dns_addr),
                                   &dns_addr_stat, &dns_addr_time);
         if (ret <= 0) {

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-29 22:01                 ` Samuel Thibault
@ 2017-04-29 23:15                   ` FONNEMANN Mark
  2017-04-30  7:50                     ` Samuel Thibault
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-29 23:15 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Stefan Weil, Thomas Huth, qemu-devel

>Ah, you are using curses... I've been putting logs onto stderr for simplicity, not the proper qemu logs. Here is a fixed patch to get output in the log.

OK, I have an interesting development that I hope will shed some light on the problem.
This configuration works using a different image (nslookup succeeds and I can see your debug output):

[mfonnemann@desktopPC qemu]$ /usr/local/bin/qemu-system-i386 -display curses -readconfig works.cfg --enable-kvm
                   [mfonnemann@localhost ~]$ nslookup www.google.com
                   UDP packet for DNS server
                                            translating 302000a against ffffff 302000a
                                                                                      it's an alias
                                                                                                   it's DNS
                                                                                                           dns_addr is cached: 1020204
               got Server:conf entr10.0.2.3.1'
                   Address:        10.0.2.3#53

                   Non-authoritative answer:
                   Name:   www.google.com
                   Address: 172.217.10.68
 [mfonnemann@desktopPC qemu]$ cat works.cfg
[drive]
  format = "raw"
  file = "fc5.img"

[drive]
  format = "vhdx"
  file = "placeholder2.vhdx"

[drive]
  format = "raw"
  file = "swap_512m.img"

[drive]
  format = "vhdx"
  file = "placeholder.vhdx"

[machine]
  usb = "on"

[memory]
  size = "2G"

[smp-opts]
  cpus = "2"

But my original one still does not:

[mfonnemann@desktopPC qemu]$ /usr/local/bin/qemu-system-i386 -display curses -readconfig NG.cfg --enable-kvm
root@qemu:~# nslookup www.google.com
                   *** Unknown host

                   nslookup: www.google.com: Unknown host
                   root@qemu:~# 
[mfonnemann@desktopPC qemu]$ cat NG.cfg
[drive]
  format = "raw"
  file = "qemu_rootfs_512.img"

[drive]
  format = "raw"
  file = "placeholder2.vhdx"

[drive]
  format = "raw"
  file = "swap_512m.img"

[drive]
  format = "vhdx"
  file = "placeholder.vhdx"

[machine]
  usb = "on"
  initrd = "initrd-2.6.11.12.img.gz"
  kernel = "vmlinuz-2.6.11.12-vanilla.bz"
  append = "root=/dev/hda"

[memory]
  size = "2G"

[smp-opts]
  cpus = "2"

Both are using static IP addresses.

Mark.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-29 23:15                   ` FONNEMANN Mark
@ 2017-04-30  7:50                     ` Samuel Thibault
  2017-04-30 12:42                       ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-04-30  7:50 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Stefan Weil, Thomas Huth, qemu-devel

FONNEMANN Mark, on sam. 29 avril 2017 23:15:08 +0000, wrote:
> [mfonnemann@desktopPC qemu]$ /usr/local/bin/qemu-system-i386 -display curses -readconfig NG.cfg --enable-kvm

Could you show us your NG.cfg, your guest /sbin/ifconfig and /sbin/route
output and /etc/resolv.conf content for that host?

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-30  7:50                     ` Samuel Thibault
@ 2017-04-30 12:42                       ` FONNEMANN Mark
  2017-04-30 12:57                         ` Samuel Thibault
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-04-30 12:42 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Stefan Weil, Thomas Huth, qemu-devel, MCDONALD Margaret

>Could you show us your NG.cfg, your guest /sbin/ifconfig and /sbin/route output and /etc/resolv.conf >content for that host?

[mfonnemann@desktopPC qemu]$ cat NG.cfg
[drive]
  format = "raw"
  file = "qemu_rootfs_512.img"

[drive]
  format = "raw"
  file = "placeholder2.vhdx"

[drive]
  format = "raw"
  file = "swap_512m.img"

[drive]
  format = "vhdx"
  file = "placeholder.vhdx"

[machine]
  usb = "on"
  initrd = "initrd-2.6.11.12.img.gz"
  kernel = "vmlinuz-2.6.11.12-vanilla.bz"
  append = "root=/dev/hda"

[memory]
  size = "2G"

[smp-opts]
  cpus = "2"

root@qemu:~# ifconfig
                   eth0      Link encap:Ethernet  HWaddr 52:54:00:12:34:56
                             inet addr:10.0.2.15  Bcast:10.255.255.255  Mask:255.255.255.0
                             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                             RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                             TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                             collisions:0 txqueuelen:1000
                             RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
                             Base address:0xc000 Memory:febc0000-febe0000

                   lo        Link encap:Local Loopback
                             inet addr:127.0.0.1  Mask:255.0.0.0
                             UP LOOPBACK RUNNING  MTU:16436  Metric:1
                             RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                             TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                             collisions:0 txqueuelen:0

                  root@qemu:~# route
UDP packet for DNS server
                                                              translating 302000a against ffffff 302000a
                                                                                                        it's an alias
                                                                                                                     it's DNS
      dns_addr is cached: 1020204
                                 got resolv.conf entry '4.2.2.1'
                   Kernel IP routing table                      
parsed 7fe2
                   Destination     Gateway         Genmask         Flags Metric Ref    
Use Iface '4.2.2.2'
                   10.0.2.0        *               255.255.255.0   U     0      0        0 eth0
                   default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0

root@qemu:~# cat /etc/resolv.conf
                   nameserver 10.0.2.3

root@qemu:~# nslookup www.google.com
                   *** Unknown host

                   nslookup: www.google.com: Unknown host

HTH

It appears using the "route" command causes your DNS debug statements to print out but still nslookup does not work correctly.

mark.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-30 12:42                       ` FONNEMANN Mark
@ 2017-04-30 12:57                         ` Samuel Thibault
  2017-05-05 22:38                           ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-04-30 12:57 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Stefan Weil, Thomas Huth, qemu-devel, MCDONALD Margaret

FONNEMANN Mark, on dim. 30 avril 2017 12:42:41 +0000, wrote:
> root@qemu:~# nslookup www.google.com
>                    *** Unknown host
> 
>                    nslookup: www.google.com: Unknown host

Could you run tcpdump inside the guest so we are sure what the nslookup
call emits?

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-04-30 12:57                         ` Samuel Thibault
@ 2017-05-05 22:38                           ` FONNEMANN Mark
  2017-05-05 23:14                             ` Samuel Thibault
  2017-05-08  1:03                             ` Thomas Huth
  0 siblings, 2 replies; 29+ messages in thread
From: FONNEMANN Mark @ 2017-05-05 22:38 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Stefan Weil, Thomas Huth, qemu-devel, MCDONALD Margaret

>Could you run tcpdump inside the guest so we are sure what the nslookup call emits?

Is there another way to determine this info? My guest OS is an embedded system with BusyBox 1.25 and not much else.

Mark.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-05-05 22:38                           ` FONNEMANN Mark
@ 2017-05-05 23:14                             ` Samuel Thibault
  2017-05-06  0:33                               ` FONNEMANN Mark
  2017-05-08  1:03                             ` Thomas Huth
  1 sibling, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-05-05 23:14 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Stefan Weil, Thomas Huth, qemu-devel, MCDONALD Margaret

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

FONNEMANN Mark, on ven. 05 mai 2017 22:38:20 +0000, wrote:
> >Could you run tcpdump inside the guest so we are sure what the nslookup call emits?
> 
> Is there another way to determine this info? My guest OS is an embedded system with BusyBox 1.25 and not much else.

The attached patch should be dumping the same kind of information.

Samuel

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1224 bytes --]

diff --git a/slirp/ip_input.c b/slirp/ip_input.c
index 348e1dca5a..ada6f0d059 100644
--- a/slirp/ip_input.c
+++ b/slirp/ip_input.c
@@ -41,6 +41,7 @@
 #include "qemu/osdep.h"
 #include "slirp.h"
 #include "ip_icmp.h"
+#include "qemu/log.h"
 
 static struct ip *ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp);
 static void ip_freef(Slirp *slirp, struct ipq *fp);
@@ -93,6 +94,8 @@ ip_input(struct mbuf *m)
 
 	ip = mtod(m, struct ip *);
 
+        qemu_log("ip input %x -> %x %x\n", ntohl(ip->ip_src.s_addr), ntohl(ip->ip_dst.s_addr), ip->ip_p);
+
 	if (ip->ip_v != IPVERSION) {
 		goto bad;
 	}
diff --git a/slirp/udp.c b/slirp/udp.c
index 227d779022..521c3a5a57 100644
--- a/slirp/udp.c
+++ b/slirp/udp.c
@@ -41,6 +41,7 @@
 #include "qemu/osdep.h"
 #include "slirp.h"
 #include "ip_icmp.h"
+#include "qemu/log.h"
 
 static uint8_t udp_tos(struct socket *so);
 
@@ -95,6 +96,7 @@ udp_input(register struct mbuf *m, int iphlen)
 	ip = mtod(m, struct ip *);
 	uh = (struct udphdr *)((caddr_t)ip + iphlen);
 
+        qemu_log("udp input %u -> %u\n", (unsigned) ntohs(uh->uh_sport), (unsigned) ntohs(uh->uh_dport));
 	/*
 	 * Make mbuf data length reflect UDP length.
 	 * If not enough data to reflect UDP length, drop.

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-05-05 23:14                             ` Samuel Thibault
@ 2017-05-06  0:33                               ` FONNEMANN Mark
  2017-05-06  0:56                                 ` Samuel Thibault
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-05-06  0:33 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Stefan Weil, Thomas Huth, qemu-devel

>The attached patch should be dumping the same kind of information.

Nslookup does not produce any output in curses or in logfile (-D logfile.txt). I tried it using the version installed on the root system (Busybox 1.0):

root@qemu:~# nslookup
                    BusyBox v1.00 (2010.04.14-20:01+0000) multi-call binary

                    Usage: nslookup [HOST] [SERVER]
root@qemu:~# nslookup www.google.com
                    *** Unknown host

                    nslookup: www.google.com: Unknown host

 as well as the newer version installed in initrd image which is version 1.25.1:

root@qemu:~# /initrd/bin/nslookup
                    BusyBox v1.25.1 (2017-05-01 19:00:24 EDT) multi-call binary.

                    Usage: nslookup [HOST] [SERVER]

                    Query the nameserver for the IP address of the given HOST
                    optionally using a specified DNS server
root@qemu:~# /initrd/bin/nslookup www.google.com
                    Server:    10.0.2.3
                    Address 1: 10.0.2.3

                    nslookup: can't resolve 'www.google.com'

I know the patch was applied because when I ping 10.0.2.2 I get the following:

root@qemu:~# ping 10.0.2.2
                    PING 10.0.2.2 (10.0.2.2): 56 data bytes
                    64 bytes from 10.0.2.2: icmp_seq=0 ttl=255 time=0.5 ms
                    64 bytes from 10.0.2.2: icmp_seq=1 ttl=255 time=0.1 ms
                    64 bytes from 10.0.2.2: icmp_seq=2 ttl=255 time=0.1 ms
                    64 bytes from 10.0.2.2: icmp_seq=3 ttl=255 time=0.1 ms
                    64 bytes from 10.0.2.2: icmp_seq=4 ttl=255 time=0.2 ms

                    --- 10.0.2.2 ping statistics ---
                    5 packets transmitted, 5 packets received, 0% packet loss
                    round-trip min/avg/max = 0.1/0.2/0.5 ms

[mfonnemann@localhost qemu]$ cat logfile
ip input a00020f -> a000202 1
ip input a00020f -> a000202 1
ip input a00020f -> a000202 1
ip input a00020f -> a000202 1
ip input a00020f -> a000202 1

mark.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-05-06  0:33                               ` FONNEMANN Mark
@ 2017-05-06  0:56                                 ` Samuel Thibault
  2017-05-06  1:06                                   ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-05-06  0:56 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Stefan Weil, Thomas Huth, qemu-devel

FONNEMANN Mark, on sam. 06 mai 2017 00:33:40 +0000, wrote:
> >The attached patch should be dumping the same kind of information.
> 
> Nslookup does not produce any output in curses or in logfile (-D logfile.txt).

Uh.  So qemu can't be the culprit since it doesn't receive anything :)

> root@qemu:~# /initrd/bin/nslookup www.google.com
>                     Server:    10.0.2.3
>                     Address 1: 10.0.2.3
> 
>                     nslookup: can't resolve 'www.google.com'

So it's supposed to be using 10.0.2.3 I guess. Just to make sure, you
could try

/initrd/bin/nslookup www.google.com 10.0.2.3

> I know the patch was applied because when I ping 10.0.2.2 I get the following:
> 
> root@qemu:~# ping 10.0.2.2
>                     PING 10.0.2.2 (10.0.2.2): 56 data bytes
>                     64 bytes from 10.0.2.2: icmp_seq=0 ttl=255 time=0.5 ms
> [mfonnemann@localhost qemu]$ cat logfile
> ip input a00020f -> a000202 1
> ip input a00020f -> a000202 1

Do you get output when pinging 10.0.2.3?
(you won't get ping answers, but that's fine, qemu should still be able
to see the requests coming in)

Also, just to make sure: you don't have firewalling rules, do you?

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-05-06  0:56                                 ` Samuel Thibault
@ 2017-05-06  1:06                                   ` FONNEMANN Mark
  2017-05-06  1:17                                     ` Samuel Thibault
  0 siblings, 1 reply; 29+ messages in thread
From: FONNEMANN Mark @ 2017-05-06  1:06 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Stefan Weil, Thomas Huth, qemu-devel

>So it's supposed to be using 10.0.2.3 I guess. Just to make sure, you could try
>/initrd/bin/nslookup www.google.com 10.0.2.3

root@qemu:~# /initrd/bin/nslookup www.google.com 10.0.2.3
                    Server:    10.0.2.3
                    Address 1: 10.0.2.3

                    nslookup: can't resolve 'www.google.com'

>Do you get output when pinging 10.0.2.3?
>(you won't get ping answers, but that's fine, qemu should still be able to see the requests coming in)

root@qemu:~# ping 10.0.2.3
                    PING 10.0.2.3 (10.0.2.3): 56 data bytes

                    --- 10.0.2.3 ping statistics ---
                    9 packets transmitted, 0 packets received, 100% packet loss

[mfonnemann@localhost qemu]$ cat logfile
ip input a00020f -> a000203 1
ip input a00020f -> a000203 1
ip input a00020f -> a000203 1
ip input a00020f -> a000203 1
ip input a00020f -> a000203 1
ip input a00020f -> a000203 1
ip input a00020f -> a000203 1
ip input a00020f -> a000203 1
ip input a00020f -> a000203 1

>Also, just to make sure: you don't have firewalling rules, do you?

How can I verify this? (iptables is not installed on this guest Linux) 

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-05-06  1:06                                   ` FONNEMANN Mark
@ 2017-05-06  1:17                                     ` Samuel Thibault
       [not found]                                       ` <VI1PR0601MB2479B2228D4C769486ECAEC39CE80@VI1PR0601MB2479.eurprd06.prod.outlook.com>
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-05-06  1:17 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Stefan Weil, Thomas Huth, qemu-devel

FONNEMANN Mark, on sam. 06 mai 2017 01:06:31 +0000, wrote:
> root@qemu:~# /initrd/bin/nslookup www.google.com 10.0.2.3
>                     Server:    10.0.2.3
>                     Address 1: 10.0.2.3
> 
>                     nslookup: can't resolve 'www.google.com'

That's so weird there's no packet log. Does your guest perhaps have the
strace tool? Or perhaps you can manage to copy it over from another VM,
since it only depends on libc.

> >Do you get output when pinging 10.0.2.3?
> >(you won't get ping answers, but that's fine, qemu should still be able to see the requests coming in)
> 
> root@qemu:~# ping 10.0.2.3
>                     PING 10.0.2.3 (10.0.2.3): 56 data bytes
> 
>                     --- 10.0.2.3 ping statistics ---
>                     9 packets transmitted, 0 packets received, 100% packet loss
> 
> [mfonnemann@localhost qemu]$ cat logfile
> ip input a00020f -> a000203 1

Ok, so at least something gets through, even if not UDP 53.

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
       [not found]                                       ` <VI1PR0601MB2479B2228D4C769486ECAEC39CE80@VI1PR0601MB2479.eurprd06.prod.outlook.com>
@ 2017-05-06  9:23                                         ` Samuel Thibault
  2017-05-06 15:06                                           ` FONNEMANN Mark
  0 siblings, 1 reply; 29+ messages in thread
From: Samuel Thibault @ 2017-05-06  9:23 UTC (permalink / raw)
  To: FONNEMANN Mark; +Cc: Stefan Weil, Thomas Huth, qemu-devel

FONNEMANN Mark, on sam. 06 mai 2017 04:18:52 +0000, wrote:
> >That's so weird there's no packet log. Does your guest perhaps have the strace tool? Or perhaps you >can manage to copy it over from another VM, since it only depends on libc.
> 
> See attached file.

Ok, so for some reason it doesn't even try to emit a packet...

> open("/etc/resolv.conf", O_RDONLY)      = 3
> read(3, "nameserver 10.0.2.3\n\n", 4096) = 21

It does get the proper nameserver.

> connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)

It tries to connect to nscd but that's not running.

> open("/etc/nsswitch.conf", O_RDONLY)    = 3
> read(3, "hosts:      files\n", 4096)    = 18
> read(3, "", 4096)                       = 0

And I guess that's the culprit: in nsswitch.conf you only have
"hosts: files", so

> open("/lib/libnss_files.so.2", O_RDONLY) = 3
> open("/etc/hosts", O_RDONLY)            = 3
> read(3, "127.0.0.1\tlocalhost\n10.0.2.15\tqe"..., 4096) = 35

It only uses /etc/hosts.


So, in your /etc/nsswitch.conf, use

hosts: files dns

Samuel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-05-06  9:23                                         ` Samuel Thibault
@ 2017-05-06 15:06                                           ` FONNEMANN Mark
  0 siblings, 0 replies; 29+ messages in thread
From: FONNEMANN Mark @ 2017-05-06 15:06 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Stefan Weil, Thomas Huth, qemu-devel

>So, in your /etc/nsswitch.conf, use
>hosts: files dns

This resolved the problem. I am now able to do DNS queries using nslookup.
Thanks for all your help!

Mark.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP)
  2017-05-05 22:38                           ` FONNEMANN Mark
  2017-05-05 23:14                             ` Samuel Thibault
@ 2017-05-08  1:03                             ` Thomas Huth
  1 sibling, 0 replies; 29+ messages in thread
From: Thomas Huth @ 2017-05-08  1:03 UTC (permalink / raw)
  To: FONNEMANN Mark, Samuel Thibault
  Cc: Stefan Weil, qemu-devel, MCDONALD Margaret

On 06.05.2017 00:38, FONNEMANN Mark wrote:
>> Could you run tcpdump inside the guest so we are sure what the nslookup call emits?
> 
> Is there another way to determine this info? My guest OS is an embedded system with BusyBox 1.25 and not much else.

FWIW, QEMU also has a built-in packet-dump functionality. You can use it
like this:

qemu-system-xxx ... -netdev user,id=netuser \
   -object filter-dump,id=dump,netdev=netuser,file=/tmp/dump.dat \
   -device e1000,netdev=netuser,mac=00:11:22:33:44:55

Then run "wireshark -r /tmp/dump.dat" afterwards to have a look at the
packets.

 Thomas

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2017-05-08  1:03 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-13 20:17 [Qemu-devel] dns server not working in QEMU using usermode networking (SLIRP) FONNEMANN Mark
2017-04-24  8:00 ` Thomas Huth
2017-04-24 23:43   ` FONNEMANN Mark
2017-04-29 12:44     ` Samuel Thibault
2017-04-29 15:32       ` FONNEMANN Mark
2017-04-29 17:10         ` Samuel Thibault
2017-04-29 18:25           ` FONNEMANN Mark
2017-04-29 19:14             ` Samuel Thibault
2017-04-29 20:06               ` FONNEMANN Mark
2017-04-29 22:01                 ` Samuel Thibault
2017-04-29 23:15                   ` FONNEMANN Mark
2017-04-30  7:50                     ` Samuel Thibault
2017-04-30 12:42                       ` FONNEMANN Mark
2017-04-30 12:57                         ` Samuel Thibault
2017-05-05 22:38                           ` FONNEMANN Mark
2017-05-05 23:14                             ` Samuel Thibault
2017-05-06  0:33                               ` FONNEMANN Mark
2017-05-06  0:56                                 ` Samuel Thibault
2017-05-06  1:06                                   ` FONNEMANN Mark
2017-05-06  1:17                                     ` Samuel Thibault
     [not found]                                       ` <VI1PR0601MB2479B2228D4C769486ECAEC39CE80@VI1PR0601MB2479.eurprd06.prod.outlook.com>
2017-05-06  9:23                                         ` Samuel Thibault
2017-05-06 15:06                                           ` FONNEMANN Mark
2017-05-08  1:03                             ` Thomas Huth
  -- strict thread matches above, loose matches on Subject: below --
2017-04-15 23:27 FONNEMANN Mark
2017-04-16  8:09 ` Samuel Thibault
2017-04-16 22:10   ` FONNEMANN Mark
2017-04-21 19:58     ` Stefan Weil
2017-04-22 12:36       ` Samuel Thibault
2017-04-26 18:51       ` FONNEMANN Mark
     [not found] <VI1PR0601MB247952CA06D05D5041AA450D9C130@VI1PR0601MB2479.eurprd06.prod.outlook.com>

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.