The DNS protocol is used to resolve FQDN (Fully Qualified Domain Names) to IP addresses worldwide. This allows us to successfully find and connect to Internet websites and services no matter where they are. Its usefulness, however, doesn’t stop there: local company and private networks also rely on DNS to operate efficiently and correctly.
In this example we’d like to enable the DNS Service so our workstations can properly resolve Internet domains but also local network names.
First step is to enable the DNS service and domain lookup on the router:
R1# configure terminal
R1(config)# ip dns server
R1(config)# ip domain-lookup
Next, we need to configure the router with a public name-server, this will force the router to perform recursive DNS lookups, in other words, for every request it receives from our workstations the router will try to find the answer by asking as many DNS servers it needs, and finally return with an answer:
R1(config)# ip name-server 18.104.22.168
R1(config)# ip name-server 22.214.171.124
The Cisco IOS will allow you to enter up to 6 different name servers (essentially DNS servers). Usually you would use your ISP’s DNS server to ensure you have quick responses, then place a few free public DNS servers such as the ones above. This will ensure that you’ll get a DNS response from either your ISP or public DNS servers.
Next step is to configure your DNS server with the host names of your local network, this way when Alan’s PC trys to ping or connect to Wayne, the router will successfully resolve its netbios name to the appropriate IP address:
R1(config)# ip host ny 192.168.1.50
R1(config)# ip host california 192.168.1.60
R1(config)# ip host zurch 192.168.1.70
If you now try to ping ‘ny’ directly from your router’s CLI prompt, you should receive an answer:
R1# ping ny
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.12, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
At this point, you can configure your workstations to use your router’s IP address as the primary DNS server.