Strange DNS issue

with the latest releases (23.05.4-24.10.0) i am facing an issue with DNS.
My config is pretty basic and it consists of a WAN (dhcp client) and br-lan.
The system works fine for a few days and after a reboot it does not have dns, even though the upstream router serves dns through dhcp.
The solution is to add on the interface of br-lan, dns server as in the picture.

config:

root@OpenWrt:~# cat /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 'fdae:40e0:d0a9::/48'
        option packet_steering '1'

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

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

config interface 'wan'
        option device 'eth1'
        option proto 'dhcp'
        option metric '10'
        option peerdns '0'

root@OpenWrt:~#
root@OpenWrt:~# cat /etc/config/firewall

config defaults
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option synflood_protect '1'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        list network 'lan'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        list network 'wan'

config forwarding
        option src 'lan'
        option dest 'wan'
root@OpenWrt:~# cat /etc/resolv.conf
search lan
nameserver 127.0.0.1
nameserver ::1
root@OpenWrt:~#
root@OpenWrt:~# uci show network
network.loopback=interface
network.loopback.device='lo'
network.loopback.proto='static'
network.loopback.ipaddr='127.0.0.1'
network.loopback.netmask='255.0.0.0'
network.globals=globals
network.globals.ula_prefix='fdae:40e0:d0a9::/48'
network.globals.packet_steering='1'
network.@device[0]=device
network.@device[0].name='br-lan'
network.@device[0].type='bridge'
network.@device[0].ports='eth0'
network.lan=interface
network.lan.device='br-lan'
network.lan.proto='static'
network.lan.ipaddr='192.168.100.1'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.wan=interface
network.wan.device='eth1'
network.wan.proto='dhcp'
network.wan.metric='10'
network.wan.peerdns='0'
root@OpenWrt:~#

i see that there is not any DNS entries. How come it does not get it from the dhcp of the upstream router. Also how come it was working fine for days now, before the reboot?

Because you disabled that: option peerdns '0'

4 Likes

hope you know these don't affect the clients, and are usually left empty.

3 Likes
  • You usually add them to WAN
  • Also, the "Force Link" and "Use default gateway" appear to be changed from the default
1 Like

Using that field in the LAN is for local DNS services.
e.g Pi-hole.

My preferred way is to leave this blank and use option 6 that way the queries come from the client device and not the router IP

1 Like

To more easily match DNS requests to specific devices...

I'll ruminate on that.

can you show me a print screen of the settings in luci, please?

To get DNS served to your router do one (or both ) of the following:

  • Enable Peer DNS: Network > Interfaces > WAN > Advanced Setting:

  • On an Interface on the Advanced tab add Custom DNS server(s) just like you did on the LAN in your first Post.

It is customary to set the DNS servers on the interface which is "facing" the DNS server but it actually does not matter at all as all DNS servers end up in the same basket.

If you want have both the ISP DNS servers by enabling the Peer DNS you actually have to set custom DNS servers somewhere else as the Custom DNS server box is hidden on the WAN interface if you enable Peer DNS:

3 Likes

Network >> Lan (edit) >> DHCP Server >> Advanced >> DHCP options

Like I said above I use option 6 to tell all clients to use the DNS Servers directly and pihole will be be able to log the client IP's

In your picture using that setting will use your router as your DNS server and your pihole will only log your router as the client.

For anyone not using a local DNS server like me I believe you would be better off not using option 6 because doing that will bypass any benifit like cashing queries for later use, Most sites now a days have a TTL of 3 minutes or less so the benifit is minimal but still useful.

The OP does not mention he has a pihole or other DNS server on his LAN so why are you mentioning option 6?

I just reread the OP I don't know why I came up with pihole

No problem :slight_smile: