The Cisco router can provide many services other than what is considered traditional for this type of device. This article will focus on the (limited featured) dns server implementation in the Cisco IOS. In this example, we will configure a router on the network as the primary dns server for the expresslearn.com domain. We will then configure the other routers in the network to use this primary dns server for name resolution. This will allow all the network devices to know each other by name – without having to involve those server admins!
<!–adsense#inlinepostad–>
There are three routers in the network, with one being the primary dns server. The other two routers are configured to use the primary for name resolution:
hostname LanRouter ! ip host lanrouter.expresslearn.com 10.0.1.1 ip host wanrouter.expresslearn.com 10.0.1.2 ip host branchrouter.expresslearn.com 10.0.2.1 ! ip dns server ip dns primary expresslearn.com soa lanrouter.expresslearn.com (continued...) admin@expresslearn.com 21600 900 7776000 86400
hostname WanRouter ! ip domain name expresslearn.com ip name-server 10.0.1.1
hostname BranchRouter ! ip domain name expresslearn.com ip name-server 10.0.1.1
BranchRouter#ping lanrouter.expresslearn.com Translating "lanrouter.expresslearn.com"...domain server (10.0.1.1) [OK] Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 144/144/148 ms
BranchRouter#ping wanrouter Translating "wanrouter"...domain server (10.0.1.1) [OK] Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.1.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 48/76/120 ms BranchRouter#
As you can see, the BranchRouter can now refer to the other two routers by name. You may have noticed the omission of the domain name when pinging the wanrouter. This works because the BranchRouter automatically appended it’s configured domain name to the supplied hostname.
If you would like the IOS DNS server to forward resolution requests containing other domain names, add the additional configuration statement on the router configured as the dns server.
LanRouter(config)#ip name-server <valid dns server ip address>
Without the above statement, resolution requests for other domains will be dropped on the server and the query will timeout on the client:
BranchRouter#ping www.google.com Translating "www.google.com"...domain server (10.0.1.1) % Unrecognized host or address, or protocol not running.


Print This Post







April 18th, 2008 at 7:32 am
This is pretty cool. I would have never thought to use a router as a DNS server.
I’ve seen IT shops that don’t put the IPs of their network gear in DNS to hide it from the world, but using a router as a DNS server on network-only management servers (and other network gear) might be a valid solution.