DNS in network.wan.dns or in network.lan.dns?

Hello,
I have an EdgeRouter X with OpenWrt 18.06.5.
Router WAN port is connected with static IP to my ISP gateway in DMZ and LAN ports to my LAN stuffs.

Current config:
uci show network.lan
network.lan=interface
network.lan.type='bridge'
network.lan.ifname='eth0.1'
network.lan.proto='static'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.lan.ipaddr='10.0.0.1'

uci show network.wan
network.wan=interface
network.wan.ifname='eth0.2'
network.wan.proto='static'
network.wan.ipaddr='192.168.1.1'
network.wan.netmask='255.255.255.0'
network.wan.gateway='192.168.1.100'
network.wan.dns='1.1.1.1 1.0.0.1'

I have configured the DNS under WAN interface and everithing work fine.
Should I add also network.lan.dns='1.1.1.1 1.0.0.1'?
What is the difference having the DNS under lan section only, under wan section only or under both interfaces?

I have a pppoe based WAN connection and DNS in WAN settings. I think it should work this way. But you can also try DNS hijack in documentation.

It is the DNS to be used by the router, and should be configured on the interface where it can be reached.

3 Likes

The linux systems use /etc/resolv.conf to specify nameservers and options.
In the case of OpenWrt, it is symbolic link to /tmp

root@koutsomoura:~# ls -la /etc/resolv.conf 
lrwxrwxrwx    1 root     root            16 Jun 27 14:18 /etc/resolv.conf -> /tmp/resolv.conf

In /tmp however there are a few resolv.* files. Do a head -n -0 /tmp/resolv.* to check them all.
In a nutshell /tmp/resolv.conf will be using 127.0.0.1 as nameserver, that means the local dnsmasq, and there is also an option for search domain. (default is lan)
/tmp/resolv.conf.INTERFACE will contain the NS that you configured or were automatically acquired (from ppp or dhcp)
/tmp/resolv.conf.auto contains a collection of the available NS from all the interfaces (if enabled) and is by default used by dnsmasq for resolving.