OpenWrt Forum Archive

Topic: dnsmasq returns loopback address upon DNS query

The content of this topic has been archived on 10 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have recently upgraded the firmware on my Linksys WRT54GS to 8.09. I reconfigured dnsmasq to act as my network's DNS server, and edited /etc/hosts accordingly. However, a DNS query from my main PC for "Odin" (this being the name of the WRT itself) returns the IPv6 loopback address as well as the locally-routable addresses:

strake@Loki pts/1 ~ $ host odin
odin.mfd.net has address 192.168.1.1
odin.mfd.net has IPv6 address fdf0:6847:ca1:1:213:10ff:fe10:ab6b
odin.mfd.net has IPv6 address ::1
strake@Loki pts/1 ~ $

This puzzles me, for no IPv4 loopback address is returned. /etc/hosts follows:

### begin /etc/hosts
127.0.0.1     Odin localhost
192.168.1.1   Odin localhost
192.168.1.33  Thor
192.168.1.129 Loki
192.168.1.130 Baldr
192.168.1.5   crossroads

::1                                Odin localhost
FDF0:6847:CA1:1:213:10FF:FE10:AB6B Odin localhost
FDF0:6847:CA1:1:216:17FF:FE1B:A473 Loki
FDF0:6847:CA1:1:2E0:81FF:FE56:AAE8 Thor
### end /etc/hosts

Relevant portion of /etc/config/dhcp follows:

### begin /etc/config/dhcp
config dnsmasq
        option domainneeded     1
        option boguspriv        1
        option filterwin2k      '0'  #enable for dial on demand
        option localise_queries 1
        option local    '/mfd.net/'
        option domain   'mfd.net'
        option expandhosts      1
        option nonegcache       0
        option authoritative    1
        option readethers       1
        option leasefile        '/tmp/dhcp.leases'
        option resolvfile       '/tmp/resolv.conf.auto'
### end /etc/config/dhcp

Why does dnsmasq do this, and how can I prevent it?

I don't know why the IPv6 behavior is different from the IPv4 behavior.  But if you change this:

127.0.0.1     Odin localhost
192.168.1.1   Odin localhost
...
::1                                Odin localhost
FDF0:6847:CA1:1:213:10FF:FE10:AB6B Odin localhost

to this:

127.0.0.1     localhost
192.168.1.1   Odin
...
::1                                ipv6-localhost
FDF0:6847:CA1:1:213:10FF:FE10:AB6B Odin

I think you'll get the behavior you want.

The discussion might have continued from here.