Global DNS definition

Hi all, I have 4 interfaces:

  • Guest (custom)
  • LAN (default)
  • WAN (default)
  • WAN6 (default)

In each of them I can define custom DNS servers. Should I do that? Or is there a place where I can define it globally?

Thanks in advance!

In the dhcp settings?

yes you can define by interface. do you want different upstream dns targets per interface?
if you don't default will be used which is the one received over wan.
if you need one "global" dns upstream and default one is acceptable (i.e. what your ISP provides) you don't need to do anything.
if you want global non-default check https://openwrt.org/docs/guide-user/base-system/dhcp option server.

1 Like

Do DHCP settings override the defined DNS servers in the interface? Or it's used only when an interface has no defined DNS server?

I want to define a non-default DNS server for all interfaces. Can I set it up using the web interface? Should I remove the defined DNS servers in the interfaces? Or does the server option overrides other settings?

For the clients, they do, unless you intercept the DNS calls in the firewall.

what you do in luci (=web interface) is translated to so called uci commands which are stored in /etc/config/* files. i linked the dhcp configuration guide which describes what can be set for dns and dhcp wise. because in owrt these two different services are provided via the same backend called dnsmasq you'll see the various options under the same guide and under the same, corresponding /etc/config/dhcp file.

usually you want to provide services for your clients, right, you don't usually do stuff on the router itself, i.e. you don't web browsing on the router itself, so you must rather provide configuration for your clients. therefore the easiest is to use DHCP to allocate/assign IP addresses, tell clients the default gateway etc, and if you want specify DNS upstream too.

this can be done either via option server (which is part of DNS functionality) or you can specify dhcp option 6 (which is part of DHCP service). both explained in the linked guide.

Note that all DNS server entries from all interfaces are pooled together into one system wide resolver list. There is no per-interface "DNS routing" by default.

By convention, you usually should set DNS servers on your upstream (wan/wan6) interfaces only.

1 Like

great point, thanks for the addition!

@grrr2 @jow @frollic thank you guys very much!

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