Back to Learning
Linux · NetworkingBeginner

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.

Interactive simLinuxDNSdigresolvectl

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

Linux: Diagnose DNS with Dig and Resolvectl

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.

Locked

Sign up with your email to open Linux: Diagnose DNS with Dig and Resolvectl, free. You get the root cause and the full step-by-step fix.

No spam. The fix lands in your inbox too. Signing up includes 4 guided labs free, tracked against your email. After that, the Learning Pass unlocks every remaining lab.

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.

Inspect resolver state
resolvectl status
Query through the system resolver
resolvectl query api.lab.example
Query the DNS server directly
dig @10.20.30.53 api.lab.example A +short

Topology 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.