Linux Networking & TCP/IP for Developers · Aula

Diagnóstico de DNS com dig e nslookup

Diagnostique problemas de resolução de nomes no Linux usando dig, nslookup e host para inspecionar registros DNS, rastrear caminhos de resolução e identificar configurações incorretas.

Aula 4 de 413 etapas

Diagnóstico de DNS com dig e nslookup é uma aula grátis de Linux Networking & TCP/IP for Developers no CoddyKit. Esta é a aula 4 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Linux Networking & TCP/IP for Developers, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Linux Networking & TCP/IP for Developers inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

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.

Grátis para começar

Aprenda Linux Networking & TCP/IP for Developers com um tutor de IA — grátis

Escreva e execute código real no seu navegador, obtenha ajuda instantânea de um tutor de IA 24/7 e continue de onde parou na web ou no app.

Cursos
12
Aulas
48

Perguntas Frequentes

A aula “Diagnóstico de DNS com dig e nslookup” é grátis?

Sim — o texto completo de “Diagnóstico de DNS com dig e nslookup” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Linux Networking & TCP/IP for Developers, atualize para CoddyKit PRO. O curso de Linux Networking & TCP/IP for Developers inclui 4 aulas no total.

O que vou aprender em “Diagnóstico de DNS com dig e nslookup”?

Diagnostique problemas de resolução de nomes no Linux usando dig, nslookup e host para inspecionar registros DNS, rastrear caminhos de resolução e identificar configurações incorretas. Você pratica Linux Networking & TCP/IP for Developers com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Linux Networking & TCP/IP for Developers?

Nenhuma experiência prévia é necessária. Linux Networking & TCP/IP for Developers no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 4 de 4.

Quanto tempo leva a aula “Diagnóstico de DNS com dig e nslookup”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Linux Networking & TCP/IP for Developers?

Sim. Cada aula de Linux Networking & TCP/IP for Developers inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Captura de Pacotes com Wireshark/tcpdump
  2. Ferramentas de Desempenho de Rede
  3. Firewall do Linux (Netfilter/iptables)
  4. Diagnóstico de DNS com dig e nslookup
← Voltar para Linux Networking & TCP/IP for Developers