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
| Type | What it's for | In this lab |
|---|---|---|
| A | Name → IPv4 address | intranet → 192.168.20.10 |
| AAAA | Name → IPv6 address | intranet → 2001:db8:ca:20::10 |
| CNAME | Alias for another name | wiki → intranet |
| MX | The domain's mail servers, with their preference | 10 mx1 · 20 mx2 |
| NS | Servers that are authoritative for the zone | ns1 · ns2 |
| PTR | Address → name (reverse lookup) | 192.168.20.10 → intranet |
| SOA | Zone data: primary, serial, timers and negative TTL | ns1 · 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.
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.
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.
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.
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.
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.
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.
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
| Section | What it carries |
|---|---|
| Header (12 bytes) | Identifier, flags (QR, AA, TC, RD, RA, AD, CD, RCODE) and how many records are in each section. |
| Question | The name, type and class being looked up. |
| Answer | The records that answer the question. |
| Authority | The authoritative servers, or the SOA in a negative response. |
| Additional | Data 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
| RCODE | Name | What it means |
|---|---|---|
| 0 | NOERROR | No error. If the answer section is empty, the name exists but has no record of that type (NODATA). |
| 2 | SERVFAIL | The server couldn't resolve: an authoritative server or DNSSEC validation failed. |
| 3 | NXDOMAIN | The name doesn't exist. |
| 5 | REFUSED | The server refuses to answer, for example because it doesn't offer recursion to that client. |
Seeing it on Cisco IOS XE
| Command | What it shows or does |
|---|---|
ip domain lookup | Turns on name resolution (on by default). |
ip name-server 10.20.30.53 | The DNS server the router uses. |
ip domain name canada-logistica.example | The domain appended to dotless names. |
ip host intranet 192.168.20.10 | A static entry, without asking DNS. |
show hosts | The router's name cache and its DNS settings. |
no ip domain lookup | Keeps 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
- RFC 1034 · Domain Names: Concepts and Facilities
- RFC 1035 · Domain Names: Implementation and Specification
- RFC 3596 · DNS Extensions to Support IP Version 6 (AAAA)
- RFC 2308 · Negative Caching of DNS Queries (DNS NCACHE)
- RFC 6891 · Extension Mechanisms for DNS (EDNS(0))
- RFC 7873 · Domain Name System (DNS) Cookies
- Cisco · DNS lookups on routers: ip domain lookup and ip name-server (doc. 24182)
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.