zoukankan      html  css  js  c++  java
  • nslookup 命令

    nslookup这个名字的意思是:"name server lookup".

    这个命令行工具是内置在的命令行工具, windows和unix上都有. 能允许用户查询网络中的域IP地址, 或主机的IP地址.

    首先需要理解到NSLOOKUP会假设你正在查询在私有网络上的本地域. 你可以查询external 的domain, 但是NSLOOKUP会先在内部域查询.

    nslookup 有下面的子命令:

    • server NAME (这里的NAME是查询的DNS服务器的服务器名或者IP地址). 查询DNS服务器并不总是可以的, 因为经常对DNS的查询会为防止拒绝服务式攻击而被阻止掉.
    • set type=NAME (这里的NAME是要查询的记录的类型). 比如说, set type mx会给出mail records.

    使用方法:

    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

    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

    输出结果解释

    ==============

    命令运行结果如下

    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      Registered

        MAC 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      Registered

        MAC 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

    http://serverfault.com/questions/88064/how-to-determine-the-hostname-from-an-ip-address-in-a-windows-network

  • 相关阅读:
    【刷题】BZOJ 1061 [Noi2008]志愿者招募
    【比赛】NOIP2017 列队
    react_app 项目开发 (6)_后台服务器端-node
    react_app 项目开发 (5)_前后端分离_后台管理系统_开始
    react_app 项目开发 (3)_单页面设计_react-router4
    react_app 项目开发 (2)_axios_pubsub-js
    react_app 项目开发
    React_基本原理_ajax
    React_生命周期
    组件化
  • 原文地址:https://www.cnblogs.com/awpatp/p/1677097.html
Copyright © 2011-2022 走看看