DNS is an application layer protocol used to resolve hostnames to IP addresses. If you have a DNS server on your network, you can configure your Cisco device to use it for name resolution. Here are the steps:
- (Optional) If you’ve previously disabled DNS lookups on your device, re-enable it with the ip domain-lookup command.
- Specify the IP address of the DNS server using the ip name-server command. It is possible to specify up to six DNS servers.
- (Optional) Specify the domain name to append to the hostname you type in by using the ip domain-name command.
Here is an example configuration:
Floor1(config)#ip name-server 192.168.0.100
In the output above you can see that I’ve specified the IP address of my DNS server (192.168.0.100). Let’s say that the DNS server contains a record for a server called fileshare. I can try to ping that host using its hostname to verify that the name resolution process is indeed working:
Floor1#ping fileshare Translating "fileshare"...domain server (192.168.0.100) Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.0.110, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/1 ms
As you can see from the output above, the hostname fileshare was translated to the IP address of 192.168.0.110.