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

Comments

4 responses to “Configure Cisco Router as Caching/Forwarding DNS Server”

  1. Thilan Avatar
    Thilan

    Is there a way to do the round robin in SIP(Session initialization Protocol). ?

    Pls advice

  2. Martin Felipe Avatar
    Martin Felipe

    Here the command to enable the dns server is lost.
    Please don’t forget to enable the server with the CLI command:

    ip dns server

    Regards.

  3. jam Avatar
    jam

    I want to configure cisco router as caching/forwarding dns server. However i do no have the “ip dns server” command. Did someone have the name problem?

  4. roman Avatar
    roman

    ip dns server

Leave a Reply

Your email address will not be published. Required fields are marked *