CLASS="section" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

21.10. DNS Users Tools

The commands listed belows are some that we use often, but many more exist. Check the man pages and documentation for more details and information.

nslookup. The nslookup program allows the user to query Internet domain name servers interactively or non-interactively. In interactive mode the user can query name servers for information about various hosts and domains, and print a list of hosts in a domain. In non-interactive mode the user can just print the name and request information for a host or domain. Interactive mode has a lot of options and commands; it is recommended that you see the man page for nslookup, or the help under nslookup Interactive mode.

To enter under nslookup Interactive mode, use the command:

 [root@deep] /# nslookup
 

 Default Server:  deep.openna.com
 Address:  208.164.186.1

 > help
 $Id: nslookup.help,v 8.4 1996/10/25 18:09:41 vixie Exp $

 Commands:	(identifiers are shown in uppercase, [] means optional)
 NAME	- print info about the host/domain NAME using default server
 NAME1 NAME2	- as above, but use NAME2 as server
 help or ?	- print info on common commands; see nslookup(1) for details
 set OPTION	- set an option
 all	- print options, current server and host
 [no]debug	- print debugging information
 [no]d2	- print exhaustive debugging information
 

To run in non-interactive mode, use the command:

 [root@deep] /# nslookup www.redhat.com
 

 Server:  deep.openna.com
 Address:  208.164.186.1

 Non-authoritative answer:
 Name:    www.portal.redhat.com
 Addresses:  206.132.41.202, 206.132.41.203
 Aliases:  www.redhat.com
 
Where www.redhat.com is the host name or Internet address of the name server to be looked up.

dnsquery. The dnsquery program queries domain name servers via the resolver library calls /etc/resolv.conf. To query domain name servers using resolver, use the command:

 [root@deep] /# dnsquery <host>
 

Example 21-1. dnsquery


 [root@deep] /# dnsquery www.redhat.com
 

 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40803
 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
 ;;      www.redhat.com, type = ANY, class = IN
 www.redhat.com.         	2h19m46s IN CNAME  www.portal.redhat.com.
 redhat.com.             	2h18m13s IN NS  	ns.redhat.com.
 redhat.com.             	2h18m13s IN NS  	ns2.redhat.com.
 redhat.com.             	2h18m13s IN NS  	ns3.redhat.com.
 redhat.com.             	2h18m13s IN NS  	speedy.redhat.com.
 ns.redhat.com.          	1d2h18m8s IN A  	207.175.42.153
 ns2.redhat.com.         	1d2h18m8s IN A  	208.178.165.229
 ns3.redhat.com.         	1d2h18m8s IN A  	206.132.41.213
 speedy.redhat.com.      	2h18m13s IN A   	199.183.24.251
 
Where <host> is the name of the host you want to query.

host. The host program looks up host names using DNS. To look up host names using domain server, use the command:

 [root@deep] /# host <FQDN, domain names, host names, or host numbers>
 

Example 21-2. Look up host names


 [root@deep] /# host redhat.com
 

 redhat.com has address 207.175.42.154
 
Where <FQDN, domain names, host names, or host numbers> is either FDQN www.redhat.com, domain names redhat.com, host names www or host numbers 207.175.42.154.

To find all of the information about a host maintained by the DNS, use the command:

 [root@deep] /# host -a <domain names >
 

Example 21-3. Using host


 [root@deep] /# host -a redhat.com
 

 Trying null domain
 rcode = 0 (Success), ancount=6
 The following answer is not authoritative:
 The following answer is not verified as authentic by the server:
 redhat.com      8112 IN NS      ns.redhat.com
 redhat.com      8112 IN NS      ns2.redhat.com
 redhat.com      8112 IN NS      ns3.redhat.com
 redhat.com      8112 IN NS      speedy.redhat.com
 redhat.com      8112 IN A        207.175.42.154
 redhat.com      11891 IN         SOA     ns.redhat.com noc.redhat.com(
 2000021402	;serial (version)
 3600    	;refresh period
 1800    	;retry refresh this often
 604800  	;expiration period
 86400   	;minimum TTL
 )
 For authoritative answers, see:
 redhat.com      8112 IN NS      ns.redhat.com
 redhat.com      8112 IN NS      ns2.redhat.com
 redhat.com      8112 IN NS      ns3.redhat.com
 redhat.com      8112 IN NS      speedy.redhat.com
 Additional information:
 ns.redhat.com   94507	IN        	A       207.175.42.153
 ns2.redhat.com  94507 	IN	A       208.178.165.229
 ns3.redhat.com  94507 	IN        	A       206.132.41.213
 speedy.redhat.com       	8112 IN 	A       199.183.24.251
 
This option can be used to find all of the information that is maintained by the domain server about this host, in our example redhat.com.

To list a complete domain, use the command:

 [root@deep] /# host -l <domain names >
 

Example 21-4. List a complete domain


 [root@deep] /# host -l openna.com
 

 openna.com name server deep.openna.com
 openna.com name server mail.openna.com
 localhost.openna.com has address 127.0.0.1
 deep.openna.com has address 208.164.186.1
 mail.openna.com has address 208.164.186.2
 www.openna.com has address 208.164.186.3
 
This option, in the official master file format, will give a complete download of the zone data for the domain name openna.com. This command should be used only if it is absolutely necessary.