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 "www.yahoo.com" to IP 60.60.60.6.

To have a thorough understanding of DNS, kindly read the article "How DNS Works?"
  1. User PC  pings "www.yahoo.com" 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 (3.3.3.3) 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 (3.3.3.3).

DNS-Server(config)#ip dns server
DNS-Server(config)#ip host www.yahoo.com 60.60.60.6
DNS-Server(config)#ip name-server 3.3.3.3

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

PC1#ping www.yahoo.com
Translating "www.yahoo.com"...domain server (3.3.3.3) [OK]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 60.60.60.6, 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: