Can we set up a DNS server to override the Router DNS server?

I am aware that when we type a domain name, unless it is cached in the pc or router, it requests the DNS to an external server, to get the IP address.

Apparently, the DHCP server from the router is setting itself for DNS (192.168.1.254). Issuing systemd-resolv --status or resolverctl status gives

Link 3 (wlp1s0) Current Scopes: DNS
DefaultRoute setting: yes LLMNR setting: yes
MulticastDNS setting: no DNSOverTLS setting: no DNSSEC setting: no DNSSEC supported: no Current DNS Server: 192.168.1.254 DNS Servers: 192.168.1.254 DNS Domain: ~. lan

I didn't set up the router and have no access to it, so I'd like to be sure my locally defined DNS is used.

  1. Can I know which DNS the router is using from my laptop, without accessing the router config?
  2. How can I set up a local DNS to be google dns 8.8.8.8 or some you recommend?

I took a look at Ubuntu docs but seems complicated.

2

1 Answer

For-all-interfaces DNS server can be set in /etc/resolv.conf to test, as it is wiped out at reboot.

I just added

nameserver 8.8.8.8

And then confirm using resolvectl status, which has now a global setting pointing to that DNS server.

According to the resolvectl, resolvconf, systemd-resolve etc (they are mostly the same), we can set up per interface DNS, for example:

resolvectl dns wlp1s0 8.8.8.8

Again the config is updated, you can see both in this log:

Global Current DNS Server: 8.8.8.8 DNS Servers: 8.8.8.8 DNS Domain: lan
Link 3 (wlp1s0) Current Scopes: DNS DNS Servers: 8.8.8.8 DNS Domain: ~. lan

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like