How to configure a Cisco router to be a DNS server
- Posted by DIY Chris
- On May 13, 2020
- 0 Comments
- cisco, cisco dns, cisco router, dns, dns cisco, dns server, nslookup, server
This is probably not something you’ll want to do in a large scale enterprise environment.. let routers be routers.. but for that one off situation where you just need a DNS server and its more convenient than spinning up new hardware to handle a few host entries then this is the perfect solution.
First things first. Connect to your Cisco router by whatever means you have available to you.
Once you’re connected we will need to enable domain lookup
R1# configure terminal R1(config)# ip dns server R1(config)# ip domain-lookup
Next, we will need to configure the router with a public name server, this will be necessary so that the router can perform recursive lookups for when a workstation requests a DNS lookup that is not part of the routers DNS hosts it will use those name servers we specify here. I’ll just use Google’s name servers, they have served me well so far.
R1(config)# ip name-server 22.214.171.124 R1(config)# ip name-server 126.96.36.199
If you’re curious, the IOS will allow for up to 6 name servers to be specified. Now we can add some hosts
R1(config)# ip host chris 10.1.1.80 R1(config)# ip host donna 10.1.1.81 R1(config)# ip host hailey 10.1.1.82
The only thing left to do on the workstation side of things is to set the DNS server of the workstation to your router’s inside IP address and then you should be able to ping chris and you should get a reply from the router with the IP address 10.1.1.80
Hopefully this was able to help someone.