! MS-DOS utility that enables a user to look up an IP address of a domain or host on a network.
Syntax 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 | ||||||||||||||||||||||||||||||||||
set OPTION | set an option
| ||||||||||||||||||||||||||||||||||
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 NAME 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)
| ||||||||||||||||||||||||||||||||||
view FILE | sort an 'ls' output file and view it with pg | ||||||||||||||||||||||||||||||||||
exit | exit the program |
Type “nslookup” and “?” to display all the available commands.
C:\Windows\system32>nslookupDefault Server: sn3.dli.bit.netAddress: 201.4.2.9 > ? 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 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]search - use domain search list [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 type=X - set query type (ex. A, AAAA, A+AAAA, ANY, CNAME, MX, NS, PTR, SOA, SRV) querytype=X - same as type - set query class (ex. IN (Internet), ANY) [no]msxfr - use MS fast zone transfer ixfrver=X - current version to use in IXFR transfer request 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 NAME 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 -d - list all records -t TYPE - list records of the given RFC record type (ex. A,CNAME,MX,NS, PTR etc.) view FILE - sort an 'ls' output file and view it with pg exit - exit the program |
Example :
1. nslookup – Simple Example
C:\Windows\system32>nslookup redhat.comServer: 192.168.19.2Address: 192.168.19.2#53 Non-authoritative answer: Name: redhat.com Address: 209.132.183.181 |
2. Query the MX Record using -query=mx
C:\Windows\system32>nslookup -query=mx redhat.comServer: 192.168.19.2Address: 192.168.19.2#53 Non-authoritative answer: redhat.com mail exchanger = 10 mx2.redhat.com. redhat.com mail exchanger = 5 mx1.redhat.com. Authoritative answers can be found from: mx2.redhat.com internet address = 66.187.233.33 mx1.redhat.com internet address = 209.132.183.28 |
3. Query the NS Record using -query=ns
C:\Windows\system32>nslookup -type=ns redhat.comServer: 192.168.19.2Address: 192.168.19.2#53 Non-authoritative answer: redhat.com nameserver = ns4.redhat.com. redhat.com nameserver = ns2.redhat.com. redhat.com nameserver = ns1.redhat.com. redhat.com nameserver = ns3.redhat.com. Authoritative answers can be found from: ns4.redhat.com internet address = 209.132.188.218 ns2.redhat.com internet address = 209.132.183.2 ns1.redhat.com internet address = 209.132.186.218 ns3.redhat.com internet address = 209.132.176.100 |
4. Query the SOA Record using -query=soa
C:\Windows\system32>nslookup -type=soa redhat.comServer: 192.168.19.2Address: 192.168.19.2#53 Non-authoritative answer: redhat.com origin = ns1.redhat.com mail addr = noc.redhat.com serial = 2012071601 refresh = 300 retry = 180 expire = 604800 minimum = 14400 Authoritative answers can be found from: ns1.redhat.com internet address = 209.132.186.218 |
* mail addr – specifies the mail address of the domain admin ( noc@redhat.com )
* serial – sort of revision numbering system. The standard convention is to use “YYYYMMYYNN” format. ( 2012-07-16. 01 will be incremented, if more than one edit has taken place on a same day )
* refresh – specifies ( in seconds ), when the secondary DNS will poll the primary to see if the serial number has been increased. If increased, secondary will make a new request to copy the new zone file.
* retry – specifies the interval to re-connect with the Primary DNS
* expire – specifies the time that the secondary DNS will keep the cached zone file as valid
* minimum – specifies the time that the secondary DNS should cache the zone file
5. View available DNS records using -query=any
C:\Windows\system32>nslookup -type=any google.comServer: 192.168.19.2Address: 192.168.19.2#53 Non-authoritative answer: Name: google.com Address: 173.194.35.7 Name: google.com Address: 173.194.35.8 google.com nameserver = ns1.google.com. google.com nameserver = ns2.google.com. google.com origin = ns1.google.com mail addr = dns-admin.google.com serial = 2012071701 refresh = 7200 retry = 1800 expire = 1209600 minimum = 300 google.com mail exchanger = 20 alt1.aspmx.l.google.com. google.com mail exchanger = 30 alt2.aspmx.l.google.com. google.com mail exchanger = 40 alt3.aspmx.l.google.com. google.com mail exchanger = 50 alt4.aspmx.l.google.com. google.com mail exchanger = 10 aspmx-v4v6.l.google.com. google.com has AAAA address 2a00:1450:4002:801::1004 Authoritative answers can be found from: ns4.google.com internet address = 216.239.38.10 ns3.google.com internet address = 216.239.36.10 |
6. Reverse DNS lookup
C:\Windows\system32>nslookup 209.132.183.181Server: 192.168.19.2Address: 192.168.19.2#53 Non-authoritative answer: 181.183.132.209.in-addr.arpa name = origin-www2.redhat.com. |
* providing the IP Address as argument to nslookup.
7. Using Specific DNS serverp
C:\Windows\system32>nslookup redhat.com ns1.redhat.comServer: 209.132.186.218 Address: 209.132.186.218#53 Name: redhat.com Address: 209.132.183.181 |
8. Change the port number to connect with
C:\Windows\system32>nslookup -port 56 google.com |
* DNS server use port number 53 by default. If port number got changed,
then we can specify the port number using -port option
9. Change timeout interval to wait for a reply
C:\Windows\system32>nslookup -timeout=10 google.com |
10. Enabling debug mode using -debug
C:\Windows\system32>nslookup -debug redhat.comServer: 192.168.19.2Address: 192.168.19.2#53 ------------ QUESTIONS: redhat.com, type = A, class = IN ANSWERS: -> redhat.com internet address = 209.132.183.181 ttl = 5 AUTHORITY RECORDS: ADDITIONAL RECORDS: ------------ Non-authoritative answer: Name: redhat.com Address: 209.132.183.181 |
* debug mode will display the packets information during searching.
0 comments :
Post a Comment
Comment: