samantha:~> nslookup
Default Server: localhost
Address: 127.0.0.1
> ?
$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
[no]defname - append domain name to each query
[no]recurse - ask for recursive answer to query
[no]vc - always use a virtual circuit
domain=NAME - set default domain name to NAME
srchlist=N1[/N2/.../N6] - set domain to N1 and search list to N1,N2, etc.
root=NAME - set root server to NAME
retry=X - set number of retries to X
timeout=X - set initial time-out interval to X seconds
querytype=X - set query type, e.g., A,ANY,CNAME,HINFO,MX,PX,NS,PTR,SOA,TXT,WKS,SRV,NAPTR
port=X - set port number to send query on
type=X - synonym for querytype
class=X - set query class to one of IN (Internet), CHAOS, HESIOD or ANY
server NAME - set default server to NAME, using current default
server
lserver NAME - set default server to NAME, using initial server
finger [USER] - finger the optional USER at the current default host
root - set current default server to the root
ls [opt] DOMAIN [> FILE] - list addresses in DOMAIN (optional: output to FILE)
-a - list canonical names and aliases
-h - list HINFO (CPU type and operating system)
-s - list well-known services
-d - list all records
-t TYPE - list records of the given type (e.g., A,CNAME,MX, etc.)
view FILE - sort an 'ls' output file and view it with more
exit - exit the program, ^D also exits
>
We're using localhost for our DNS server. This is not really a regular
occurence, but happens a great deal on single-computer networks. It is
usually very common to find DNS on the same machine as a domain's mail
server.
> www.cosby.dhs.org Server: localhost Address: 127.0.0.1 Non-authoritative answer: Name: samantha.cosby.dhs.org Address: 129.21.142.19 Aliases: www.cosby.dhs.org >The host www.cosby.dhs.org is actually a CNAME (an alias) to the computer samantha.cosby.dhs.org. The address of both names (since they're one and the same) is 129.21.142.19
> server ns.mindspring.com Default Server: ns.mindspring.com Addresses: 207.69.188.186, 207.69.188.187, 207.69.188.185 >This changes your default server to mindpsring.com. It's important to understand how this process works. nslookup will look up the address of the name server you want (or will simply go to it by IP if you specify the IP) in your current nameserver. Then it will switch to the new nameserver. If this new nameserver isn't actually running bind then not only will you not be able to run DNS queries, but you won't be able to change nameservers except by IP. Another way to get out of that is to use the lserver command instead of the server command.
> juno.com Server: localhost Address: 127.0.0.1 Non-authoritative answer: Name: juno.com Address: 209.67.34.137 > set type=MX > juno.com Server: localhost Address: 127.0.0.1 juno.com preference = 10, mail exchanger = mx.boston.juno.com juno.com preference = 10, mail exchanger = mx.jersey.juno.com juno.com nameserver = ns.boston.juno.com juno.com nameserver = ns.jersey.juno.com juno.com nameserver = ns.nyc.juno.com mx.boston.juno.com internet address = 207.205.100.140 mx.jersey.juno.com internet address = 209.67.34.140 ns.boston.juno.com internet address = 207.205.100.1 ns.jersey.juno.com internet address = 209.67.33.2 ns.nyc.juno.com internet address = 205.231.108.1 >This gives us a wealth of information about the structure of juno.com that just about any host will need to send information to it. juno.com has two primamry mail servers, each with a priority of 10. If one had a lower priority than the other then anyone attempting to send mail to uno.com would send mail to the host with the lowest priority number first. Since their priorities are equal, an smtp server would again just pick whichever one it felt like to talk to. Note that a query with the type set to MX also returns NS records and the IP addresses of the MXs of the hosts/domains you asked for.
> set type=NS > westnet1.net Server: ns.mindspring.com Addresses: 207.69.188.186, 207.69.188.187, 207.69.188.185 Non-authoritative answer: westnet1.net nameserver = NS1.westnet1.net westnet1.net nameserver = NS1.WCSC.net Authoritative answers can be found from: NS1.westnet1.net internet address = 206.50.47.5 NS1.WCSC.net internet address = 206.50.164.3 >The domain westnet1.net uses the name servers ns1.westne1.net and ns1.wcsc.net. Which one of these is the primary and one is the backup, they both look like primary servers to the outside world and they both need to act as primary servers in order for names within westnet1.net to resolve correctly. Acting as a primary server, by the way, means that you answer "authoritatively" for the domain (i.e. you have the best answer and anyone who disagrees with you is wrong).
Default Server: localhost.isc.rit.edu Address: 127.0.0.1 > ls cosby.dhs.org [localhost.isc.rit.edu] $ORIGIN cosby.dhs.org. @ 1D IN A 129.21.142.19 shawn 1D IN A 129.21.60.18 kitten 12H IN A 24.27.8.201 localhost 1D IN A 127.0.0.1 somegirl 1D IN A 129.21.142.10 malcolm 1D IN A 207.160.66.126 samantha 1D IN A 129.21.142.19 ns 1D IN A 129.21.142.19 ns2 1D IN A 129.21.131.10 >
> set type=A > cosby.dhs.org Server: localhost Address: 127.0.0.1 Non-authoritative answer: Name: cosby.dhs.org Address: 129.21.142.19 > set type=NS > cosby.dhs.org Server: localhost Address: 127.0.0.1 cosby.dhs.org nameserver = ns.cosby.dhs.org cosby.dhs.org nameserver = ns2.cosby.dhs.org ns.cosby.dhs.org internet address = 129.21.142.19 ns2.cosby.dhs.org internet address = 129.21.131.10 > server ns.cosby.dhs.org Default Server: ns.cosby.dhs.org Address: 129.21.142.19 > set type=A > cosby.dhs.org Server: ns.cosby.dhs.org Address: 129.21.142.19 Name: cosby.dhs.org Address: 129.21.142.19 >
> server a.root-servers.net Default Server: a.root-servers.net Address: 198.41.0.4 > set type=NS > dhs.org Server: a.root-servers.net Address: 198.41.0.4 Non-authoritative answer: dhs.org nameserver = NS1.dhs.org dhs.org nameserver = NS2.dhs.org Authoritative answers can be found from: NS1.dhs.org internet address = 209.249.50.99 NS2.dhs.org internet address = 207.71.8.95 >The line "set type=NS" is very important. Because the root servers are very busy (serving all the top-level domains isn't easy, even if they don't really do that) they don't service any requests except to find the nameservers of other domains. If you don't ask for an NS record, a root server will politely (but firmly) tell you to ask your local nameserver (based on your IP) the same question.