C.W.K.
Stream
Lesson 09 of 13 · published

dig & nslookup

~12 min · dig, nslookup, dns, record-types

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

DNS query tools

Track 1 introduced DNS conceptually. dig is how you actually query it. The most common usage is dig +short hostname — just give me the IP. The advanced flags let you query specific record types, bypass your default resolver, or trace the full delegation chain.

Record types worth knowing

TypeReturns
AIPv4 address(es)
AAAAIPv6 address(es)
MXMail servers
NSAuthoritative nameservers
TXTText records (SPF, DKIM, domain verification)
CNAMECanonical name aliases
PTRReverse DNS

Code

dig and nslookup recipes·bash
# Standard query
dig github.com

# Short answer only
dig +short github.com

# Specific record type
dig github.com MX
dig github.com NS
dig github.com TXT
dig github.com AAAA

# Use a specific resolver (Cloudflare)
dig @1.1.1.1 +short github.com
dig @8.8.8.8 +short github.com

# Reverse — IP to name
dig -x 140.82.121.3

# Trace the full delegation chain (root → TLD → authoritative)
dig +trace github.com

# Simpler tool, more limited
nslookup github.com
nslookup github.com 1.1.1.1

External links

Exercise

Run dig +short github.com, dig github.com MX, dig github.com NS, dig +trace github.com. Read the trace output and identify: root server → .com TLD → GitHub's authoritative nameservers → final answer. The whole DNS delegation chain in one command — internalize that picture and DNS issues stop being magic.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.