1. Query a name
dig queries DNS for a name and prints the full answer, authority, and additional sections.
dig example.comTyporithm · medium
Step 1 of 8 · intro card
L7 & TLS
DNS resolves names to IPs through a hierarchy — root, then TLD, then the authoritative server. Record types include A/AAAA (addresses), CNAME (alias), MX (mail), NS (nameserver), and TXT. A recursive resolver caches answers honoring each record's TTL. dig is the standard query tool.
DNS is a distributed, hierarchical directory. A lookup walks the tree: the root servers point to the TLD servers (like .com), which point to the domain's authoritative nameservers, which hold the actual records.
Records come in types. A maps a name to an IPv4 address and AAAA to IPv6; CNAME aliases one name to another; MX lists mail servers; NS names the authoritative nameservers; TXT holds arbitrary text (SPF, verification). dig and host let you ask for a specific type.
A recursive resolver does the multi-step walk on your behalf and caches each answer for the duration of its TTL, so repeat lookups are instant and the authoritative servers see far less traffic. dig is the standard, scriptable query tool; nslookup is the older alternative.
Resolution walks root -> TLD -> authoritative nameserver.
Record types: A/AAAA, CNAME, MX, NS, TXT.
A recursive resolver caches answers per the record's TTL.
dig example.com
dig +short A example.com
dig MX example.com
nslookup example.com
host -t NS example.comConnect each part of the code to the concept before you type.
dig queries DNS for a name and prints the full answer, authority, and additional sections.
dig example.com+short trims the output to the answer; A asks for the IPv4 address.
dig +short A example.comMX records name the mail servers that accept email for the domain.
dig MX example.comnslookup is an older interactive tool that queries the configured resolver.
nslookup example.comhost -t NS asks for the authoritative nameservers of the domain.
host -t NS example.comRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.