Hi,
I have a problem where OpenWRT itself loses DNS so that it cannot resolve addresses, but the clients can.
I'm running x86 OpenWRT 22.03.5 as a router.
I have installed AdGuard Home on it.
OpenWRT -> Network -> Diagnostics:
nslookup: write to '127.0.0.1': Connection refused
nslookup: write to '::1': Connection refused
ping: bad address 'openwrt.org'
Pinging an IP works fine, so it points to a DNS issue.
AdGuard handles DNS at port 53, and I've changed dnsmasq to port 5330.
(I'm not well-versed in this network and dnsmasq jungle so I don't necessarily understand the connections between eveything or use the correct terms.)
(Edit: scratch below noresolv 0 or 1 discovery, seems like noresolv wasn't the setting anymore, OpenWRT itself is still unable to resolve DNS even after changing noresolv back to 1 now and I'm not sure how to get it back to working)
Whenver I set dnsmasq's noresolv to 0 (Ignore resolv file), as the AdGuard Home guide below guides to do, that's when OpenWRT router stops resolving DNS for itself.
If I set noresolv back to 1, OpenWRT can resolve again. But that causes issues with AdGuard Home.
What I'm trying to achieve is to set OpenWRT to answer to private .lan and .arpa addresses. That doesn't work as long as noresolv is 1, which seems to cause some kind of DNS loop and tons of entries to the logs, and timeout error messages in OpenWRT's system logs.
I have followed the AdGuard Home guide from here using opkg:
And I have also tried installing it using the curl script directly from AdGuard's github.
I've tried with custom DNS on wan interface, and I've tried with DNS servers advertised by peer, but that makes no difference. Something prevents the router accessing those wan DNS servers all the same, and I don't understand why.
I can't find a setting from LuCI that would prevent or let the router use those wan DNS servers. It's probably something simple, but the reasons escape me. It's like the last piece of the puzzle is missing.
Anyone wiser mind telling me where I'm going wrong or how to make both the router and AdGuard happy?
Possibly relevant configs below:
/etc/config/dhcp
config dnsmasq
option domainneeded '1'
option localise_queries '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option localservice '1'
option ednspacket_max '1232'
list server '192.168.2.1'
option rebind_protection '0'
option port '5330'
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv4 'server'
option dhcpv6 'server'
option ra 'server'
list ra_flags 'managed-config'
list ra_flags 'other-config'
list dhcp_option '6,192.168.2.1'
list dhcp_option '3,192.168.2.1'
config dhcp 'wan'
option interface 'wan'
option ignore '1'
config odhcpd 'odhcpd'
option maindhcp '0'
option leasefile '/tmp/hosts/odhcpd'
option leasetrigger '/usr/sbin/odhcpd-update'
option loglevel '4'
config host
option name 'x'
option dns '1'
option ip '192.168.2.22'
/etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'removed'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth1'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option netmask '255.255.255.0'
option ip6assign '60'
option ipaddr '192.168.2.1'
config interface 'wan'
option device 'eth0'
option proto 'dhcp'
option peerdns '0'
list dns '9.9.9.9'
list dns '1.1.1.1'
config interface 'wan6'
option device 'eth0'
option proto 'dhcpv6'
config interface 'guestwifi'
option proto 'static'
option ipaddr '192.168.100.1'
option netmask '255.255.255.0'
list dns '9.9.9.9'
Maybe the issue is in /etc/resolv.conf that it's missing the WAN IPs? If so, I don't properly understand why it would miss them and what's the way to add them:
search lan
nameserver 127.0.0.1
nameserver ::1
Just in case the settings from AdGuard Home:
Upstream DNS servers:
https://dns.quad9.net/dns-query
[/lan/]127.0.0.1:5330
[//]127.0.0.1:5330
[/in-addr.arpa/]127.0.0.1:5330
[/ip6.arpa/]127.0.0.1:5330
(I've tried to play between 192.168.2.1:5330 and 127.0.0.1:5330, but it doesn't seem to make a difference either)
Private reverse DNS servers
192.168.2.1:5330
Use private reverse DNS resolvers: ticked
Enable reverse resolving of clients' IP addresses: ticked