How to Configure a Router as DNS Server

Below are the steps to configure a Cisco Router as a DNS server. 

Using below topology we'll try to simulate the DNS working mechanism.

The aim is to resolve the domain name "" to IP

To have a thorough understanding of DNS, kindly read the article "How DNS Works?"
  1. User PC  pings "" from user PC. The user PC doesn't have a DNS record entry in its local cache.
  2. User PC generates a "DNS Query" message for Hostname to IP resolution to the DNS server and the DNS server ( responds with the Response Message.
  3.  DNS server sends a "DNS Response" message with IP address details of the domain requested.

Configuration for DNS server (

DNS-Server(config)#ip dns server
DNS-Server(config)#ip host
DNS-Server(config)#ip name-server

Configuration for Router R2.
R2(config)#ip name-server
Now when you ping from the User PC.

Translating ""...domain server ( [OK]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 156/196/236 ms

DNS Query Message:

DNS Response Message: