Useful Articles

25/recent/ticker-posts

How to configure Router as DNS Server

How to Configure Router as DNS Server

 
Domain Name System (DNS) is used to resolve website names (or host-names) example www.testdomain.com into IP addresses 90.1.1.1. This article guides you how to configure a Router as DNS server.

Importance and requirement of DNS

Let's discuss a network issue to understand the importance of DNS. 

You are a Network Engineer in an organization and a customer reports an issue about dis-connectivity to a destination server. To begin troubleshooting, you would ask the customer some initial information helpful to resolve the issue. For example, Source Subnet/IP from which the customer is experiencing the issue. Destination IP of the server which is unreachable.

You would definitely need important info i.e. destination server IP of the server for which issue is reported otherwise you cannot troubleshoot the issue.

Same is the case while you browse a website on the internet.


Each website/server/URL hosted on the internet has a public IP and it is your destination IP which you want to reach.

While you browse a website/mail server on the internet, you don't generally put an IP address in the URL. You only write the URL name for example "www.testdomain.com". This is because you don't generally remember the IP address for this URL or website.

There are millions of similar URLs/organizations on the internet and you cannot remember IP addresses of all.

DNS is a service that acts as a go-between/middleman that helps to resolve the Hostnames to IP addresses.

In this article we will understand how to configure a Cisco router as a DNS server for lab simulations.
 
 

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?"

How to configure a router as DNS Server
  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:

Configure a Router as DNS Server, DNS Query


DNS Response Message:

Configure a Router as DNS Server, DNS Response

 

For Further Reading