resolv.conf — Resolver configuration
The glibc resolver reads /etc/resolv.conf for name server addresses, search domains and resolver options. ndots controls when a name is first tried as absolute; default is normally 1 in glibc. A search list can cause extra queries; fully qualified names with trailing dot avoid suffix search. Multiple name servers are generally tried according to resolver behavior, not a universal load balancing guarantee. This file may be a symlink or generated by systemd-resolved, NetworkManager, DHCP or another manager; edit the owning configuration rather than replacing the symlink. The last search directive supersedes earlier search lists in glibc. NSS order, application resolver and caches also matter. Inspect effective manager settings and getent results for authorized names; parsing a synthetic file does not validate DNS. Changes may be picked up by new resolver calls or cached; follow manager documentation. Restore previous owner-managed configuration and test resolution.
Formal Syntax & Structure
nameserver IP_ADDRESSsearch DOMAIN ...options ndots:N timeout:N attempts:NParameters & Attributes
| Name | Type | Description |
|---|---|---|
| nameserver | directive | DNS server address |
| search | directive | Search domain list |
| options | directive | Resolver options such as ndots |
Return Value
Resolver policy input, not a DNS response or reachability test.
Working Example
set -eud=$(mktemp -d)trap 'rm -rf -- "$d"' EXITprintf 'nameserver 192.0.2.53\nsearch lab.example\noptions ndots:2\n' > "$d/resolv.conf"awk '$1=="nameserver" || $1=="search" || $1=="options" {print}' "$d/resolv.conf"