DNS 101

Defining hosts and domains locally

To define a static host name to address mapping, use the following command:
1
R(config)# ip host NAME [TELNET-PORT] ADDRESS
Copied!
For hosts that are accessed without a domain name at the end, (hostname.domain-name), you can define a default domain name or a list of domain names to be used, using one of the following commands:
1
R(config)# ip domain name DOMAIN
2
R(config)# ip domain list DOMAIN
3
! Domain list is preferred over domain name.
Copied!

Using a DNS Server

To define a DNS server and make the router work as a DNS client, use:
1
R(config)# ip name-server SERVER1 [SERVER2 ...]
Copied!
The local mappings will be used first, and if there is no match, the name-server will be queried.
For DNS lookups you can define:
1
R(config)# ip domain timeout SEC
2
R(config)# ip domain retry NUMBER
Copied!
By default, if there are multiple DNS servers defined, the first one will be used by default, while the other servers will only be used in case of failure of the previous servers. For one host a router can have multiple IP addresses that it is resolved to. By default, only the first one is used. You can use each IP address in a round-robin fashion if you enable
1
R(config)# ip domain round-robin
Copied!
To see the current dns cache, use:
1
R# show ip hosts
Copied!
Of course, lookups can be disabled altogether, using:
1
R(config)# no ip domain-lookup
Copied!

Making the router a DNS Server

To configure the router as a server, use:
1
R(config)# ip dns server
Copied!
The router will respond to DNS requests with data from its statically configured hosts or from the responses cached from the other DNS servers.
DNS Spoofing is an option that is enabled only if the domain lookups are disabled, if no name servers are configured, or if there is no route to them. The router will respond to all DNS requests with the configured IP or with the interface IP:
1
R(config)# ip dns spoofing [IP-ADDRESS]
Copied!
Last modified 7mo ago