Pcornel
Linux · DNS

/etc/resolv.conf

Cheat sheet · https://pcornel.dk/topic.php?topic=2789

Back to the Topic

Answer

/etc/resolv.conf lists the DNS servers (nameserver), search domains (search) and options (timeout, attempts, ndots) used by the resolver. It is often managed by systemd-resolved or NetworkManager.

Remember

Check whether it is a symlink (ls -l /etc/resolv.conf) — if managed, change DNS in NetworkManager, netplan or resolved instead. Only the first three nameservers are used.

First checks

  • resolvectl status — DNS servers per link (systemd-resolved)
  • cat /etc/resolv.conf — configured nameservers
  • getent hosts <name> — resolution through the system path (nsswitch)
  • dig <name> @<server> — query a specific server

Commands

resolvectl
nmcli connection modify ... ipv4.dns
resolvectl status

Verify in this order

tool writes resolv.conf → glibc reads nameservers, search and options → queries sent

Where it usually breaks

First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2789

Confirmation

Confirm action

Continue?