Linux: Diagnose DNS with Dig and Resolvectl
The system resolver returns a stale record. Compare resolver state with a direct DNS query, flush caches, and verify. Work through it yourself in the live host terminal below.
Symptom
The system resolver returns a stale record. Compare resolver state with a direct DNS query, flush caches, and verify.
Your mission
Inspect, recover, then verify
Format
Linux shell
Investigate before you configure.
Use the CLI evidence to isolate the fault, make the smallest safe correction, then verify the network state changed.
Observe the symptom and link state.
Diagnose by comparing the protocol evidence.
Verify the expected device state and confirm the original symptom is resolved.
Console access: Linux
This workspace stacks for portrait phones. Rotate to landscape for the full split-screen console.
Need a hint?
Reveal the root cause when you're ready.
Try the investigation first, then use this as your escape hatch, not a dead end.
Lab debrief
Turn the session into a repeatable troubleshooting pattern.
Use this reference after your attempt: first explain the symptom, then verify the evidence, then confirm the repair.
The problem
`api.lab.example` resolves to 10.20.30.80 through the local resolver, while DNS server 10.20.30.53 returns 10.20.30.90.
What you'll practice
- Inspect per-link resolver state
- Query a specific DNS server with dig
- Use concise +short output
- Flush systemd-resolved caches
- Verify through the system resolver
The topology
One Ubuntu host uses systemd-resolved and upstream DNS server 10.20.30.53. The local cache contains an old A record.
Commands to run yourself
The real diagnostic commands for this lab, copy-paste ready. Run these in the same order to reproduce the investigation on your own session.
resolvectl statusresolvectl query api.lab.exampledig @10.20.30.53 api.lab.example A +shortTopology diagram
Fact-checked references
The commands and behaviour in this lab were checked against these primary references.
Frequently asked
Does dig always use the system resolver?
Not in this command. The @10.20.30.53 argument tells dig exactly which DNS server to query.
Does flushing change DNS server settings?
No. It clears cached answers while preserving per-link DNS configuration.
Ready to run this lab yourself?
No setup, no image sourcing. Book a session or ask for a live demo.