A zone file can pass every syntax check and still take a website or a mail domain offline. A missing trailing dot, a stale AAAA record or an MX that points at nothing all load cleanly, and the first sign of trouble is a user who can reach a server by address but not by name. Telling which record is wrong, and whether the problem sits on the DNS server or in a client’s cache, is most of DNS troubleshooting.
This guide covers the six record types you meet most (A, AAAA, CNAME, MX, NS and PTR): what each one does, what a healthy answer looks like in dig and nslookup, and how a Cisco router resolves names. Then it breaks each record on purpose and shows the evidence. We broke a real BIND zone six ways in November 2026 and recorded what BIND 9.18 on Ubuntu 24.04 and a Cisco 7200 router on IOS 15.2(4)S3 reported each time, so every message below is the one you’ll actually see.
What each DNS record does
Every name lookup asks a DNS server for one record type, and each type answers a different question. A web browser asks for A and AAAA, a mail server asks for MX and then for the address of the host it names, and a traceroute asks for PTR to put names on the hops. When one of them is wrong, only the traffic that depends on that type breaks, which is the first clue to which record to check:
| Record | Maps | Example from the lab zone | What breaks when it is wrong |
|---|---|---|---|
| A | Name to IPv4 address | web1 IN A 192.168.122.12 | Access by name over IPv4 |
| AAAA | Name to IPv6 address | web1 IN AAAA 2001:db8:122::12 | Access by name from clients that prefer IPv6 |
| CNAME | Alias to another name | www IN CNAME web1.ccna.example. | Every lookup of the alias |
| MX | Domain to its mail server names, with a preference | @ IN MX 10 mail1.ccna.example. | Inbound email for the domain |
| NS | Zone to its authoritative name servers | @ IN NS ns1.ccna.example. | Delegation, and in BIND the whole zone |
| PTR | Address back to a name (reverse lookup) | 12 IN PTR web1.ccna.example. | Names in traceroutes and logs, and mail from that address |
Four rules cause most of the trouble, and three of the failures in this guide break one of them:
- A CNAME aliases the whole name, so no other record can share that name
- MX and NS targets must be names with their own A or AAAA record, never an alias (RFC 2181, section 10.3)
- Those targets are domain names by definition, so a bare IP address there is read as a name
- A name in a zone file is relative unless it ends in a dot
The last one looks trivial, but that single character is behind one of the hardest failures below to spot, because the zone loads cleanly and the error only shows in the answer.
The lab: one BIND server, two Cisco routers
The DNS server is BIND on Ubuntu 24.04 at 192.168.122.1, authoritative for ccna.example and for the reverse zone of 192.168.122.0/24. R1 is the client that looks names up. R2 plays the web server web1, with both an IPv4 and an IPv6 address, and www is an alias for it:

If you are building BIND from scratch, the BIND 9 install guide for Ubuntu covers the packages and service. This lab needs only an authoritative server with recursion off, so the options file stays short. Open it:
sudo vim /etc/bind/named.conf.options
BIND listens on loopback and the lab address only, answers for its own zones, and refuses zone transfers:
options {
directory "/var/cache/bind";
listen-on { 127.0.0.1; 192.168.122.1; };
listen-on-v6 { none; };
recursion no;
allow-transfer { none; };
};
Declare the two zones next, both as primary zones with their files under /etc/bind/zones.
sudo vim /etc/bind/named.conf.local
The reverse zone name is the network’s octets backwards with in-addr.arpa on the end, so 192.168.122.0/24 becomes 122.168.192.in-addr.arpa:
zone "ccna.example" {
type primary;
file "/etc/bind/zones/db.ccna.example";
};
zone "122.168.192.in-addr.arpa" {
type primary;
file "/etc/bind/zones/db.192.168.122";
};
Create the zones directory, then the forward zone file.
sudo mkdir -p /etc/bind/zones
sudo vim /etc/bind/zones/db.ccna.example
It holds one of each record type from the table. Every name on the right of a record ends with a dot, which marks it as complete:
$TTL 300
@ IN SOA ns1.ccna.example. admin.ccna.example. (
2026113001 ; serial
3600 ; refresh
600 ; retry
604800 ; expire
300 ) ; negative caching TTL
IN NS ns1.ccna.example.
IN MX 10 mail1.ccna.example.
ns1 IN A 192.168.122.1
r1 IN A 192.168.122.11
web1 IN A 192.168.122.12
web1 IN AAAA 2001:db8:122::12
www IN CNAME web1.ccna.example.
mail1 IN A 192.168.122.25
The reverse zone maps the last octet of each address back to its name.
sudo vim /etc/bind/zones/db.192.168.122
Add the SOA and NS records and one PTR per host:
$TTL 300
@ IN SOA ns1.ccna.example. admin.ccna.example. (
2026113001 3600 600 604800 300 )
IN NS ns1.ccna.example.
1 IN PTR ns1.ccna.example.
11 IN PTR r1.ccna.example.
12 IN PTR web1.ccna.example.
25 IN PTR mail1.ccna.example.
Check both files before BIND loads them. named-checkzone catches the errors that would stop a zone from loading, and you’ll see later that a few serious mistakes pass it untouched:
sudo named-checkconf
named-checkzone ccna.example /etc/bind/zones/db.ccna.example
named-checkzone 122.168.192.in-addr.arpa /etc/bind/zones/db.192.168.122
sudo systemctl restart named
Each zone reports its serial and OK, and named-checkconf prints nothing when the configuration is valid:
zone ccna.example/IN: loaded serial 2026113001
OK
zone 122.168.192.in-addr.arpa/IN: loaded serial 2026113001
OK
On R1, three commands turn on name resolution and point it at the server. Lab router templates often ship with no ip domain lookup (ours did), because otherwise a mistyped command makes the router try to resolve it as a host name, so the first line matters:
ip domain lookup
ip domain name ccna.example
ip name-server 192.168.122.1
Both routers also need their LAN addresses, IPv4 and IPv6, because the AAAA failure below only shows up when the client runs IPv6. R1’s interface configuration (R2 uses .12 and ::12, and adds ip http server to play the web host):
ipv6 unicast-routing
interface GigabitEthernet0/0
ip address 192.168.122.11 255.255.255.0
ipv6 address 2001:db8:122::11/64
no shutdown
The domain name lets you type web1 instead of web1.ccna.example, because IOS appends it to any name without a dot. Check the result with show hosts, whose header repeats the default domain and the name servers in use.
Read a healthy answer with dig
dig shows the whole DNS reply, and its header tells you more than the answer does. Query the server directly with @, so you test the server itself and not whatever resolver your machine happens to use:
dig @192.168.122.1 www.ccna.example
A healthy reply for the alias looks like this, and it’s worth studying once so you can spot what changes when something breaks:
; <<>> DiG 9.18.39-0ubuntu0.24.04.9-Ubuntu <<>> @192.168.122.1 www.ccna.example
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15661
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 51ffbbd435610057010000006b0dbf99ade61e32fa9d7829 (good)
;; QUESTION SECTION:
;www.ccna.example. IN A
;; ANSWER SECTION:
www.ccna.example. 300 IN CNAME web1.ccna.example.
web1.ccna.example. 300 IN A 192.168.122.12
;; Query time: 1 msec
;; SERVER: 192.168.122.1#53(192.168.122.1) (UDP)
;; WHEN: Mon Nov 30 18:25:29 UTC 2026
;; MSG SIZE rcvd: 108
Read it from the top. status: NOERROR means the name exists, and the aa flag means this server is authoritative for it, so you are looking at the zone’s own data and not a cached copy from somewhere else. The answer section holds two records because the server followed the CNAME for you: www points at web1, and web1 has the address. The recursion warning is expected on an authoritative-only server and harmless here. The two statuses you’ll see when something is wrong are NXDOMAIN (the name does not exist in the zone) and SERVFAIL (the server could not answer at all).
For day-to-day checks, +noall +answer trims the reply to the records themselves. Ask for each type in turn:
dig @192.168.122.1 web1.ccna.example A +noall +answer
dig @192.168.122.1 web1.ccna.example AAAA +noall +answer
dig @192.168.122.1 ccna.example MX +noall +answer
dig @192.168.122.1 ccna.example NS +noall +answer
dig @192.168.122.1 -x 192.168.122.12 +noall +answer
One line each. The -x option builds the reverse name for you, which is why the PTR answer shows 12.122.168.192.in-addr.arpa:
web1.ccna.example. 300 IN A 192.168.122.12
web1.ccna.example. 300 IN AAAA 2001:db8:122::12
ccna.example. 300 IN MX 10 mail1.ccna.example.
ccna.example. 300 IN NS ns1.ccna.example.
12.122.168.192.in-addr.arpa. 300 IN PTR web1.ccna.example.
The 300 in each line is the TTL in seconds, which is how long a resolver or client may cache the answer. Keep it in mind when you fix a record, because anything that cached the old answer keeps using it until the TTL runs out. On Windows, or anywhere without dig, nslookup asks the same questions with less detail:
nslookup -type=MX ccna.example 192.168.122.1
nslookup 192.168.122.12 192.168.122.1
The MX query shows the preference and target, and giving nslookup an address runs a reverse lookup:
Server: 192.168.122.1
Address: 192.168.122.1#53
ccna.example mail exchanger = 10 mail1.ccna.example.
12.122.168.192.in-addr.arpa name = web1.ccna.example.
Resolve names from a Cisco router
A router resolves names for its own commands, such as ping, traceroute, ssh and copy, and it caches every answer in its host table. Ping the alias from R1:
ping www.ccna.example
The “Translating” line confirms R1 asked the name server and got an answer. Look at the destination, though:
Translating "www.ccna.example"...domain server (192.168.122.1) [OK]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:122::12, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/9/12 ms
R1 pinged the IPv6 address. With both an A and an AAAA record for web1 and IPv6 running on R1, the ping went to the AAAA address, so the AAAA record decides whether this ping by name works at all. Remember that when IPv4 tests pass and a name still fails. show hosts shows what R1 cached:
show hosts
The entry is marked temp because it was learned from DNS, and the alias is listed under the name it points to:
Name lookup view: Global
Default domain is ccna.example
Name/address lookup uses domain service
Name servers are 192.168.122.1
Codes: UN - unknown, EX - expired, OK - OK, ?? - revalidate
temp - temporary, perm - permanent
NA - Not Applicable None - Not defined
Host Port Flags Age Type Address(es)
web1.ccna.example None (temp, OK) 0 IPv6 2001:DB8:122::12
www.ccna.example
Traceroute adds reverse lookups. With DNS lookups enabled, R1 asks for the PTR of each hop and prints the name next to the address. To see that happen, turn on query logging on the DNS server first:
sudo rndc querylog on
Then, on R1, clear the host table and trace to the address, so the name can only come from a PTR lookup and not from the cache:
clear host *
traceroute 192.168.122.12
The single hop carries both the name and the address:
Tracing the route to web1.ccna.example (192.168.122.12)
VRF info: (vrf in name/id, vrf out name/id)
1 web1.ccna.example (192.168.122.12) 20 msec 20 msec 20 msec
Read the query log on the server to see where the name came from:
sudo journalctl -u named --since "-3min" --no-pager -o cat | grep query:
It shows a PTR query sent by R1 at 192.168.122.11. Turn logging off again with sudo rndc querylog off when you’re done, because a busy server logs every query:
client @0x7fb3a400c7f8 192.168.122.11#65214 (12.122.168.192.in-addr.arpa): query: 12.122.168.192.in-addr.arpa IN PTR + (192.168.122.1)
Those three views, dig on the server, show hosts and a ping by name or a traceroute on the client, are all you need for every failure below. Each one starts with a single changed line in a zone file, loaded with sudo rndc reload and the zone name after the serial was raised.
Diagnose broken DNS records
Every case below was solved the same way, and the order matters because each step rules out a whole layer before you touch a zone file:
- Find out whether the name fails everywhere or only on one client
- Ask the authoritative server directly with
dig @server - Compare its answer with the address the host really uses
- Check the client’s cache if the server is right and one client is wrong
If the server’s answer is correct, you can stop reading zone files: the problem is a cache, a client setting or the network, and you have saved yourself an edit that would only add another change to the mess.
Ping by name fails but the IP address works (wrong AAAA)
We changed web1‘s AAAA record to an IPv6 address no host uses, a typical leftover after a server moves:
-web1 IN AAAA 2001:db8:122::12
+web1 IN AAAA 2001:db8:122::99
named-checkzone passes it, because nothing in the zone can tell a stale address from a correct one. On R1, after clearing the host table, the ping by name goes to the new AAAA answer and fails, while the IPv4 address answers fine:
R1# ping www.ccna.example
Translating "www.ccna.example"...domain server (192.168.122.1) [OK]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:122::99, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R1# ping 192.168.122.12
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.122.12, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/15/20 ms
“Works by address, fails by name” always means the name maps to the wrong place, and the destination in the ping output tells you which record to check. Query it and compare with the address the server really has:
dig @192.168.122.1 web1.ccna.example AAAA +noall +answer
The answer still carries the leftover address:
web1.ccna.example. 300 IN AAAA 2001:db8:122::99
Fix the record, raise the serial and reload. If a host no longer has an IPv6 address, delete its AAAA record instead of leaving a wrong one in place, because clients that prefer IPv6 try that address first, and some, like R1 here, never fall back to IPv4. A stale A record behaves the same way for IPv4.
The router keeps using the old answer
This one caught us in the middle of the previous test. Right after the AAAA change, before we cleared anything, R1 still pinged the old, working address, with no “Translating” line, because it answered from its host table. The reverse happens after you fix a record: the zone is right, dig shows the correct address, and the router keeps failing:
R1# ping www.ccna.example
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:122::99, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
The missing “Translating” line is the giveaway: R1 never asked the server. show hosts confirms the cached entry, so clear the two names involved (or everything with clear host *):
clear host www.ccna.example
clear host web1.ccna.example
The next ping looks the name up again and gets the corrected record.
R1# ping www.ccna.example
Translating "www.ccna.example"...domain server (192.168.122.1) [OK]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:122::12, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/9/12 ms
Every client and resolver between you and the zone caches answers for up to the record’s TTL, so a fix is never instant everywhere. Lowering the TTL at least one full TTL period before a planned address change (often a day ahead), then raising it again afterwards, keeps that window short. On a Windows PC the equivalent of clear host is ipconfig /flushdns.
% Unrecognized host or address (CNAME without a trailing dot)
We dropped the final dot from the CNAME target, one of the most common zone file mistakes:
-www IN CNAME web1.ccna.example.
+www IN CNAME web1.ccna.example
named-checkzone reports OK and BIND loads the zone, because the line is valid. It just means something else. R1 can’t resolve the alias at all:
R1# ping www.ccna.example
Translating "www.ccna.example"...domain server (192.168.122.1)
Translating "www.ccna.example"...domain server (192.168.122.1)
% Unrecognized host or address, or protocol not running.
Ask the server for the alias with the header included:
dig @192.168.122.1 www.ccna.example +noall +comments +answer +authority
The status is NXDOMAIN even though there is an answer, and the answer shows why. Without the dot, BIND appended the zone name to the target, so the alias now points at web1.ccna.example.ccna.example., which does not exist:
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 6178
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; ANSWER SECTION:
www.ccna.example. 300 IN CNAME web1.ccna.example.ccna.example.
;; AUTHORITY SECTION:
ccna.example. 300 IN SOA ns1.ccna.example. admin.ccna.example. 2026113002 3600 600 604800 300
Whenever you see the zone name twice in an answer, look for a missing dot on the line that produced it. The same mistake on an MX or NS target produces a name nobody can resolve. On a PTR record it appends the reverse zone’s name instead, so named-checkzone -D showed our test record as web1.ccna.example.122.168.192.in-addr.arpa.
MX points at a name with no address
We pointed the MX record at mail, a host that was never defined, instead of mail1:
- IN MX 10 mail1.ccna.example.
+ IN MX 10 mail.ccna.example.
This time named-checkzone notices, but only as a warning, and the zone still loads:
zone ccna.example/IN: ccna.example/MX 'mail.ccna.example' has no address records (A or AAAA)
zone ccna.example/IN: loaded serial 2026113002
OK
BIND logs the same line on reload and then serves the MX record as if nothing were wrong, so a plain MX query looks healthy. A sending mail server takes the next step and looks up the target’s address, and that is where it breaks. Do the same by hand:
dig @192.168.122.1 mail.ccna.example +noall +comments
The target does not exist, so mail for the domain has nowhere to go:
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 50077
Always follow an MX answer to an A or AAAA lookup of the name it returns. The target must be a host name with its own address record. An IP address in the MX field fails too: named-checkzone warned “MX is an address”, read it as the name 192.168.122.25.ccna.example and still loaded the zone. A CNAME there breaks the RFC 2181 rule from the first section.
Traceroute shows addresses but no names (missing PTR)
We deleted the PTR record for 192.168.122.12 from the reverse zone. Forward lookups are untouched, so web1 and www still work, but a reverse lookup now fails:
dig @192.168.122.1 -x 192.168.122.12 +noall +comments +answer
The status is NXDOMAIN and the answer section is empty.
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 5482
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available
On R1, the same clear host * and traceroute 192.168.122.12 that printed web1.ccna.example (192.168.122.12) in the healthy run now shows the bare address. The query log still records R1’s PTR query, so the router asked and got nothing back:
R1# traceroute 192.168.122.12
Type escape sequence to abort.
Tracing the route to 192.168.122.12
VRF info: (vrf in name/id, vrf out name/id)
1 192.168.122.12 12 msec 12 msec 8 msec
A missing PTR rarely stops a web page, but it hurts in two places. Logs and traceroutes lose their names, which slows every investigation that follows, and mail suffers more: Google’s sender guidelines require valid forward and reverse DNS for sending IPs, so mail from a server without a matching PTR can be rejected or marked as spam. The reverse zone is often run by whoever owns the address block (your ISP or cloud provider for public addresses), so a missing PTR on a public IP is usually a request to them, not an edit you make yourself.
NS record with no address: the zone stops loading
We added a second name server, ns2, to the zone and forgot its A record:
IN NS ns1.ccna.example.
+ IN NS ns2.ccna.example.
Unlike the MX case, this is an error, and BIND refuses the whole zone:
zone ccna.example/IN: NS 'ns2.ccna.example' has no address records (A or AAAA)
zone ccna.example/IN: not loaded due to errors.
On rndc reload, BIND kept serving the copy it already had in memory, so the SOA still showed the old serial and nothing looked broken. The edit had simply never gone live, which is confusing in its own way. A restart is different, because named reads the files from disk with nothing to fall back on:
sudo systemctl restart named
dig @192.168.122.1 www.ccna.example +noall +comments
Every name in the domain now fails with SERVFAIL, and the missing aa flag shows the server is no longer authoritative for anything in it:
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 39425
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
R1 sees the same “% Unrecognized host or address” as in the CNAME case, for every name in the zone. That is the strongest argument for running named-checkzone before every reload: one missing glue record took down web, mail and every other name at once. When two servers serve the zone, the BIND primary and secondary guide shows the setup in which this record would be correct.
Zone serial has gone backwards or is unchanged
Two log lines from this lab are worth recognising, because they explain changes that never reach secondary servers. Restoring an older copy of a zone file over a newer one produced the first, and reloading a rewritten zone file whose serial had not changed produced the second:
zone ccna.example/IN: zone serial (2026113001/2026113002) has gone backwards
zone ccna.example/IN: zone serial (2026113001) unchanged. zone may fail to transfer to secondaries.
A primary server loads the new file either way, which is why everything seems fine when you test against it. Secondaries copy the zone only when the serial goes up, so they keep serving the old records until someone notices that half the lookups disagree. Raise the serial on every edit, and the date format used here (YYYYMMDD plus a two-digit change number) makes the next value obvious.
Practice DNS record troubleshooting
The drill below uses the same six record types, with real dig output in several questions. Each answer is explained:
CCNA practice: Domain 4: Network Services and Security
10 questions drawn fresh from 130 in the bank, with the answer and explanation after each one.
Start 10 questionsDiagnosing DNS record problems is one of the topics added to the Network Services and Security domain of the Cisco CCNA 200-301 v2.0 exam, which replaces v1.1 on 3 February 2027. The Domain 4 practice test covers the rest of that domain. To run DNS on the router itself instead of on a server, see the Cisco DNS server lab, and the CCNA command cheat sheet lists the router’s name resolution commands with the rest. The whole course, in order, is in the CCNA 200-301 study guide.
Match the symptom to the record
Start from what the user reports, not from the zone file. The symptom usually narrows the search to one record type before you open anything:
| Symptom | Check first | Command |
|---|---|---|
| Works by IP address, fails by name | A or AAAA for the name | dig @server name A and AAAA |
| Fails on IPv6 clients only | AAAA record | dig @server name AAAA |
| Server answers correctly, one client still fails | The client’s cache | show hosts, clear host |
| NXDOMAIN for an alias that exists in the zone | CNAME target and its trailing dot | dig @server alias |
| Inbound mail fails, web works | MX target and its A record | dig @server domain MX, then the target |
| Traceroute and logs show addresses only | PTR in the reverse zone | dig @server -x address |
| Every name in the domain fails with SERVFAIL | The zone failed to load (NS, syntax) | named-checkzone, the named log |
| Some clients get old answers for days | Serial not raised, secondaries stale | dig @each-server domain SOA |
Most of these come back to two habits: query the authoritative server directly before you trust what any client says, and run named-checkzone on every edit. The trailing dot and the stale AAAA record pass that check, though, so read the answer as well as the status.