Domain 4IP ServicesCORE

Domain Name System (DNS)

Understanding and configuring the Domain Name System (DNS) for hostname-to-IP address resolution, including A and AAAA records.

Domain: Domain 4: IP Services•Updated: 2026-08-26
#DNS#Name Resolution#A Record#AAAA Record#FQDN

Domain Name System (DNS)

Purpose and Basic Functions

  • Concept: DNS is a protocol used to resolve human-readable domain names (e.g., youtube.com) into machine-readable IP addresses (IPv4 or IPv6).
  • Role in Network: Exam topic 4.3 requires understanding the role of DHCP and DNS. DHCP dynamically assigns IP parameters (including the DNS server address) to clients, while DNS performs the name-to-IP resolution.
  • Router Role: In most networks, routers simply forward DNS packets like any other traffic. No DNS configuration is required on a router for it to forward DNS queries and responses between clients and external DNS servers.

DNS Records

DNS uses specific record types to map names to addresses or aliases.

Record Type Name Purpose Example Output
A Address Maps a hostname to an IPv4 address. A youtube.com 172.217.25.110
AAAA Quadruple-A Maps a hostname to an IPv6 address. AAAA youtube.com 2607:f8b0::
CNAME Canonical Name Maps an alias name to another true domain name. CNAME www youtube.com

Things to note: A CNAME record points to another name, not directly to an IP address. The client must perform a subsequent lookup for the target name to get the final A or AAAA record.

Protocols and Ports

  • Port Number: DNS uses Port 53 for both TCP and UDP.
  • UDP (User Datagram Protocol): Used for standard DNS queries and responses. It is connectionless and fast.
  • TCP (Transmission Control Protocol): Used for DNS messages greater than 512 bytes (e.g., large responses or DNS zone transfers).
  • Common Misconception: Standard DNS queries do not establish a TCP connection. They use UDP. HTTP (Port 80) or HTTPS (Port 443) will establish the TCP connection after DNS resolution is complete.

Name Resolution Flow

sequenceDiagram
    participant PC as Client PC
    participant R1 as Router (DNS Server/Forwarder)
    participant ExtDNS as External DNS (8.8.8.8)
    participant Web as Web Server

    PC->>R1: 1. DNS Query (UDP 53) for "youtube.com"
    alt R1 has local host entry
        R1-->>PC: 2a. DNS Response with IP
    else R1 does not have entry
        R1->>ExtDNS: 2b. Forward DNS Query (UDP 53)
        ExtDNS-->>R1: 3b. DNS Response with IP
        R1-->>PC: 4b. DNS Response with IP
    end
    PC->>Web: 5. HTTP Request (TCP 80) to resolved IP
    Web-->>PC: 6. HTTP Response

Windows Client Commands

End hosts maintain a local DNS cache and a static hosts file to reduce unnecessary DNS queries. The hosts file is checked before querying a DNS server.

# Display all IP parameters, including the configured DNS server
C:\> ipconfig /all

# Query a specific DNS server for a hostname's IP address
C:\> nslookup youtube.com

# Display the local DNS resolver cache
C:\> ipconfig /displaydns

# Clear the local DNS resolver cache
C:\> ipconfig /flushdns

Things to note: The Windows hosts file is located at C:\Windows\System32\drivers\etc\hosts. It allows manual, static name-to-IP mapping without a DNS server.

Cisco IOS DNS Configuration

While rare in production, a Cisco router can be configured as a DNS server, a DNS client, or both.

Configuring a Router as a DNS Server

Router(config)# ip dns server
! Enables the router to respond to DNS queries from clients

Router(config)# ip host PC1 192.168.1.10
! Creates a static local host table entry (Name to IP mapping)

Router(config)# ip name-server 8.8.8.8
! Configures an external DNS server for the router to query if it lacks a local record

Configuring a Router as a DNS Client

Router(config)# ip domain-lookup
! Enables DNS queries on the router (Enabled by default). 
! Note: Older IOS versions use 'ip domain-lookup' (with hyphen), modern uses 'ip domain lookup'. Both work.

Router(config)# ip name-server 8.8.8.8
! Tells the router which external DNS server to use for its own lookups (e.g., when you type 'ping youtube.com')

Router(config)# ip domain-name jeremysitlab.com
! Appends this default domain to unqualified hostnames. 
! Example: 'ping PC1' becomes 'ping PC1.jeremysitlab.com'. Required for generating RSA keys for SSH.

Verification

Router# show hosts

Things to note: The show hosts command displays both manually configured static entries (Flags: permanent) and dynamically learned cached entries from external DNS servers (Flags: temp). Temporary entries will expire and must be re-learned.

Exam Insights & Common Pitfalls

  • Forwarding vs. Serving: If a PC is configured to use 8.8.8.8 as its DNS server, the intermediate router (e.g., R1) requires zero DNS configuration. It simply routes the UDP 53 packets.
  • TCP vs. UDP: If an exam question states a host is resolving a name for the first time, it uses UDP, not TCP, to query the DNS server. TCP is only used if the response exceeds 512 bytes.
  • Hosts File Precedence: A local hosts file or local DNS cache is always checked before sending a query across the network.
  • DHCP Integration: Hosts typically learn their DNS server address automatically via DHCP (Dynamic Host Configuration Protocol), not manually.

Command Summary Reference

Windows Command Prompt

ipconfig /all             # View IP parameters and configured DNS server
nslookup <hostname>       # Manually query DNS server for a hostname
ipconfig /displaydns      # View local DNS cache
ipconfig /flushdns        # Clear local DNS cache

Cisco IOS Global Configuration

ip dns server             # Enable router to act as a DNS server
ip host <name> <ip>       # Create static local hostname-to-IP mapping
ip name-server <ip>       # Define external DNS server for router to query
ip domain-lookup          # Enable DNS queries on router (default: enabled)
ip domain lookup          # Modern alternative to 'ip domain-lookup'
ip domain-name <name>     # Set default domain appended to unqualified hostnames

Cisco IOS Privileged EXEC

show hosts                # View static host table and dynamic DNS cache entries