Enabling DNS Lookups on Cisco Devices

KB ID 0000969 

Problem

For the most part, devices are more concerned with IP and MAC addresses, but the devices do have the ability to translate those IP addresses using DNS.

Cisco DNS Lookups

Solution

How to Enable DNS Lookups on Cisco ASA5500

As ASA is ‘My Thing’ I will start with that.

1. Connect to the ASA, log in and go to enable mode, and then global configuration mode.

Type help or '?' for a list of available commands.
PetesASA> enable
Password: **********
PetesASA# configure terminal

2. Now if you have corporate DNS server on your LAN you might prefer to use those, so you would use ‘inside’ as opposed to ‘outside’. (Note: Your interfaces might not have these names, let common sense prevail).

PetesASA(config)# dns domain-lookup outside

3. There are two ways to specify the actual DNS servers I’ll show both, though I suggest in future versions, only the second way will work!

The Original Way

PetesASA(config)# dns name-server 4.2.2.2 8.8.8.8
PetesASA(config)# exit
The New Way

PeteASA(config)# dns server-group DefaultDNS
PeteASA(config-dns-server-group)# name-server 4.2.2.2
PeteASA(config-dns-server-group)# name-server 8.8.8.8
PeteASA(config-dns-server-group)# exit

4. To test it, simply ping a hostname and see if it works.

PetesASA# ping www.google.com
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 173.194.34.83, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/20/20 ms
PetesASA#

5. Save the changes.

PetesASA# write mem
Building configuration...
Cryptochecksum: ac21d44c 109662c4 66495572 e5a106c7

49756 bytes copied in 3.540 secs (16585 bytes/sec)
[OK]
PetesASA#

 

How to Enable DNS Lookups on Cisco IOS Device

Below I’ll setup DNS lookups on a Cisco Router, but the process is the same for a Catalyst switch.

1. Connect to the device, log in and go to enable mode, and then global configuration mode. By default DNS lookups are enabled, (you would disable with a no ip domain-lookup command). But let’s make sure.

PetesRouter#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
PetesRouter(config)#ip domain-lookup

2. Now specify the DNS server you want to use.

PetesRouter(config)#ip name-server 4.2.2.2
PetesRouter(config)#ip name-server 8.8.8.8
PetesRouter(config)#exit
PetesRouter#
*Jul 17 18:17:26.099: %SYS-5-CONFIG_I: Configured from console by console

3. To test it, simply ping a hostname and see if it works.

PetesRouter#ping www.google.com 

 

Translating "www.google.com"...domain server (4.2.2.2) [OK]

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 173.194.34.84, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/28/36 ms

4. Save the changes.

PetesRouter#write mem
Building configuration...
[OK]
PetesRouter#

 

Related Articles, References, Credits, or External Links

NA

Author: Migrated

Share This Post On