DNS-Diagnose mit dig und nslookup
Diagnostizieren Sie Probleme bei der Namensauflösung unter Linux mit dig, nslookup und host. Untersuchen Sie DNS-Einträge, verfolgen Sie Auflösungspfade und erkennen Sie Fehlkonfigurationen.
DNS-Diagnose mit dig und nslookup ist eine kostenlose Linux Networking & TCP/IP for Developers-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Linux Networking & TCP/IP for Developers-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Linux Networking & TCP/IP for Developers-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Why DNS Diagnostics Matter
Many 'network is down' reports are really DNS failures. The host is reachable by IP, but the name will not resolve.
Linux ships tools to inspect resolution directly:
dig— flexible, scriptable lookupsnslookup— classic interactive toolhost— quick one-line answers
This lesson focuses on reading their output to find the real problem.
A Basic dig Query
Run dig followed by a hostname to fetch its A record.
The key part of the output is the ANSWER SECTION, which lists the resolved addresses and their TTL.
dig example.comReading the dig Answer Section
Each answer line shows: name TTL class type value.
- TTL — seconds the record may be cached
- type — A, AAAA, MX, CNAME, etc.
- value — the resolved data
Use +short to strip everything except the value.
dig +short example.comQuerying Specific Record Types
Append the record type to look up anything besides an A record.
dig example.com MX— mail serversdig example.com AAAA— IPv6dig example.com TXT— text records (SPF, verification)
dig example.com MXChoosing a Specific Resolver
Use @server to bypass your local resolver and ask a specific DNS server. This isolates whether your local cache is the problem.
Below queries Google Public DNS directly.
dig @8.8.8.8 example.comTracing the Resolution Path
dig +trace walks from the root servers down to the authoritative server, printing each delegation step.
This reveals broken delegations or stale glue records that a normal query hides.
dig +trace example.comReverse DNS Lookups
To map an IP back to a name, use -x. This queries the PTR record.
Missing PTR records often cause mail delivery and logging issues.
dig -x 8.8.8.8Using nslookup Interactively
nslookup can run one-shot or interactively. In interactive mode you set type= and switch servers with server.
nslookup -type=MX example.comQuick Answers with host
host gives compact output, ideal for quick checks.
host example.com— A and AAAAhost -t NS example.com— nameservers
host -t NS example.comInterpreting Status Codes
The status field in the dig header is critical:
- NOERROR — resolved fine
- NXDOMAIN — name does not exist
- SERVFAIL — server failed (often DNSSEC or upstream issues)
Checking the Local Resolver Config
Linux resolution settings live in /etc/resolv.conf and /etc/nsswitch.conf.
If dig works but applications fail, suspect nsswitch.conf ordering or a stale resolv.conf.
cat /etc/resolv.confQuick Check
Test your understanding of dig output.
Recap
You now diagnose DNS issues directly:
digfor flexible, scriptable lookups and+trace@serverto isolate resolver problems-xfor reverse lookups- Read status codes (NOERROR/NXDOMAIN/SERVFAIL)
- Check
/etc/resolv.confandnsswitch.conffor local issues
These skills complement packet capture and firewall analysis for end-to-end troubleshooting.
Häufig gestellte Fragen
Ist die Lektion „DNS-Diagnose mit dig und nslookup“ kostenlos?
Ja — der vollständige Text von „DNS-Diagnose mit dig und nslookup“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Linux Networking & TCP/IP for Developers-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Linux Networking & TCP/IP for Developers-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „DNS-Diagnose mit dig und nslookup“?
Diagnostizieren Sie Probleme bei der Namensauflösung unter Linux mit dig, nslookup und host. Untersuchen Sie DNS-Einträge, verfolgen Sie Auflösungspfade und erkennen Sie Fehlkonfigurationen. Du übst Linux Networking & TCP/IP for Developers mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Linux Networking & TCP/IP for Developers zu starten?
Keine Vorkenntnisse erforderlich. Linux Networking & TCP/IP for Developers auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „DNS-Diagnose mit dig und nslookup“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Linux Networking & TCP/IP for Developers-Lektion Code schreiben und ausführen?
Ja. Jede Linux Networking & TCP/IP for Developers-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Paketerfassung mit Wireshark/tcpdump
- Werkzeuge zur Netzwerkleistung
- Linux-Firewall (Netfilter/iptables)
- DNS-Diagnose mit dig und nslookup