0Pricing
Linux Networking & TCP/IP for Developers · Lezione

Diagnostica DNS con dig e nslookup

Diagnostichi i problemi di risoluzione dei nomi su Linux usando dig, nslookup e host per ispezionare i record DNS, tracciare i percorsi di risoluzione e individuare configurazioni errate.

Diagnostica DNS con dig e nslookup è una lezione Linux Networking & TCP/IP for Developers gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Linux Networking & TCP/IP for Developers, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Linux Networking & TCP/IP for Developers include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

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 lookups
  • nslookup — classic interactive tool
  • host — 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.com

Reading 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.com

Querying Specific Record Types

Append the record type to look up anything besides an A record.

  • dig example.com MX — mail servers
  • dig example.com AAAA — IPv6
  • dig example.com TXT — text records (SPF, verification)
dig example.com MX

Choosing 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.com

Tracing 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.com

Reverse 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.8

Using nslookup Interactively

nslookup can run one-shot or interactively. In interactive mode you set type= and switch servers with server.

nslookup -type=MX example.com

Quick Answers with host

host gives compact output, ideal for quick checks.

  • host example.com — A and AAAA
  • host -t NS example.com — nameservers
host -t NS example.com

Interpreting 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.conf

Quick Check

Test your understanding of dig output.

Recap

You now diagnose DNS issues directly:

  • dig for flexible, scriptable lookups and +trace
  • @server to isolate resolver problems
  • -x for reverse lookups
  • Read status codes (NOERROR/NXDOMAIN/SERVFAIL)
  • Check /etc/resolv.conf and nsswitch.conf for local issues

These skills complement packet capture and firewall analysis for end-to-end troubleshooting.

Domande Frequenti

La lezione «Diagnostica DNS con dig e nslookup» è gratuita?

Sì — il testo completo di «Diagnostica DNS con dig e nslookup» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Linux Networking & TCP/IP for Developers, passa a CoddyKit PRO. Il corso Linux Networking & TCP/IP for Developers include 4 lezioni in totale.

Cosa imparerò in «Diagnostica DNS con dig e nslookup»?

Diagnostichi i problemi di risoluzione dei nomi su Linux usando dig, nslookup e host per ispezionare i record DNS, tracciare i percorsi di risoluzione e individuare configurazioni errate. Eserciti Linux Networking & TCP/IP for Developers con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Linux Networking & TCP/IP for Developers?

Non è richiesta alcuna esperienza precedente. Linux Networking & TCP/IP for Developers su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.

Quanto tempo richiede la lezione «Diagnostica DNS con dig e nslookup»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Linux Networking & TCP/IP for Developers?

Sì. Ogni lezione Linux Networking & TCP/IP for Developers include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Cattura dei pacchetti con Wireshark/tcpdump
  2. Strumenti per le prestazioni di rete
  3. Firewall Linux (Netfilter/iptables)
  4. Diagnostica DNS con dig e nslookup
← Torna a Linux Networking & TCP/IP for Developers