Configure Cisco device as DNS client

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:

  1. (Optional) If you’ve previously disabled DNS lookups on your device, re-enable it with the ip domain-lookup command.
  2. Specify the IP address of the DNS server using the ip name-server command. It is possible to 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.


Here is an example configuration:

Floor1(config)#ip name-server

In the output above you can see that I’ve specified the IP address of my DNS server ( 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 (
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to, 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

Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.

We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: