LABS · PROTOCOLS · NET PATH

DNS: the network's names, record by record

DNS turns names into addresses and much more: aliases, mail servers, authoritative servers and reverse lookups. Watch each record in a real query and learn to troubleshoot when a name doesn't resolve.

Level: beginner · 15 minutes

Interactive simulation

The animation needs JavaScript. The full lesson is written out below.

Download the capture and open it in Wireshark to keep exploring.

What DNS is

DNS (Domain Name System, RFC 1034 and 1035) is a distributed, hierarchical database that maps names to data: IPv4 and IPv6 addresses, aliases, mail servers and more. Each zone, such as canada-logistica.example, is managed by its authoritative servers. Recursive resolvers look up answers on behalf of clients and cache them for each record's TTL.

Queries normally travel over UDP 53. If the response doesn't fit, the server sets TC and the client repeats the query over TCP 53. Zone transfers between servers also use TCP.

The records on the exam

TypeWhat it's forIn this lab
AName → IPv4 addressintranet → 192.168.20.10
AAAAName → IPv6 addressintranet → 2001:db8:ca:20::10
CNAMEAlias for another namewiki → intranet
MXThe domain's mail servers, with their preference10 mx1 · 20 mx2
NSServers that are authoritative for the zonens1 · ns2
PTRAddress → name (reverse lookup)192.168.20.10 → intranet
SOAZone data: primary, serial, timers and negative TTLns1 · serial 2026112801

How it works: one query, one response

Seven steps: the A, AAAA, CNAME, MX, NS and PTR records, and a name that doesn't exist.

  1. A record: from name to IPv4

    Ana runs dig intranet.canada-logistica.example. The laptop sends a type A query to server 10.20.30.53, with RD = 1 to ask for recursion and an EDNS(0) OPT record announcing that it accepts UDP responses of up to 1232 bytes. The server is authoritative for the zone (AA = 1) and replies with an A record: 192.168.20.10, which can be cached for 3600 seconds.

  2. AAAA record: from name to IPv6

    For IPv6, the record is AAAA (RFC 3596): 16 bytes instead of 4. A dual-stack host usually asks for both A and AAAA and prefers IPv6 if it has connectivity. The server answers 2001:db8:ca:20::10. The same name can have A and AAAA records at the same time.

  3. CNAME: an alias that points to another name

    Ana looks up wiki.canada-logistica.example. That name has no address of its own: it's an alias (CNAME) of intranet.canada-logistica.example. Since the server knows both, it returns the CNAME and the canonical name's A record in the same response. In the bytes, repeated names are compressed with pointers to where they already appeared.

  4. MX: who receives the domain's mail

    A server that wants to deliver a message to someone@canada-logistica.example asks for the domain's MX. There are two: mx1 with preference 10 and mx2 with 20; the lowest number is tried first. In the additional section, the server adds the addresses of mx1 and mx2 to save another query. An MX must point to a name with an A or AAAA record, never to a CNAME.

  5. NS: who is authoritative for the zone

    The NS record says which servers are authoritative for the zone: ns1 in Montreal (10.20.30.53, the one answering all these queries) and ns2 in Vancouver (192.168.20.53), which keeps a copy. The parent zone delegates to them with its own NS records. Their TTL is one day because they rarely change.

  6. PTR: from address to name

    dig -x 192.168.20.10 reverses the address and appends in-addr.arpa: it asks for the PTR of 10.20.168.192.in-addr.arpa. The answer is intranet.canada-logistica.example. The reverse zone is managed separately from the forward one: if nobody creates the PTR, the reverse lookup fails even though the A record exists. Mail servers and device logs use it a lot.

  7. NXDOMAIN: the name doesn't exist

    On R1, someone types ping intrnet. Since the name has no dots, IOS appends the domain set with ip domain name and asks for intrnet.canada-logistica.example. The server replies with RCODE 3 (NXDOMAIN) and, in the authority section, the zone's SOA: it says the negative result can be cached for 300 seconds. IOS shows «Unrecognized host or address».

The DNS message

SectionWhat it carries
Header (12 bytes)Identifier, flags (QR, AA, TC, RD, RA, AD, CD, RCODE) and how many records are in each section.
QuestionThe name, type and class being looked up.
AnswerThe records that answer the question.
AuthorityThe authoritative servers, or the SOA in a negative response.
AdditionalData that saves queries, such as the MX addresses, and the EDNS OPT record.

To save space, a name that already appeared in the message is replaced by a 2-byte pointer (0xC0 plus its position). That's why, in the CNAME response, intranet.canada-logistica.example is written out only once.

Response codes

RCODENameWhat it means
0NOERRORNo error. If the answer section is empty, the name exists but has no record of that type (NODATA).
2SERVFAILThe server couldn't resolve: an authoritative server or DNSSEC validation failed.
3NXDOMAINThe name doesn't exist.
5REFUSEDThe server refuses to answer, for example because it doesn't offer recursion to that client.

Seeing it on Cisco IOS XE

CommandWhat it shows or does
ip domain lookupTurns on name resolution (on by default).
ip name-server 10.20.30.53The DNS server the router uses.
ip domain name canada-logistica.exampleThe domain appended to dotless names.
ip host intranet 192.168.20.10A static entry, without asking DNS.
show hostsThe router's name cache and its DNS settings.
no ip domain lookupKeeps a mistyped command from being taken as a name and leaving the router waiting for DNS.

Troubleshooting when a name doesn't resolve

  • NXDOMAIN: the name doesn't exist. Check the spelling and whether the right domain was appended (search or ip domain name).
  • NOERROR with no answer (NODATA): the name exists but has no record of that type, for example an AAAA nobody created.
  • The website opens by IP but not by name: the A or AAAA record is missing, or the client uses another DNS server. Compare dig with and without @server.
  • Mail doesn't arrive: check the destination domain's MX and that its server has an A record; an MX can't point to a CNAME.
  • A change doesn't show up: the old answer stays cached until its TTL expires; negative ones, according to the SOA minimum.
  • The reverse lookup fails: the PTR is missing in the in-addr.arpa zone, which is managed separately from the forward zone.

Frequently asked questions

Does DNS use UDP or TCP?

Queries almost always use UDP 53. TCP 53 is used when the response doesn't fit in UDP (TC bit) and for zone transfers between servers.

What's the difference between an authoritative server and a recursive resolver?

The authoritative server holds the zone's records and answers with AA = 1. The recursive resolver looks up the answer for the client by asking other servers and caches it. The server in this lab does both for the company.

What is a record's TTL?

The number of seconds a resolver or client can keep the answer in cache. A low TTL allows quick changes; a high one reduces queries.

Can an MX point to a CNAME?

No. RFC 2181 requires the MX, like the NS, to point to a name with address records. Many mail servers reject or ignore an MX that points to an alias.

Why does the router get stuck on «Translating…» when I mistype a command?

Because IOS takes the unknown word as a host name and tries to open a Telnet session. If no DNS server is configured, the query is broadcast and waits until it times out. Prevent it with no ip domain lookup.

Key takeaways

  • DNS maps names to data: A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail), NS (authority) and PTR (reverse lookup).
  • Queries travel over UDP 53; TCP 53 is used for large responses and zone transfers.
  • AA = 1 marks an authoritative answer; RCODE 3 (NXDOMAIN) means the name doesn't exist.
  • Each answer is cached for its TTL; negative ones, according to the SOA minimum.
  • To troubleshoot, compare what the client asks for with what the zone holds: name, record type, server queried and cache.

NEXT STEP

From this lesson to the Canadá Logística network

In the CCNA 2.0 Course you troubleshoot name failures on Canadá Logística's devices: A, AAAA, CNAME, MX, NS and PTR records, DNS on IOS XE and captures, in Packet Tracer or CML. We'll let you know when it opens.

Upcoming labs

Sources

Lesson prepared with AI assistance and checked against the sources cited. The bytes of every packet are generated according to the standard and verified with an independent tool.