2010/9/5

DNS tools

DNS tools


顯示存放在本機的 DNS Resolver Cache
ipconfig  /displaydns

清除存放在本機的 DNS Resolver Cache
ipconfig /flushdns

nslookup 手動查詢 DNS 上一些資料
C:\>ipconfig /flushdns

Windows IP Configuration

Successfully flushed the DNS Resolver Cache.

C:\>nslookup
Default Server:  vassun2.macau.ctm.net
Address:  202.175.3.8

> ?
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,ANY,CNAME,MX,NS,PTR,SOA,SRV)
   querytype=X         - same as type
   class=X             - 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 type (e.g. A,CNAME,MX,NS,PTR etc.)
view FILE           - sort an 'ls' output file and view it with pg
exit            - exit the program

> www.yahoo.com
Server:  vassun2.macau.ctm.net
Address:  202.175.3.8

Non-authoritative answer:
Name:    any-fp.wa1.b.yahoo.com
Addresses:  98.137.149.56, 72.30.2.43
Aliases:  www.yahoo.com, fp.wg1.b.yahoo.com

> set all
Default Server:  vassun2.macau.ctm.net
Address:  202.175.3.8

Set options:
 nodebug
 defname
 search
 recurse
 nod2
 novc
 noignoretc
 port=53
 type=ANY
 class=IN
 timeout=2
 retry=1
 root=A.ROOT-SERVERS.NET.
 domain=
 MSxfr
 IXFRversion=1
 srchlist=

>

> set type=any
> www.yahoo.com
Server:  vassun2.macau.ctm.net
Address:  202.175.3.8

Non-authoritative answer:
www.yahoo.com   canonical name = fp.wg1.b.yahoo.com

yahoo.com       nameserver = ns8.yahoo.com
yahoo.com       nameserver = ns2.yahoo.com
yahoo.com       nameserver = ns4.yahoo.com
yahoo.com       nameserver = ns5.yahoo.com
yahoo.com       nameserver = ns6.yahoo.com
yahoo.com       nameserver = ns1.yahoo.com
yahoo.com       nameserver = ns3.yahoo.com
ns1.yahoo.com   internet address = 68.180.131.16
ns2.yahoo.com   internet address = 68.142.255.16
ns3.yahoo.com   internet address = 121.101.152.99
ns4.yahoo.com   internet address = 68.142.196.63
ns5.yahoo.com   internet address = 119.160.247.124
ns6.yahoo.com   internet address = 202.43.223.170
ns8.yahoo.com   internet address = 202.165.104.22

> ls www.yahoo.com
[vassun2.macau.ctm.net]
*** Can't list domain www.yahoo.com: BAD ERROR VALUE
> Is www.yahoo.com
Server:  any-fp.wa1.b.yahoo.com
Addresses:  98.137.149.56, 72.30.2.43
Aliases:  www.yahoo.com, fp.wg1.b.yahoo.com

DNS request timed out.
   timeout was 2 seconds.
*** Request to www.yahoo.com timed-out



C:\>nslookup
Default Server:  vassun2.macau.ctm.net
Address:  202.175.3.8

> server 202.175.3.3
Default Server:  macau.ctm.net
Address:  202.175.3.3

>





Authoritative/Non-Authoritative
在查詢時有時會出現 Non-authoritative answer, 代表這個答案是由 local DNS 的 cache 中直接讀出來的, 而不是 local DNS 向真正負責這個 domain 的 name server 問來的.

一些常用option會有 例如 set all , server x.x.x.x , set type=any 和 Is
 #Is 要求 name server 將其負責的 zone 內容顯示出來
 #set all : Prints the current values of the configuration settings
#server x.x.x.x: 重特定name server 做query
#set type = any 可以顯示更多的資訊

文章轉載請注明出處
Posted in