nslookupnslookup

适用于: Windows Server (半年通道) ,Windows Server 2019,Windows Server 2016,Windows Server 2012 R2,Windows Server 2012Applies to: Windows Server (Semi-Annual Channel), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

显示可用于诊断域名系统 (DNS) 基础结构的信息。Displays information that you can use to diagnose Domain Name System (DNS) infrastructure. 使用此工具之前,应熟悉 DNS 的工作原理。Before using this tool, you should be familiar with how DNS works. 只有安装了 TCP/IP 协议,才能使用 nslookup 命令行工具。The nslookup command-line tool is available only if you have installed the TCP/IP protocol.

Nslookup 命令行工具有两种模式:交互式和非交互式。The nslookup command-line tool has two modes: interactive and noninteractive.

如果只需要查找一段数据,我们建议使用非交互模式。If you need to look up only a single piece of data, we recommend using the non-interactive mode. 对于第一个参数,键入要查找的计算机的名称或 IP 地址。For the first parameter, type the name or IP address of the computer that you want to look up. 对于第二个参数,请键入 DNS 名称服务器的名称或 IP 地址。For the second parameter, type the name or IP address of a DNS name server. 如果省略第二个参数,则 nslookup 将使用默认 DNS 名称服务器。If you omit the second argument, nslookup uses the default DNS name server.

如果需要查找多个数据片段,可以使用交互模式。If you need to look up more than one piece of data, you can use interactive mode. 为第一个参数键入连字符 ( ) ,为第二个参数键入 DNS 名称服务器的名称或 IP 地址。Type a hyphen (-) for the first parameter and the name or IP address of a DNS name server for the second parameter. 如果省略这两个参数,则该工具将使用默认 DNS 名称服务器。If you omit both parameters, the tool uses the default DNS name server. 使用交互模式时,可以执行以下操作:While using the interactive mode, you can:

  • 通过按 CTRL + B,随时中断交互式命令。Interrupt interactive commands at any time, by pressing CTRL+B.

  • 退出,通过键入 exitExit, by typing exit.

  • 将内置命令视为计算机名称,并在其前面加上转义字符 () 。Treat a built-in command as a computer name, by preceding it with the escape character (). 无法识别的命令被解释为计算机名。An unrecognized command is interpreted as a computer name.

语法Syntax

nslookup [exit | finger | help | ls | lserver | root | server | set | view] [options]

参数Parameters

参数Parameter 说明Description
nslookup 退出nslookup exit 退出 nslookup 命令行工具。Exits the nslookup command-line tool.
nslookup fingernslookup finger 与当前计算机上的 finger 服务器连接。Connects with the finger server on the current computer.
nslookup helpnslookup help 显示子命令的简短摘要。Displays a short summary of subcommands.
nslookup lsnslookup ls 列出 DNS 域的信息。Lists information for a DNS domain.
nslookup lservernslookup lserver 将默认服务器更改为指定的 DNS 域。Changes the default server to the specified DNS domain.
nslookup rootnslookup root 将默认服务器更改为 DNS 域名空间的根服务器的服务器。Changes the default server to the server for the root of the DNS domain name space.
nslookup servernslookup server 将默认服务器更改为指定的 DNS 域。Changes the default server to the specified DNS domain.
nslookup setnslookup set 更改影响查找功能的配置设置。Changes configuration settings that affect how lookups function.
nslookup set allnslookup set all 打印配置设置的当前值。Prints the current values of the configuration settings.
nslookup set classnslookup set class 更改查询类。Changes the query class. 类指定信息的协议组。The class specifies the protocol group of the information.
nslookup set d2nslookup set d2 启用或禁用穷举调试模式。Turns exhaustive Debugging mode on or off. 打印每个数据包的所有字段。All fields of every packet are printed.
nslookup set debugnslookup set debug 启用或禁用调试模式。Turns Debugging mode on or off.
nslookup set domainnslookup set domain 将默认 DNS 域名改为指定的名称。Changes the default DNS domain name to the name specified.
nslookup set portnslookup set port 将默认的 TCP/UDP DNS 名称服务器端口更改为指定值。Changes the default TCP/UDP DNS name server port to the value specified.
nslookup set querytypenslookup set querytype 更改查询的资源记录类型。Changes the resource record type for the query.
nslookup set recursenslookup set recurse 告知 DNS 名称服务器在不包含信息的情况查询其他服务器。Tells the DNS name server to query other servers if it doesn't have the information.
nslookup set retrynslookup set retry 设置重试次数。Sets the number of retries.
nslookup set rootnslookup set root 更改用于查询的根服务器的名称。Changes the name of the root server used for queries.
nslookup set searchnslookup set search 向请求追加 dns 域搜索列表中的 DNS 域名,直到收到答案。Appends the DNS domain names in the DNS domain search list to the request until an answer is received. 这适用于以下情况:集和查找请求至少包含一个句点,但不以尾随句点结束。This applies when the set and the lookup request contain at least one period, but do not end with a trailing period.
nslookup set srchlistnslookup set srchlist 更改默认 DNS 域名和搜索列表。Changes the default DNS domain name and search list.
nslookup set timeoutnslookup set timeout 更改等待答复请求的初始秒数。Changes the initial number of seconds to wait for a reply to a request.
nslookup set typenslookup set type 更改查询的资源记录类型。Changes the resource record type for the query.
nslookup set vcnslookup set vc 指定在向服务器发送请求时使用或不使用虚拟线路。Specifies to use or not use a virtual circuit when sending requests to the server.
nslookup viewnslookup view 排序并列出上一 ls 子命令或命令的输出。Sorts and lists the output of the previous ls subcommand or commands.

备注Remarks

  • 如果 computerTofind 是 IP 地址,并且查询用于 APTR 资源记录类型,则返回该计算机的名称。If computerTofind is an IP address and the query is for an A or PTR resource record type, the name of the computer is returned.

  • 如果 computerTofind 是一个名称并且没有尾随句点,则会将默认 DNS 域名追加到该名称。If computerTofind is a name and doesn't have a trailing period, the default DNS domain name is appended to the name. 此行为取决于以下 set 子命令的状态: domainsrchlistbre-walkthrough-defnamesearchThis behavior depends on the state of the following set subcommands: domain, srchlist, defname, and search.

  • 如果键入连字符 (-) 而不是 computerTofind,则命令提示符将更改为 nslookup 交互模式。If you type a hyphen (-) instead of computerTofind, the command prompt changes to nslookup interactive mode.

  • 如果查找请求失败,则命令行工具将提供一条错误消息,其中包括:If the lookup request fails, the command-line tool provides an error message, including:

    错误消息Error message 说明Description
    超时timed out 服务器在一段时间内未响应请求,并且有一定次数的重试。The server didn't respond to a request after a certain amount of time and a certain number of retries. 可以用 nslookup set timeout 命令设置超时期限。You can set the time-out period with the nslookup set timeout command. 可以用 nslookup set retry 命令设置重试次数。You can set the number of retries with the nslookup set retry command.
    服务器无响应No response from server 服务器计算机上没有运行任何 DNS 名称服务器。No DNS name server is running on the server computer.
    无记录No records DNS 名称服务器没有计算机的当前查询类型的资源记录,但计算机名称有效。The DNS name server doesn't have resource records of the current query type for the computer, although the computer name is valid. 查询类型是通过 nslookup set querytype 命令指定的。The query type is specified with the nslookup set querytype command.
    域不存在Nonexistent domain 计算机或 DNS 域名不存在。The computer or DNS domain name doesn't exist.
    连接被拒绝或网络无法访问Connection refused or Network is unreachable 无法连接到 DNS 名称服务器或 finger 服务器。The connection to the DNS name server or finger server could not be made. 此错误通常发生在 lsfinger 请求上。This error commonly occurs with the ls and finger requests.
    服务器故障Server failure DNS 名称服务器在其数据库中发现内部不一致,无法返回有效的答案。The DNS name server found an internal inconsistency in its database and could not return a valid answer.
    拒绝Refused DNS 名称服务器拒绝为请求服务。The DNS name server refused to service the request.
    格式错误format error DNS 名称服务器发现请求数据包的格式不正确。The DNS name server found that the request packet was not in the proper format. 这可能表示 nslookup 中存在错误。It may indicate an error in nslookup.

其他参考Additional References