OK, so after some diagnosis, the problem is solved.
It was, as I rightly suspected, some config cruft. But in an unexpected place.
I upgraded the router from 23.05.5 to 24.10.1 using the auc
upgrade process, and after the reboot, I had the same problem - no DNS resolving going on, either on the router or on clients.
#nslookup www.openwrt.org 127.0.0.1
nslookup: write to '127.0.0.1': Connection refused
;; connection timed out; no servers could be reached
Specifying a server worked:
# nslookup www.openwrt.org 1.1.1.1
Server: 1.1.1.1
Address: 1.1.1.1:53
Non-authoritative answer:
www.openwrt.org canonical name = wiki-03.infra.openwrt.org
Name: wiki-03.infra.openwrt.org
Address: 64.226.122.113
Non-authoritative answer:
www.openwrt.org canonical name = wiki-03.infra.openwrt.org
Name: wiki-03.infra.openwrt.org
Address: 2a03:b0c0:3:d0::1a51:c001
I spent some time looking at DNS-related solutions and looking into the auto-generated resolv.conf file:
# cat /tmp/resolv.conf.d/resolv.conf.auto
# Interface wan
nameserver 1.1.1.1
nameserver 1.0.0.1
search <ISP's domain redacted>
I saw a suggestion to install the dnsmasq-full
package to add some possibly missing necessary functionality, so I tried that. Did not work.
Then I did what I should have done in the first place and grep
ped the output of logread looking for problems. I had already looked at the output of dmesg
and found nothing relevant.
# logread | grep dns
Wed May 7 11:40:25 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:40:25 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:40:30 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:40:30 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:40:35 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:40:35 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:40:40 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:40:40 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:40:45 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:40:45 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:40:50 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:40:50 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:40:50 2025 daemon.info procd: Instance dnsmasq::cfg01411c s in a crash loop 6 crashes, 0 seconds since last crash
Wed May 7 11:42:10 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:42:10 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:42:10 2025 daemon.info procd: Instance dnsmasq::cfg01411c s in a crash loop 7 crashes, 0 seconds since last crash
Wed May 7 11:42:15 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:42:15 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:42:15 2025 daemon.info procd: Instance dnsmasq::cfg01411c s in a crash loop 8 crashes, 0 seconds since last crash
Wed May 7 11:44:05 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:44:05 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:44:05 2025 daemon.info procd: Instance dnsmasq::cfg01411c s in a crash loop 9 crashes, 1 seconds since last crash
Wed May 7 11:49:34 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:49:34 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:49:39 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:49:39 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:49:44 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:49:44 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:49:49 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:49:49 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:49:54 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:49:54 2025 daemon.crit dnsmasq[1]: FAILED to start up
Wed May 7 11:49:59 2025 daemon.crit dnsmasq[1]: bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
Wed May 7 11:49:59 2025 daemon.crit dnsmasq[1]: FAILED to start up
Well, if dnsmasq has crashed, of course DNS name resolution is not going to be working. Doh!
So what is at line 31 of /var/etc/dnsmasq.conf.cfg01411c?
Busybox cat
does not have the -n
command switch, but head
does, but I get the other 30 lines as well, which could be useful for context. In large files, that is inconvenient, but you can see the last few lines of the output of head by using tail
.
# head -n 31 /var/etc/dnsmasq.conf.cfg01411c | tail -n 5
bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf
dhcp-range=set:lan,19,,255.255.255.0,12h
Another way of getting that range is to use sed
, which gives the same output:
sed -n '26,31p' /var/etc/dnsmasq.conf.cfg01411c
Now, I'm not familiar with the syntax of the dnsmasq.conf file, but it is telling me that something is going wrong with dhcp, not DNS. This is causing dnsmasq to fail, and a consequence of that is that DNS resolving doesn't happen, but the root cause is a problem with dhcp configuration.
The error message in the system log says:
bad dhcp-range at line 31 of /var/etc/dnsmasq.conf.cfg01411c
So somehow, this config file is defining a range incorrectly.
Now, my set up has a device downstream from the OpenWrt router that is at a static IP address. I don't want that address used for DHCP, so my (quite possibly incorrect) solution to that was to set up a static DHCP lease (defined in Luci-Network-DHCP and DNS-Static Leases) for that address at 192.168.x.y, which should prevent it from being given out from the general DHCP pool of addresses. That general pool is defined (for each interface) at Luci-Network-Interfaces-lan-Edit-DHCP Server-General Setup. Here you can specify the Start address for the pool, and how many addresses are in the pool.
Start
Lowest leased address as offset from the network address.
Limit
Maximum number of leased addresses.
The config I had was accepted by 23.05.5, but rejected by 24.10.1. Start was '100' and Limit was '150', giving the config line:
dhcp-range=set:lan,19,,255.255.255.0,12h
I've changed Start to 33 and Limit to 100, giving the following config line:
dhcp-range=set:lan,192.168.7.33,192.168.7.132,255.255.255.0,12h
This allows dnsmasq not to crash at startup, so also allowing DNS name resolution to happen, but I'll admit to not understanding completely what is going on here. Some self-education is necessary.
As far as I am concerned, I believe it is legitimate to want to have one or several devices at static IPs in a subnet, with some, or all of the rest of the IP addresses assigned to a DHCP pool that need not be contiguous. It looks like I don't understand how to do that correctly in OpenWrt.
So, it's not always DNS.