How to Configure a Cisco Router as a DNS Server?

Domain Name System or DNS is considered as the phonebook of the Internet. DNS servers resolve domain names to IP addresses. Google Public DNS ( and is an example of free DNS services and can replace your ISP’s default DNS server addresses.

dns server

Configuring Cisco Routers as DNS Servers

A Cisco router can act as both a Domain Name System cache name server (DNS resolver) and as an authoritative name server for local hosts. The cache name server stores the DNS queries so that it can answer requests quickly without having to query authoritative servers for each transaction.

1. Using the sample network topology above, let’s configure the IP address first on each device.

Cisco Router (DNS) –

DNS(config)#interface GigabitEthernet0/0
DNS(config-if)#ip address


Server (dnstest.lab) –

 eth0      Link encap:Ethernet  HWaddr 00:50:00:00:06:00
           inet addr:  Bcast:  Mask:
           RX packets:136 errors:0 dropped:0 overruns:0 frame:0
           TX packets:183 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:12343 (12.0 KiB)  TX bytes:52120 (50.8 KiB)


PC1 – IP address, Mask /24, Gateway
Primary DNS Server –
Let’s leave the secondary DNS server blank.

dns client


2. Enable DNS service in global configure mode on our Cisco router.

DNS(config)#ip dns server


3. Configure the Domain Name System server with the hostname of your local hosts. In this case, when any other PC wants to ping the ‘dnstest.lab’ server, the router will resolve its domain name to the appropriate IP address.

DNS(config)#ip host dnstest.lab


Domain Name System Server Verification

From the Cisco router, I can ping the domain name.

DNS#ping dnstest.lab
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 = 2/3/4 ms


From PC1, I can ping the domain name.

C:\Users\PC1>ping dnstest.lab

Pinging dnstest.lab [] with 32 bytes of data:
Reply from bytes=32 time=9ms TTL=64
Reply from bytes=32 time=2ms TTL=64
Reply from bytes=32 time=2ms TTL=64
Reply from bytes=32 time=3ms TTL=64

Ping statistics for
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 2, Maximum = 9ms, Average = 4ms


Also, I can access the web page from PC1.

dns - web server

Switching DNS servers and finding the best DNS server in your area can also increase your Internet speed or provide you with more features like privacy, parental controls, and high redundancy.

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: