Configure DNS Server On A Cisco Router

A Domain Name server is used to resolve Fully Qualified Domain Name to IP address. DNS uses both TCP and UDP Port 53 to resolve the DNS queries. The most frequently used port for DNS is UDP 53. To access websites on the internet, the domain must be resolved by DNS Server.

In most cases, local DNS servers are not available so End-user uses ISP DNS servers to resolve the DNS queries. In most small and medium-size enterprises DNS is configured on a Cisco Router. DNS server on Cisco router provides complete control to Network administrator over internet access.

This article will help you to understand, how to configure DNS Server on a Cisco Router. You can use DNS service for your network, and make all end-users machines (clients) use the Router as a DNS server. We will show step by step process to configure a DNS server on a Cisco router.

Below Scenario Consist an example of DNS Server on a Cisco Router

In Below Scenario, We will configure DNS server on Cisco Router. Where Workstations will be configured to use Cisco Router DNS Service to access Internet Websites and Local File Server.

configure domain name server on cisco router

To configure DNS server on a Cisco router, First step is to enable DNS service and Domain Lookup on the router.

R1# configure terminal
R1(config)# ip dns server
R1(config)# ip domain-lookup

DNS servers work as a chain on the internet, to perform recursive DNS lookups we need to configure the router with a public name-server. Whenever the router receives DNS requests to resolve the FQDN, it will try to find the answer by asking as many DNS servers and once it will get the required result, it will return with an answer.

R1(config)# ip name-server 4.2.2.5
R1(config)# ip name-server 4.2.2.6

You can configure a few free Public DNS servers in cisco router eg. Google DNS server, Microsoft DNS Server, etc. and your ISP DNS server to get a prompt response. This will ensure that you’ll get a DNS response from either your ISP or public DNS servers.

The next step is to configure your DNS server with the static hostnames of your local network, this way when Alan’s PC tries to ping or connect to Wayne, the router will successfully resolve its netbios name to the appropriate IP address:

R1(config)# ip host alan 192.168.1.10
R1(config)# ip host john 192.168.1.11
R1(config)# ip host wayne 192.168.1.12

If you now try to ping ‘wayne’ directly from your router’s CLI prompt, you should receive an answer:

R1# ping wayne
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.12, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms

At this point, you can configure your workstations to use your router’s IP address as the primary DNS server:

We have shown how the Cisco router can play a role as DNS server and can resolve and respond to the DNS queries for Local and Internet network.

Leave a Comment