Configure DNS on a Cisco device

DNS is used to resolve hostnames to IP addresses. If you have a DNS server on your network, you can configure your Cisco IOS device to use it for name resolution. Here are the steps:

1. (Optional) If you’ve previously disabled DNS lookups on your device, you need to re-enable it with the ip domain-lookup command.

2. Specify the IP address of your DNS server by using the ip name-server command. You can specify up to six DNS servers.

3. (Optional) Specify the domain name to append to the hostname you type in by using the ip domain-name command.

configure dns ios

In the picture above you can see that we’ve specified the IP address of our DNS server. Let’s try to ping a host named fileshare using its hostname:

ping dns hostname

You can see that the other device has responded, which means that the name resolution was successful.

Geek University 2022