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: ~. lanI 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.
- Can I know which DNS the router is using from my laptop, without accessing the router config?
- 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.
21 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.8And 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.8Again 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