Router DNS issue with Adguard installed


I am new to OpenWrt so sorry if the anserw to this issue is trivial.

After intalling Adguard openwrt is unable to make DNS lookup requests. All clients on the network works perfectly.

I am running
OpenWrt 21.02.3 r16554-1d4dea6d4f / LuCI openwrt-21.02 branch git-22.083.69138-0a0ce2a
On a
Raspberry Pi 4 Model B Rev 1.1
With AdGuard installed using this guide.

After installing AdGuard openwrt is unable to ping It seems to be a DNS lookup error since i can ping the IP directly.

Uninstalling AdGuard resolves the issue.

My /etc/config/dhcp file contains:

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'
        list server ''

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '50'
        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,'
        list dhcp_option '3,'
        list dns 'fdbc:ffda:7c49::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'

My /etc/config/network file contains:

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr ''
        option netmask ''

config globals 'globals'
        option ula_prefix 'fdbc:ffda:7c49::/48'

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

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

config interface 'WAN'
        option proto 'dhcp'
        option device 'eth1'
        option peerdns '0'

How do I make openwrt able to make DNS requests while still making clients on the network go trough Adguard?

Thanks in advance.

1 Like

What are the DNS IPs for the RPi WAN port?

It's DHCP, so it should use whatever comes from the dhcp server, unless you changed it?

I do not believe I have changed any default setting.

My Settings for the WAN interface is:

Is this what you needed? Otherwhise I might need help on how to find it.

What's in /etc/resolve.conf?

There is a file called /etc/resolv.conf that contains:

search lan
nameserver ::1

If you add nameserver in there, it'll start to work, but it doesn't survive a reboot.

Router doesn't really need to know of any DNSes though.

Thanks that works!

But without the router being able to make DNS requests. I am unable to update packages?

Is there any way to make changes changes stick through a reboot?

Well, they should come from the dhcp, you need to check why it isn't working.

There should be a temporary file created with those entries.

You're not updating packages on a daily basis, so adding the resolv entry, when needed, isn't a big deal.

Thank you this is exactly the same issue as me (in fact so exact I'm on the same revision of the RPi as well). I can't seem to figure out why I'm not getting a DNS from DHCP but it still doesn't work even after setting custom dns. Wouldn't custom dns fix the issue?

Depends on where you set the custom DNS(es) ...?

In the first post there is a WAN Dns script that will set your WAN to ignore upstream DHCP DNS settings and force set your own. That will at least ensure your router can do DNS properly.

However that doesn't solve why your router fails to get dns after installing AGH.

Your clients obviously are getting the dhcp dns option 6 address for AGH. Your router should still be using its WAN DHCP supplied dns.

Nevermind. I just spotted this.

peerdns to zero means it will IGNORE upstream DNS settings. Either change it back to 1 or set your own with the dns script.

I set it under the settings of the WAN interface.

Thank you but yeah I dont know why it does that and it seems to happen to others as well.

Also ive tried with both peer dns enabled or custom dns set under WAN interface settings.