Skip to main content
PacketMentor logo
Open menu
← All topics
IP Services Foundational

DNS: Domain Name System

How www.example.com becomes an IP address. Covers the recursive query path (root → TLD → authoritative), record types (A, AAAA, CNAME, MX, PTR), TTL caching, and the most common DNS failure modes.

Quick summary
  • DNS translates names humans type into IP addresses computers need. Without it, the internet is just a list of numbers.
  • A recursive resolver does the legwork: it walks root → TLD → authoritative server, then caches the answer for the TTL.
  • Common record types: A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail), PTR (reverse), TXT (anything text).
DNS · how www.packetmentor.com becomes an IPClientyour laptopResolver8.8.8.8 / your ISPRoot"." nameserverTLD.com nameserverAuthoritativepacketmentor.com NS1. query2. ask root3. ask TLD4. ask authResolver does the legwork · client gets ONE answer · responses cached for TTL seconds
A recursive resolver walks from root to TLD to authoritative server on the client's behalf, then caches the answer for the TTL.

Mental model

Your laptop wants to load www.packetmentor.com. The browser has no idea what IP that is. So it asks a resolver (usually your ISP’s, or 8.8.8.8, or 1.1.1.1) to find out.

The resolver doesn’t know either, but it knows where to start asking. It walks a chain:

  1. “Hello root, who runs .com?” Root answers: “Ask the .com TLD servers.”
  2. “Hello .com, who runs packetmentor.com?” TLD answers: “Ask packetmentor.com’s authoritative server.”
  3. “Hello packetmentor.com auth, what’s the IP of www?” Auth answers: “203.0.113.42.”

The resolver returns just the final answer to your laptop. It also caches the answer for the duration specified by the record’s TTL (Time To Live), so the next person asking gets the answer instantly without walking the chain again.

Record types you need to know

TypePurposeExample
AName → IPv4 addresswww.example.com → 203.0.113.42
AAAAName → IPv6 addresswww.example.com → 2001:db8::1
CNAMEAlias to another namewww → example.com.
MXMail server for the domainexample.com → mail.example.com (priority 10)
NSAuthoritative nameserver for the zoneexample.com → ns1.example.com
PTRIP → name (reverse DNS)42.113.0.203.in-addr.arpa → www.example.com
TXTAnything text (SPF, DKIM, domain verification)v=spf1 ...
SOAStart of Authority: zone metadatarefresh, retry, expire, TTL

For CCNA: A and AAAA are by far the most asked. Understand CNAME (it’s a pointer, not a copy) and MX (it’s what mail servers query to deliver email).

TTL: the caching contract

Every DNS record has a TTL (in seconds). When a resolver caches an answer, it holds it for that long before re-asking.

TTLWhen to use
300 (5 min)Aggressive: for records you might change soon
3600 (1 hr)Normal default
86400 (24 hr)Stable records that rarely change

Migration tip: before changing an A record’s IP, lower the TTL to 300 a day in advance. Wait for the old TTL to expire everywhere. Then change. New IP propagates in 5 min instead of a day.

Commands

Query DNS from a Cisco router

R1# nslookup www.packetmentor.com
R1# show host

Configure DNS resolver settings

R1(config)# ip name-server 8.8.8.8 1.1.1.1
R1(config)# ip domain-lookup
R1(config)# ip domain-name corp.local

ip domain-lookup is on by default. The annoying side-effect: if you mistype a command, the router tries to DNS-resolve it as a hostname, which times out for ~30 seconds before giving you the prompt back. Most engineers disable it:

R1(config)# no ip domain-lookup

Configure a Cisco IOS DNS server (rare in production, but exam-relevant)

R1(config)# ip dns server
R1(config)# ip host www.corp.local 10.0.0.50

DNS as a troubleshooting layer

When users say “the internet is down”, the issue is often DNS, not the network. Ping fails by hostname but succeeds by IP? DNS problem. The classic flow:

$ ping www.example.com        ← fails with "unknown host"
$ ping 203.0.113.42           ← works

That’s a DNS failure, not a network failure. Common culprits: ISP DNS server down, local cache poisoning, misconfigured resolver, network adapter has no DNS server assigned.

Diagnosing DNS record problems (CCNA v2.0 4.4)

Most DNS tickets come down to one record that is wrong, missing, or pointing at the wrong place. Ask for the specific record type instead of doing a plain lookup, and the answer (or the error) tells you which record to fix.

What breaks when each record is wrong

RecordSymptom when wrong or missingCheck it with
AName fails over IPv4, or users land on an old servernslookup www.example.com
AAAAIPv6-capable clients fail or connect slowly while IPv4-only clients are finedig example.com AAAA
CNAMEAlias doesn’t resolve, or resolves to the wrong targetnslookup -type=cname www.example.com
MXInbound mail bounces or sits in the sender’s queuenslookup -type=mx example.com
NSThe whole zone fails, often right after a provider or registrar changedig example.com NS
PTRReverse lookup fails; receiving mail servers may reject your outbound maildig -x 203.0.113.10 or nslookup 203.0.113.10

On Windows PowerShell, Resolve-DnsName -Name example.com -Type MX returns the same MX data as objects you can filter or export.

Reading the error

  • NXDOMAIN (nslookup says “Non-existent domain”): the name does not exist. The server answered, so the network path is fine. Check spelling and whether the record was ever created in the right zone.
  • NOERROR with an empty answer: the name exists but has no record of the type you asked for. Typical for a missing AAAA or MX.
  • SERVFAIL (nslookup says “Server failure”): the server could not process the query. Look at the zone’s NS records and whether those authoritative servers are reachable and answering.
  • Timeout (nslookup says “timed out”): no reply at all. That’s reachability, not records: wrong DNS server on the client, or an ACL or firewall blocking port 53.

Worked example: mail isn’t arriving

Outside senders report that mail to example.com bounces. Start with the MX record:

C:\> nslookup -type=mx example.com
example.com     MX preference = 10, mail exchanger = mail.example.com

Now look up the name the MX points to with dig mail.example.com A. Two faults show up here in real networks:

  1. The MX target is a CNAME. RFC 2181 says the name in an MX record must not be an alias. Some senders cope, others don’t. Point the MX at a hostname that has its own A (and AAAA) record.
  2. The MX target resolves, but to the wrong host. After a migration the A record still says 192.0.2.25, the old server. Update the A record to the new server’s address, then allow the old TTL to expire before you call it fixed.

Common mistakes

  1. No reverse DNS for an outbound mail server. Many mail receivers reject mail from IPs without a matching PTR record. If you run a mail server, set up the PTR record at your ISP for that IP.

  2. TTL too long during migration. A 7-day TTL means a week of half the internet seeing your old IP after a change. Lower TTLs before migration, not after.

  3. CNAME at the apex. RFC says you can’t have a CNAME on the apex (root domain). Only on subdomains. Most modern DNS providers offer “ALIAS” or “ANAME” pseudo-records to work around this.

  4. Forgetting ip domain-lookup is on by default. Mistype a command, wait 30 seconds, curse the router. Always disable on lab/admin routers.

  5. Putting unauthorized DNS servers in your name-server list. A typo’d IP could send queries to a malicious server logging everything you look up. Stick to well-known public resolvers (8.8.8.8, 1.1.1.1, 9.9.9.9) or your own internal one.

  6. Confusing recursive and authoritative. Recursive resolvers do the legwork. Authoritative servers answer for the zones they own. Most public servers do both, but they’re conceptually distinct.

Lab to try tonight

  1. From your laptop, run dig www.cisco.com (or nslookup on Windows). Note the answer + TTL.
  2. Run it again immediately: the second response is from cache, should be much faster.
  3. Run dig +trace www.cisco.com: watch the recursive walk happen step-by-step from root to TLD to authoritative.
  4. On a Cisco router, configure ip name-server 1.1.1.1. Then run ping www.cisco.com and verify DNS resolution works.
  5. Disable ip domain-lookup. Mistype a command. Confirm you no longer wait 30s for the prompt.
  6. Bonus: change the TTL on a test domain you control. Watch propagation time difference.

Cheat strip

ConceptPlain English
ResolverThe server that walks the query chain on the client’s behalf
Authoritative serverThe server that owns the record (the “source of truth”)
Root → TLD → AuthThe three steps of a recursive lookup
TTLHow long answers stay cached. Lower = faster propagation, more lookups.
A / AAAAIPv4 / IPv6 address records
CNAMEAlias (pointer) to another name
MXMail server for the domain
PTRReverse lookup: IP to name
no ip domain-lookupDisables DNS on the router CLI to avoid mistype delays

Frequently asked questions

Q: What’s the difference between recursive and iterative DNS? A: A recursive resolver does the whole lookup on the client’s behalf, asking the root, then TLD, then authoritative servers until it gets an answer. An iterative resolver only tells you where to look next (e.g., “ask the .com TLD server”). Client stubs always talk to recursive resolvers (8.8.8.8, 1.1.1.1, your ISP’s): the recursive resolver does the iterative walk.

Q: What’s a CNAME vs an A record? A: An A record maps a hostname directly to an IPv4 address (www.example.com → 93.184.216.34). A CNAME is an alias pointing at another hostname (www.example.com → example.com). CNAMEs let you point multiple hostnames at a single canonical record; changing the canonical A record updates every CNAME automatically. Common gotcha: you can’t CNAME the apex (example.com itself). Use an ALIAS or ANAME record if your DNS provider supports it.

Q: Why do I sometimes see stale DNS results? A: Caching: every DNS record has a TTL (time-to-live). Once a resolver caches a response, it keeps returning that answer until the TTL expires. Common TTLs: 300s (5 min) for fast-changing records, 86400s (24 hr) for stable ones. When you plan a DNS migration, lower TTLs a day ahead so the switchover propagates quickly. Client OSes also cache: Windows ipconfig /flushdns, macOS sudo dscacheutil -flushcache.

Q: What is DNS over HTTPS (DoH)? A: DNS queries wrapped in HTTPS instead of clear-text UDP 53. Prevents ISPs and network operators from seeing what domains a user visits (or from tampering with responses). Firefox, Chrome, and iOS/macOS all support it. Enterprise networks often try to block DoH because it bypasses DNS-based content filters. Expect a policy debate on whether to enable it in your org.

Q: What port does DNS use? A: UDP 53 for normal queries. TCP 53 for responses > 512 bytes and for zone transfers between authoritative servers. DoH uses TCP 443 (piggybacking on HTTPS). DoT (DNS over TLS) uses TCP 853. When you write a firewall rule allowing DNS, allow both UDP and TCP 53, otherwise DNSSEC and large TXT records fail.

Master this on a real network

Want this drilled into reflex?

1:1 weekly sessions, live feedback on your labs, and US interview prep: built around the CCNA® exam blueprint. Free first session. No card on file until you decide.

Claim my free session →

Get the free CCNA 12-week roadmap

You're already reading up on DNS: Domain Name System. The roadmap is the order I recommend studying every CCNA topic in: with what to lab each week and where DNS: Domain Name System fits. A written personal reply, not an autoresponder. Expect it within one business day.

Personal reply from a senior network engineer. No third-party tracking. Unsubscribe any time.