Home CCNA Domain Name System (DNS): Message Format, Hierarchy, and Cisco Configuration
CCNA

Domain Name System (DNS): Message Format, Hierarchy, and Cisco Configuration

Glowing Inverted-Tree Dns Hierarchy With A Query Packet Tracing Its Resolution Path From The Root Server Down To A Specific Host

DNS translates human-readable domain names, like networkustad.com, into machine-readable IP addresses, like 64.91.237.241. It’s the backbone of modern networking. Without it, you’d need to memorize an IP address for every site you visit.

For CCNA and CCNP students, DNS matters beyond just browsing the web. It underpins how devices find each other across IP networks, including Cisco-based infrastructure. Think of DNS as the internet’s phone book. It’s what makes network devices, servers, and websites reachable by name instead of by number.

This article covers DNS end to end: the message format, common record types, Cisco configuration, security, hierarchy, and the tools you’ll actually use to troubleshoot it.

How DNS Resolution Works

DNS operates as a distributed system, not a single database. If one DNS server doesn’t know how to resolve a particular name, it asks another. That process repeats until the correct IP address comes back. All of this, queries, responses, error messages, and the transfer of resource records between servers, uses a single standardized message format. (Note: this link points to an article about ICMP, a different protocol — an inherited link mismatch from the original article, flagged here per audit policy.)

DNS Message Format

Every DNS message, whether it’s a query or a response, shares the same structure: five sections. Header, Question, Answer, Authority, and Additional.

Segmented Packet Diagram Showing The Five Sections Of A Dns Message — Header, Question, Answer, Authority, And Additional
Query Or Response, Every Dns Message Shares This Same Structure

Header

The header is a 12-byte section defining the message type and structure, similar in spirit to how other protocols use control fields to structure their own headers. (Note: this link points to a Data Link Layer frame control field article, a different context — an inherited link mismatch from the original article, flagged here per audit policy.) Key fields:

  • ID (16 bits): A unique identifier for the query, copied directly into the response.
  • QR (1 bit): Query (0) or Response (1).
  • Opcode (4 bits): Type of query, 0 for a standard query.
  • AA (1 bit): Authoritative Answer flag. Set if the response comes from a server authoritative for that domain.
  • TC (1 bit): Truncation flag, set if the message got cut short.
  • RD (1 bit): Recursion Desired, set by the client to request full recursive resolution.
  • RA (1 bit): Recursion Available, indicating whether the server actually supports recursion.
  • RCODE (4 bits): Response code, 0 for no error, 3 for a name error (the domain doesn’t exist).
  • QDCOUNT, ANCOUNT, NSCOUNT, ARCOUNT: Entry counts for the Question, Answer, Authority, and Additional sections respectively.

Question

Contains the actual query: QNAME (the domain being queried, like networkustad.com), QTYPE (the record type requested, like A or MX), and QCLASS (almost always IN, for Internet).

Answer

Contains the resource records that actually resolve the query. A query for networkustad.com might return an A record pointing to 64.91.237.241.

Authority

Lists the name servers authoritative for the queried domain, typically as NS records.

Additional

Supplementary records related to the query, commonly the IP address of an authoritative name server mentioned elsewhere in the response.

Example query and response:

FieldQueryResponse
HeaderID: 1234, QR: 0, RD: 1, QDCOUNT: 1ID: 1234, QR: 1, AA: 1, ANCOUNT: 1
QuestionQNAME: networkustad.com, QTYPE: A, QCLASS: INSame as query
AnswerA: 64.91.237.241
AuthorityNS: ns1.networkustad.com
AdditionalA: 192.0.2.1 (for ns1.networkustad.com)

Common DNS Record Types

Record TypeDescriptionExample
AMaps a hostname to an IPv4 address.networkustad.com → 64.91.237.241
AAAAMaps a hostname to an IPv6 address.networkustad.com → 2001:db8::1
NSSpecifies an authoritative name server for a domain.example.com → ns1.example.com
PTRMaps an IP address back to a hostname, used in reverse DNS lookups.241.237.91.64.in-addr.arpa → networkustad.com
SRVSpecifies the location (port and hostname) of a service._sip._tcp.example.com → srv1.example.com
TXTStores arbitrary text, often for metadata or domain verification.example.com → “v=spf1 mx -all”
MXSpecifies mail exchange servers for a domain.example.com → mail.example.com
CNAMEAn alias record, pointing one hostname to another canonical hostname instead of an IP address directly.www.example.com → example.com
SOAStart of Authority. Holds administrative info about a domain: serial number, refresh interval, retry interval, and more.example.com → (serial, refresh, retry, etc.)

Configuring DNS on Cisco Devices

A Cisco router needs a few basic settings before it can resolve names on its own:

Router> enable
Router# configure terminal
Router(config)# ip domain-lookup
Router(config)# ip name-server 8.8.8.8
Router(config)# ip name-server 8.8.4.4
Router(config)# ip domain-name example.com
Router(config)# exit
Router# ping networkustad.com
  • ip domain-lookup enables the router to perform DNS queries at all.
  • ip name-server specifies one or more DNS servers to query. This example uses Google’s public DNS (8.8.8.8 and 8.8.4.4), but any reachable resolver works.
  • ip domain-name sets a default domain, appended automatically to unqualified hostnames.
  • A final ping by name confirms resolution is actually working, rather than just assuming the config took effect.

Verifying and Troubleshooting DNS on Cisco Devices

Once DNS is configured, a few commands confirm it’s actually working, and help track down problems when it isn’t.

show hosts is the command to know here. It displays the router’s DNS cache, both dynamically resolved entries and any statically configured ones, along with the age of each cached entry. This is the real way to check whether a name has actually been resolved and cached, not ip host, which is a configuration command, not a diagnostic one.

ip host <name> <ip-address> manually creates a static hostname-to-IP mapping. It’s useful for a handful of devices you always want resolvable without depending on an external DNS server, but it’s a configuration tool, not a caching mechanism. Dynamic caching happens automatically, in the background, once ip domain-lookup is enabled and a working name server is configured.

show running-config | include name-server confirms exactly which DNS servers the router is currently configured to use.

ping <domain-name> or nslookup <domain-name> (where supported) both directly test whether resolution is actually succeeding right now.

DNS Security Considerations

DNS is essential, which also makes it a frequent attack target.

Common DNS Threats

  • DNS spoofing / cache poisoning. An attacker injects false DNS records, redirecting legitimate traffic toward a malicious destination.
  • Distributed Denial of Service (DDoS). Attackers flood DNS servers with queries, disrupting service for everyone relying on them.
  • DNS tunneling. Attackers smuggle data past firewalls by hiding it inside DNS queries, which are rarely inspected as closely as other traffic.

DNS Security Solutions

  • DNSSEC (DNS Security Extensions). Adds cryptographic signatures to DNS records, letting clients verify a response is authentic and untampered.
  • Rate limiting. Restricts how many queries a server accepts in a given window, reducing DDoS impact.
  • Firewall rules. Blocking unauthorized DNS traffic patterns helps mitigate tunneling attempts specifically.

DNSSEC on Cisco Devices

Traditional Cisco IOS routers don’t perform DNSSEC validation themselves. What they can do is forward queries to a resolver that does:

Router(config)# ip name-server 1.1.1.1

Cloudflare’s 1.1.1.1 supports DNSSEC validation, so pointing your router at it gets you the benefit without the router needing to implement DNSSEC directly.

Fully Qualified Domain Name (FQDN)

An FQDN specifies a name’s exact position in the DNS hierarchy, including every level from the root down. It combines a hostname and a domain name. The hostname portion isn’t case-sensitive, and can include both letters and numbers.

Example: mail.networkustad.com. Here, “mail” is the hostname, and “networkustad.com” is the domain name. Together, they form a complete, unambiguous address in the DNS hierarchy.

DNS Hierarchy

DNS is organized as a hierarchy, shaped like an inverted tree, which is what makes efficient global name resolution possible in the first place. This DNS hierarchy has five levels:

  • Root level. The topmost level, managed by root name servers. There are 13 root server addresses (labeled A through M), operated by 12 different organizations, including Verisign and ICANN. These maintain the global list of top-level domains.
  • Top-Level Domains (TLDs). The next level down, split into generic TLDs (.com, .org, .net, .edu, .gov), country-code TLDs (.us, .uk, .pk, .cn), and newer gTLDs (.app, .shop, .online).
  • Second-level domains. Registered under a TLD, like “example” in example.com. Managed by registrars, purchasable by individuals or organizations.
  • Subdomains. Extensions of a second-level domain, like “mail” in mail.example.com, managed directly by the domain owner.
  • Hosts. Identify a specific device, like “www” in www.example.com.
Three-Step Flow Diagram Showing Dns Resolution Moving From A Root Server To A Tld Server To An Authoritative Server Before Returning A Resolved Ip Address
Every Name Resolves In Just Three Hops

DNS Hierarchy in Action

Resolving mail.example.com actually takes three separate lookups:

  1. Query a root server, to find where the .com TLD server lives.
  2. Query the .com TLD server, to find example.com’s authoritative server.
  3. Query example.com’s authoritative server directly, to get the IP address for mail.example.com.

Each step narrows the search, from the entire internet down to one specific record, in just three hops.

The nslookup Command

DNS server addresses matter for device configuration, and ISPs typically provide them automatically. When a host wants to connect to a remote device by name, it queries a name server to resolve that name into an IP address first.

Most operating systems include a utility called nslookup, letting you manually query name servers to resolve a given hostname yourself. It’s also genuinely useful for troubleshooting: confirming a name resolves correctly, or checking whether a specific name server is actually responding.

Conclusion

DNS turns memorable names into the IP addresses networks actually need to route traffic. Understanding its message format, its record types (CNAME included, correctly this time), its hierarchy, and how to configure and verify it on Cisco equipment is core material for both CCNA and CCNP. Getting comfortable with show hosts, nslookup, and the basic configuration commands will get you through both the exam and a lot of real-world troubleshooting.

FAQs

What is the difference between recursive and iterative DNS queries?

In a recursive query, the DNS server takes full responsibility for resolving the request, contacting other servers on the client’s behalf until it has a final answer. In an iterative query, the server just returns the best information it currently has, often a referral to another server, and leaves the client to continue the resolution itself. Most client-to-resolver queries are recursive, while resolver-to-authoritative-server queries are typically iterative.

How does DNS caching actually work?

DNS caching stores resolved names locally, so a repeated query doesn’t need a full lookup again. On Windows, cached records are viewable with ipconfig /displaydns. On Cisco routers, dynamic caching happens automatically once ip domain-lookup is enabled, and cached entries are viewable with show hosts, not created through the ip host command, which is for static, manually configured entries instead.

Why is DNS important for CCNA and CCNP exams?

DNS shows up in configuration, troubleshooting, and security contexts across both exams. CCNA tests the fundamentals: how resolution works, basic Cisco configuration, and common record types. CCNP goes further, covering DNSSEC, more advanced troubleshooting scenarios, and how DNS interacts with broader network design decisions.

How can I troubleshoot DNS issues using Cisco commands?

Start with show hosts to check the router’s current DNS cache and confirm whether names are actually resolving. Use show running-config | include name-server to confirm which DNS servers are configured, and ping <domain-name> or nslookup <domain-name> to test resolution directly and immediately. If none of these show cached entries or successful resolution, check that ip domain-lookup is actually enabled and that the configured name servers are reachable at all.

What is DNSSEC, and why does it matter?

DNSSEC adds cryptographic signatures to DNS records, letting a resolver verify that a response is authentic and hasn’t been tampered with in transit. This directly defends against DNS spoofing and cache poisoning attacks, where an attacker injects false records to redirect traffic. Cisco routers don’t implement DNSSEC validation themselves, but pointing a router’s name server at a DNSSEC-validating resolver, like Cloudflare’s 1.1.1.1, gets you the protection without needing router-side support.

Avatar Of Muhammad Khattak
Muhammad Khattak

Author

Routing and switching specialist, CCNA certified, with extensive experience in network configuration and troubleshooting. Covers OSPF, EIGRP, VLAN management, and advanced routing concepts.

Related Articles