Use DNS servers advertised by peer

Dear community,

I configured "Use DNS servers advertised by peer" on the WAN interface, but my router still uses the localhost for name resolution:

root@OpenWrt:/etc/config# nslookup google.com
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:      google.com
Address 1: 172.217.16.110
Address 2: 2a00:1450:400d:808::200e

It seems dnsmasq is using the resolv.conf file, which contains:

search local
nameserver 127.0.0.1
nameserver ::1

This is my dhcp config file:

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option expandhosts '1'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option ednspacket_max '1232'
        list server '192.168.0.2'
        list server 'fe80::ba27:ebff:fe20:51a3'
        option rebind_protection '0'
        option sequential_ip '1'
        option localservice '0'
        option filterwin2k '1'
        option strictorder '1'
        option allservers '1'
        option local '/local/'
        option domain 'local'

config dhcp 'lan'
        option interface 'lan'
        option dhcpv6 'server'
        option dhcpv4 'server'
        option leasetime '24h'
        option limit '240'
        list dhcp_option '6,192.168.0.2'
        list dhcp_option '15,local'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        option ra_management '1'
        option ra_default '1'
        list dns '192.168.0.2'
        list dns 'fe80::ba27:ebff:fe20:51a3'
        option start '11'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'
        list dns '192.168.0.2'
        list dns 'fe80::ba27:ebff:fe20:51a3'

config odhcpd 'odhcpd'
        option maindhcp '1'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

I set my local DNS servers in list server and list dns commands. How could I force using my configured DNS servers?

Thanks

Check the output:

head -v -n -0 /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/*
2 Likes

resolv.conf is used by the device itself.

Here you'll find the nameservers you have configured for upstream.

2 Likes

This is normal: "nslookup" asks the local "dnsmasq", which should ask the upstream nameservers.

To be sure, enable logging on "dnsmasq" and watch the queries on the log.

3 Likes