Use it to see or set which DNS servers a host uses, or when manual edits are overwritten.
/etc/resolv.conf
/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.
1. ls -l /etc/resolv.conf — symlink to the stub or a real file?
2. Managed → configure DNS in the managing tool.
3. nameserver lines correct and reachable?
4. search domains as intended?
5. Test with getent hosts <short-name>.
tool writes resolv.conf → glibc reads nameservers, search and options → queries sent
For DNS → /etc/resolv.conf, continue with the first unproven Topic check: Resolve the /etc/resolv.conf symlink and record file contents, inode/target and modification source before editing. If that boundary is healthy, advance to the adjacent check: Identify whether NetworkManager, systemd-resolved, DHCP, netplan or another manager owns effective DNS configuration. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
authoritative network/DNS config → manager/DHCP/VPN input → generated resolv.conf or stub symlink → libc resolver/stub → upstream DNS selection → answer → application
Healthy evidence: the file or symlink matches its intended manager model, nameserver/search/options align with runtime resolver state, and the application resolves through that path.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Resolve the /etc/resolv.conf symlink and record file contents, inode/target and modification source before editing.
- Identify whether NetworkManager, systemd-resolved, DHCP, netplan or another manager owns effective DNS configuration.
- Correlate nameserver/search/options with runtime resolver state and test the exact name through the original application path.
- Apply persistent changes at the owner source, regenerate/reload safely, then verify both file/runtime state and the original lookup after reboot/reconnect risk where relevant.
Verification chain. authoritative network/DNS config → manager/DHCP/VPN input → generated resolv.conf or stub symlink → libc resolver/stub → upstream DNS selection → answer → application
Step 3 Commands Verify boundary
cat /etc/resolv.conf
ls -l /etc/resolv.conf
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: manual edits are overwritten, a stale static file conflicts with manager state, a stub address is mistaken for upstream DNS, or the file looks correct while split-DNS runtime routing differs.
resolv.conf is verified only when its ownership and generated/runtime meaning are known and the original resolver path uses the intended effective policy; file contents alone are not evidence.
Step 5 Common mistakes Narrow the fault
- Editing a symlinked, managed file by hand.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
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.
resolvectl status— DNS servers per link (systemd-resolved)cat /etc/resolv.conf— configured nameserversgetent hosts <name>— resolution through the system path (nsswitch)dig <name> @<server>— query a specific server
ReferenceWhat it is1 section · depth on demand
Core model
Inspect the file and its chain of components together. Resolve symlinks, identify the generating service, distinguish stub addresses from upstream DNS servers, and compare the file with manager/runtime state. Make persistent changes at the responsible configuration layer instead of editing a generated artifact that will be overwritten.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
resolv.conf is verified only when its ownership and generated/runtime meaning are known and the original resolver path uses the intended effective policy; file contents alone are not evidence.
In depth
/etc/resolv.conf: who writes it, and what it should contain
/etc/resolv.conf configures the C library's stub resolver. The resolv.conf(5) manual page describes its directives:
nameserver: up to three.search: domains for short names. Only the last search line counts, and since glibc 2.26 it has no length limit.domain: an obsolete single-entry form of search.options, such asndots:n,timeout:n,attempts:n,rotate,edns0,single-requestandtrust-ad.
On most systems, the file isn't edited by hand. A network manager writes it, or it's a symlink to a file generated by systemd-resolved.
Who manages the file
ls -l /etc/resolv.conf shows | Managed by | Change DNS via |
|---|---|---|
Symlink to /run/systemd/resolve/stub-resolv.conf | systemd-resolved | networkd, NetworkManager, netplan, resolvectl |
Symlink to /run/NetworkManager/resolv.conf | NetworkManager | nmcli connection modify ... ipv4.dns |
| A regular file with "Generated by NetworkManager" | NetworkManager | nmcli |
| A regular file, no comment | Possibly static, or a DHCP client | Edit, or the DHCP client configuration |
Options and when to use them
| Option | Use |
|---|---|
timeout:1 attempts:2 | Faster failover when a server is down |
rotate | Spread load over several resolvers |
single-request | Work around firewalls that drop parallel A/AAAA queries |
edns0 | Larger UDP responses (needed for DNSSEC) |
trust-ad | Trust the AD (authenticated data) bit from a validating resolver |
Making manual changes stick
Hand edits to a managed file are overwritten at the next DHCP renewal or network change. Put the setting in the managing tool instead. For a truly static file, disable the manager's control of DNS first.
host$ ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Apr 22 2026 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
host$ grep -v '^#' /etc/resolv.conf
nameserver 127.0.0.53
options edns0 trust-ad
search example.net
host$ cat /run/systemd/resolve/resolv.conf | grep nameserver
nameserver 10.20.0.53
nameserver 10.20.0.54
host$ sudo nmcli connection modify office-lan ipv4.dns "10.20.0.53 10.20.0.54" ipv4.dns-search example.net
host$ sudo nmcli connection up office-lan
host$ head -2 /etc/resolv.conf
127.0.0.53 isn't a misconfiguration
When systemd-resolved manages the file, the only nameserver is 127.0.0.53, the local stub. The real upstream servers are listed in /run/systemd/resolve/resolv.conf, and by resolvectl status.
Documented example, not captured output.
How it works at runtime
/etc/resolv.conf is part of DNS → /etc/resolv.conf. /etc/resolv.conf defines traditional resolver inputs such as nameserver, search/domain and resolver options, but on modern Linux it may be generated or symlinked by NetworkManager, systemd-resolved, DHCP or another manager rather than being the authoritative configuration source.
Topic-specific state model. /etc/resolv.conf defines traditional resolver inputs such as nameserver, search/domain and resolver options, but on modern Linux it may be generated or symlinked by NetworkManager, systemd-resolved, DHCP or another manager rather than being the authoritative configuration source.
Technical metadata. Host/VM and network namespace, distribution/kernel/libc/systemd-resolved/network-manager versions, interface/source address, resolver API/NSS order, /etc/resolv.conf ownership, per-link DNS servers/domains, query name/type/RCODE/TTL/view, destination address/protocol/port, route/rule/neighbor, firewall/MTU, socket state, capture interface/filter/time, packet direction/flags/errors and original application result.
Interpretation rule. - Editing /etc/resolv.conf ≠ persistent DNS configuration when another service generates it.
- 127.0.0.53 in resolv.conf ≠ upstream DNS server; it normally points at the local systemd-resolved stub.
- Correct nameserver lines ≠ correct split-DNS routing or per-link DNS state.
- Readable resolv.conf ≠ application uses it; some runtimes/containers/VPN clients use alternate resolver mechanisms.
Quick reference
/etc/resolv.conf options:
nameserver 10.0.0.53
nameserver 10.0.0.54
search corp.example.com example.com
options timeout:2 attempts:2 rotate edns0 ndots:1
Max three nameservers. ndots decides when search domains are tried first (Kubernetes uses ndots:5, causing many extra queries). The file is often generated: ls -l /etc/resolv.conf shows whether it points to systemd-resolved's stub (/run/systemd/resolve/stub-resolv.conf), NetworkManager or cloud-init — edit the source, not the file.
Limits and how it fails
Primary failure point. resolv.conf is verified only when its ownership and generated/runtime meaning are known and the original resolver path uses the intended effective policy; file contents alone are not evidence.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. /etc/resolv.conf owns Linux resolver-file semantics and ownership detection. NetworkManager/Netplan/systemd-networkd own network configuration; systemd-resolved owns stub/per-link resolver state.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in DNS → /etc/resolv.conf. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.freedesktop.org/software/systemd/man/latest/systemd-resolved.service.html · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
/etc/resolv.conf operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for /etc/resolv.conf.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | /etc/resolv.conf defines traditional resolver inputs such as nameserver, search/domain and resolver options, but on modern Linux it may be generated or symlinked by NetworkManager, systemd-resolved, DHCP or another manager rather than being the authoritative configuration source. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin exact host/namespace + original name or endpoint → capture link/address/route/resolver state → reproduce original failure → localize first failed resolver/network boundary → collect bounded packet/socket or DNS evidence → change one demonstrated cause → read back effective state → repeat original application transaction and an adjacent regression check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | authoritative network/DNS config → manager/DHCP/VPN input → generated resolv.conf or stub symlink → libc resolver/stub → upstream DNS selection → answer → application | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | resolv.conf is verified only when its ownership and generated/runtime meaning are known and the original resolver path uses the intended effective policy; file contents alone are not proof. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux DNS/network evidence can establish this proof path: authoritative network/DNS config → manager/DHCP/VPN input → generated resolv.conf or stub symlink → libc resolver/stub → upstream DNS selection → answer → application | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured host/network namespace, resolver path or DNS view, interface/source, destination/protocol/port, capture point, time or workload scope. resolv.conf is verified only when its ownership and generated/runtime meaning are known and the original resolver path uses the intended effective policy; file contents alone are not proof. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven DNS/network boundary: preserve the original source and failure conditions, capture the adjacent resolver/socket/packet state, change only the demonstrated cause, then repeat the original application lookup or transaction and adjacent regression checks. | Continue to the next unresolved boundary while preserving the original test condition. |
/etc/resolv.conf · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | /etc/resolv.conf |
|---|---|
| Topic path | DNS → /etc/resolv.conf |
| Runtime state | /etc/resolv.conf defines traditional resolver inputs such as nameserver, search/domain and resolver options, but on modern Linux it may be generated or symlinked by NetworkManager, systemd-resolved, DHCP or another manager rather than being the authoritative configuration source. |
| Fast checks | - Resolve the /etc/resolv.conf symlink and record file contents, inode/target and modification source before editing. - Identify whether NetworkManager, systemd-resolved, DHCP, netplan or another manager owns effective DNS configuration. - Correlate nameserver/search/options with runtime resolver state and test the exact name through the original application path. - Apply persistent changes at the owner source, regenerate/reload safely, then verify both file/runtime state and the original lookup after reboot/reconnect risk where relevant. |
| Verification chain | authoritative network/DNS config → manager/DHCP/VPN input → generated resolv.conf or stub symlink → libc resolver/stub → upstream DNS selection → answer → application Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | resolv.conf is verified only when its ownership and generated/runtime meaning are known and the original resolver path uses the intended effective policy; file contents alone are not proof. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |