Glossary

/etc/resolv.conf

/etc/resolv.conf configures the system's DNS resolver library—which nameservers to query, which domains to search for short hostnames, and various resolver options.

nameserver 1.1.1.1
nameserver 8.8.8.8
search example.com
options timeout:2 attempts:3

The nameserver lines list recursive resolvers, tried in order. The search line defines domains appended to unqualified names; ping host would try host, then host.example.com. Options tune behaviour like timeout, number of retries, and whether to rotate servers.

On modern systems, /etc/resolv.conf is often a symlink managed by something else: systemd-resolved points it at /run/systemd/resolve/stub-resolv.conf, NetworkManager maintains it directly or via resolvconf, and resolvconf aggregates multiple sources.

Edit the file directly only if you control the manager. On a systemd-resolved system, put nameserver configuration in /etc/systemd/resolved.conf or in NetworkManager's connection files. Running resolvectl status shows what the system actually thinks its DNS configuration is.

Related terms: DNS, /etc/hosts

Discussed in:

Also defined in: Textbook of Linux