Dnsmasq creates "nameserver ::1" in /etc/resolv.cof --> ddns not working anymore

Hello,

since upgrading my x86 board (APU2) with a custom build image, the dyndns daemon is not working anymore.

The reason seems to be, that in the "/etc/resolv.conf" a wrong entry is added:

root@OpenWrt ~ # cat  /etc/resolv.conf 
search private
nameserver 127.0.0.1
nameserver ::1

The entry "nameserver ::1" is then used by the ddns daemon, as a parameter for nslookup and causes the following error:

 171357       : #> /usr/bin/nslookup my-url.com  >/var/run/ddns/strato.dat 2>/var/run/ddns/strato.err
 171357 ERROR : BusyBox nslookup error: '1'
 171357       : nslookup: bad address '::1'
 171357  WARN : Get registered/public IP for 'my-url.com' failed - retry 5/0 in 60 seconds

If I delete the entry, the ddns daemon works again.

But where does "nameserver ::1" actually come from?

Here is how the dnsmasq-part of my dhcp config looks like:


config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'private'
	option expandhosts '1'
	option allservers '1'
	option noping '0'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option localservice '0'
	option cachesize '8192'
	option cachelocal '1'
	list server '1.1.1.1'
	list server '1.0.0.1'
	list server '9.9.9.9'
	option nonwildcard '0'
	option logqueries '0'
	option confdir '/tmp/dnsmasq.d'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'

Any hints, how to stop dnsmasq from creating this entry?

Thanks in advance!

Some debug information:

root@OpenWrt ~ # opkg info dnsmasq
Package: dnsmasq
Version: 2.86-15
Depends: libc, libubus20220601
Status: install user installed
Architecture: x86_64
Conffiles:
 /etc/config/dhcp ddd520eb24451a892c9c666d83c10c9ea4fc944efbc34a149bc962c56bd8812f
 /etc/dnsmasq.conf 1e6ab19c1ae5e70d609ac7b6246541d52042e4dee1892f825266507ef52d7dfd
Installed-Time: 1666771178
root@OpenWrt ~ # cat /etc/os-release 
NAME="OpenWrt"
VERSION="SNAPSHOT"
ID="openwrt"
VERSION_ID="snapshot"
BUILD_ID="r21112-eb456aedfe"
OPENWRT_BOARD="x86/64"
OPENWRT_ARCH="x86_64"
OPENWRT_TAINTS="no-all busybox"
OPENWRT_RELEASE="OpenWrt SNAPSHOT r21112-eb456aedfe"
root@OpenWrt ~ # cat /proc/version 
Linux version 5.15.74 (openwrt@openWrt-buildhost-ssd) (x86_64-openwrt-linux-musl-gcc (OpenWrt GCC 11.3.0 r21112-eb456aedfe) 11.3.0, GNU ld (GNU Binutils) 2.37) #0 SMP Wed Oct 26 07:59:38 20

::1 is the IPv6 equivalent of 127.0.0.1 in IPv4 -- an address reserved for loopback connections within the local machine.
This entry is in any build it should not break anything.

By any chance have you taken any deliberate steps to try to disable local IPv6?

Thanks for your help @rhester72 & @mk24!

I don´t have that much experience with IPv6. And as I don´t need it in my LAN, I thought I can disable the feature when building the image:

So I think by enabling the option again the problem will be solved.
I will try and give you an update here.

But I wonder why dnsmasq is using IPv6, while the support is disabled?

I think the way you're disabling it isn't really disabling it.

If /proc/sys/net/ipv6 exists, dnsmasq will add the entry to /etc/resolv.conf.

I don't know how to fully disable IPv6 (at least such that it's not in the kernel, which appears to be the requirement) in OpenWRT, as I've never had the need.

You can configure ddns to use a specific nameserver when looking up the hostname.

Disabling IPv6 support at build time if not a supported configuration, don't do that (unless you really, really, really know what you're doing and are willing to fix up whatever comes your way - and even then, just don't).

1 Like

Thanks for your explanation, it´s now clear for me :slight_smile:

As expected, the problem was gone after re enabling IPv6.
Thanks all for the help!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.