How to see which DNS server is used
How to see which DNS server is used on Linux?
When the Linux system is using systemd, use the resolvectl command to see the active DNS server. Otherwise, have a look in /etc/resolv.conf.
resolvectlSystems using systemd have the resolvectl command to show the configured DNS servers. It also show the server that is currently active.
Show active DNS configuration
Run the resolvectl command without any options to see the status. The configured DNS servers will be displayed, including the one that is currently being used.
# resolvectl
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (ens18)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.1.10
DNS Servers: 192.168.1.10 192.168.1.11
DNS Domain: internal.example.com
Not using systemd?
When systemd is not being used, then typically the first DNS server configured in the file /etc/resolv.conf is used for processing the DNS requests.