To define a static host name to address mapping, use the following command:
R(config)# ip host NAME [TELNET-PORT] ADDRESS
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:
R(config)# ip domain name DOMAIN
R(config)# ip domain list DOMAIN
! Domain list is preferred over domain name.
To define a DNS server and make the router work as a DNS client, use:
R(config)# ip name-server SERVER1 [SERVER2 ...]
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:
R(config)# ip domain timeout SEC
R(config)# ip domain retry NUMBER
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
R(config)# ip domain round-robin
To see the current dns cache, use:
R# show ip hosts
Of course, lookups can be disabled altogether, using:
R(config)# no ip domain-lookup
To configure the router as a server, use:
R(config)# ip dns server
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:
R(config)# ip dns spoofing [IP-ADDRESS]