nslookup这个名字的意思是:"name server lookup".
这个命令行工具是内置在的命令行工具, windows和unix上都有. 能允许用户查询网络中的域IP地址, 或主机的IP地址.
首先需要理解到NSLOOKUP会假设你正在查询在私有网络上的本地域. 你可以查询external 的domain, 但是NSLOOKUP会先在内部域查询.
nslookup 有下面的子命令:
使用方法:
C:\Users\yunzhang>nslookup ?
Usage:
nslookup [-opt ...] # interactive mode using default server
nslookup [-opt ...] - server # interactive mode using 'server'
nslookup [-opt ...] host # just look up 'host' using default server
nslookup [-opt ...] host server # just look up 'host' using 'server'
这个命令行工具在排查DNS协议的错误的时候非常有用, 一般你会先使用Ping命令, 看看网络是否通畅. 之后, nslookup就排的上用场了.
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 |
输出结果解释
==============
命令运行结果如下
C:\Documents and Settings\Administrator.YUNZHANG>nslookup 190043m5
Server: engx86win2k8.contoso.local //使用的DNS Server的名字
Address: 192.168.1.1
Name: 190043m5.contoso.lab //解析server name的结果
Address: 192.168.1.5
如果想要从IP地址得到主机名hostname, 可以通过命令nbtstat -a
举例:
PS C:\Users\administrator.MIDRANGE> nbtstat -a 10.32.176.70
Local Area Connection:
Node IpAddress: [10.32.176.76] Scope Id: []NetBIOS Remote Machine Name Table
Name Type Status
---------------------------------------------
MIDRANGE <00> GROUP Registered
DC01 <00> UNIQUE Registered
MIDRANGE <1C> GROUP Registered
DC01 <20> UNIQUE Registered
MIDRANGE <1B> UNIQUE RegisteredMAC Address = 00-50-56-80-02-8B
PS C:\Users\administrator.MIDRANGE> nbtstat -a 10.32.176.103
Local Area Connection:
Node IpAddress: [10.32.176.76] Scope Id: []NetBIOS Remote Machine Name Table
Name Type Status
---------------------------------------------
VM-WIN2K8-TEST <00> UNIQUE Registered
SHSC <00> GROUP Registered
VM-WIN2K8-TEST <20> UNIQUE RegisteredMAC Address = 00-50-56-B9-6C-D1
PS C:\Users\administrator.MIDRANGE>
摘自:
http://en.wikipedia.org/wiki/Nslookup
Microsoft DOS nslookup command
http://www.computerhope.com/nslookup.htm
Using NSLOOKUP for DNS Server diagnosis
http://www.windowsnetworking.com/articles_tutorials/Using-NSLOOKUP-DNS-Server-diagnosis.html#
How to determine the hostname from an IP address in a Windows network?nsll