Dnsmasq, AGH and dhcp server not sending dns server

I'm running Openwrt 23.05.4 on NanoPi R4S and had some problem with ipv4-only clients (Poolrobot, Denon Amplifier, ...).
These devices get an ip address from the Openwrt dhcp server (dnsmasq) but they don't get the dns server from dhcp.
Dual-stack (ipv4+ipv6) devices would get an ipv6 dns server from dhcp, so they were working.

I got it working by adding "list dhcp_option '6,192.168.0.1'" to /etc/config/dhcp.

/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'
        option cachesize '1000'
        option rebind_protection '0'
        option port '54'
        option dnsforwardmax '1024'

config dhcp 'lan'
        option interface 'lan'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        option start '50'
        option limit '200'
        option leasetime '24h'
        list dhcp_option '6,192.168.0.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'

/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 'fdb2:8a25:e071::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth1'

config device
        option name 'eth1'
        option macaddr '82:34:28:38:f0:46'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.0.1'

config device
        option name 'eth0'
        option macaddr '80:34:28:38:f0:46'

config interface 'wan'
        option device 'eth0'
        option proto 'dhcp'
        option peerdns '0'
        list dns '1.1.1.1'
        list dns '1.0.0.1'

config interface 'wan6'
        option device 'eth0'
        option proto 'dhcpv6'
        option peerdns '0'
        list dns '2606:4700:4700::1111'
        list dns '2606:4700:4700::1001'
        option reqaddress 'try'
        option reqprefix 'auto'

config device
        option name 'tun0'

I also have AdGuard Home installed (as dns server). I'm not sure if it's related, but others have a similar problem: https://forum.openwrt.org/t/after-installing-adguard-home-dhcp-server-doesnt-send-a-dns-server-to-vlans/208829

Any idea what's going on?

The thread you linked was exactly where I was going to point you. Specifically, look at the last post where the OP said they found a solution. Try that and see if it fixes things for you.

maybe I should rephrase my question:
I found the solution by adding "list dhcp_option '6,192.168.0.1'".

According to the docs of Openwrt, dnsmasq should announce its own ip addresses as gateway and dns server via dhcp. But it doesn't.
I have to explicit add dhcp option 6.

It must have something to do with the installation of AGH, but I don't see what.

Yes, that was my conclusion, too. It shouldn’t be necessary to self reference option 6, but something with agh ends up causing the standard behavior to change. I don’t know what the underlying reason is, though, and I don’t use agh myself so I’m unable to dive deeper into debugging.

All that said, the op of the other tread had the same experience, so it is clearly something with agh.

Setting a non default listen port for DNSMasq probably results in not sending the routers address as DNS server, which kind of makes sense as the client will query port 53 and DNSmasq is not there.

What is it with people flocking to AGH, consider using a simple adblocker and HTTPS-DNS-proxy :wink:

2 Likes

I think this is the code logic to support your assertion:

https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=src/rfc2131.c;h=68834ea503ff7610c10bd27673e1bf9773ca463c;hb=550c368adea12b312f83686c61f9015c122046c2#l2576

1 Like

It does indeed:
https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=src/dns-protocol.h;h=2777be93dbb0b1c2c022df18f88328c6c7db9804;hb=refs/heads/master#l17

1 Like

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