Enable DNS Lookups on Cisco



Connect to the ASA, log in and go to enable mode, and then global configuration mode.
 
ASA> enable  Password: **********  
ASA# configure terminal
 
If  the DNS server is inside of the LAN, it would be 'inside' instead of 'outside'.
( inside and outside are the name of the interfaces)

ASA(config)# dns domain-lookup outside
 
3. There are two ways to specify the actual DNS servers


a)   ASA(config)# dns name-server 4.2.2.2 8.8.8.8  
      ASA(config)# exit

b) ASA(config)# dns server-group DefaultDNS  
    ASA(config-dns-server-group)# name-server 4.2.2.2  
    ASA(config-dns-server-group)# name-server 8.8.8.8  
    ASA(config-dns-server-group)# exit
4. Ping the hostname to test if it works.
 
    ASA# 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  
 

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.
  
R1(config)#ip domain-lookup
 
2. Now specify the DNS server you want to use.

R1(config)#ip name-server 4.2.2.2  
R1(config)#ip name-server 8.8.8.8  

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

R1#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