Thursday, March 17, 2011

Configure Cisco Router as Caching/Forwarding DNS Server

A Cisco Router running Cisco IOS can function as a Caching or Forwarding DNS Server which answers to DNS queries from clients either from its host table or cache or forward it to a DNS server which can respond to the query.

This feature can come in handy in small network environments where the router can act as a Caching DNS server forwarding queries to the ISPs DNS servers or infact any external DNS servers. Also, makes sense using on under utilized DNS servers.

NOTE: This feature can have an impact on the available resource on the Cisco Router and hence plan according to the network size and ofcourse the router itself.

Enable DNS Translations
From the global Configuration mode, enable the DNS server.
ciscrouter# conf term
ciscorouter(config)# ip domain lookup
Add the Name Servers
Add the name servers to which the Cisco Router will forward the queries, if it can't answer from its host table or cache. You can specify upto 6 Namservers in a single command (seperated by a "SPACE") or specifiy one Name-server per command for legibility.
ciscorouter(config)# ip name-server 192.168.1.1 192.168.2.1
Add Hosts (optional)
Add host entries to the host table manually, if required
ciscorouter(config)# ip host webserver 10.1.1.100
In the above, the IP address 10.1.1.100 is mapped to the hostname "webserver"

Set Default Domain Name(s)
Optionally, add a domain name or a list of domain names that the Cisco Router can use to append to a unqualified hostname. Using a list is useful where the router tries to try one domain name at a time until it finds a match.

To set a single domain name
ciscorouter(config)# ip domain name example.com
To set a list of Domain names
ciscorouter(config)# ip domain list example.com
ciscorouter(config)# ip domain list test.com
ciscorouter(config)# ip domain list myowndomain.com
Set Domain Lookup Timeout (optional)
Optionally, you can set the timeout in seconds for the Cisco router to wait for a resonse to a DNS query. The default is 3 seconds
ciscorouter(config)# ip domain timeout 5
Set Domain Lookup Retry (optional)
Again optional, you can set the number of retry attempts for the DNS queries. Default is "2" times
ciscorouter(config)# ip domain retry 5
Enable DNS Round Robin (optional)
If there are hosts with load balancing enabled and having more than 1 host (example, 10.1.1.101, 10.1.1.102,10.1.1.103 are all pointing to a host, "dbserver") it makes sense to enable the DNS RoundRobin feature to rotate among the hosts else the 1st cached hosts will only be picked up causing load issues on that particular hosts
ciscorouter(config)# ip host dbserver 10.1.1.101 10.1.1.102 10.1.1.103
ciscorouter(config) ip domain round-robin

No comments:

Post a Comment