Nslookup | Microsoft Learn

Applies To: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012

R2, Windows Server 2012

Displays information that you can use to diagnose the Domain Name System (DNS) infrastructure. Before using this tool, you should be familiar with how DNS works. The nslookup command-line tool is available only if you have installed the TCP/IP protocol.

The nslookup command-line tool has two modes: interactive and non-interactive.

If you need to search for only one piece of data, we recommend that you use the non-interactive mode. For the first parameter, type the name or IP address of the computer you want to find. For the second parameter, type the name or IP address of a DNS name server. If you omit the second argument, nslookup uses the default DNS name server.

If you need to search for more than one piece of information, you can use the interactive mode. Type a hyphen (-) for the first parameter and the name or IP address of a DNS name server for the second parameter. If you omit both parameters, the tool uses the default DNS name server. While using interactive mode, you can:

  • Interrupt interactive commands at any time by pressing CTRL+B

  • .

  • Exit, typing exit.

  • Treat a built-in command as a computer name, preceding it with the escape character (\). An unrecognized command is interpreted as a computer name.

nslookup

syntax

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

Parameters

Description of the nslookup exit parameter Quits the nslookup command-line tool. nslookup finger Connects to the finger server on the current computer. nslookup help Displays a brief summary of the subcommands. nslookup ls Displays information for a DNS domain. nslookup lserver Changes the default server to the specified DNS domain. nslookup root Changes the default server to the server for the root of the DNS domain namespace. nslookup server Changes the default server to the specified DNS domain. nslookup set Changes settings that affect how searches work. nslookup set all Prints the current values of the configuration settings. nslookup set class Changes the query class. The class specifies the protocol group for the information. nslookup set d2 Enables or disables comprehensive debugging mode. All fields in each package are printed. nslookup set debug Enables or disables debug mode. nslookup set domain Changes the default DNS domain name to the specified name. nslookup set port Changes the default DNS TCP/UDP name server port to the specified value. nslookup set querytype Changes the resource record type for the query. nslookup set recurse Tells the DNS name server to query other servers if it does not have the information. nslookup set retry Sets the number of retries. nslookup set root Renames the root server used for queries. nslookup set search Appends the DNS domain names from the DNS domain search list to the request until a response is received. This applies when the set and search request contain at least one period, but do not end with an endpoint. nslookup set srchlist Changes the default DNS domain name and search list. nslookup set timeout Changes the initial number of seconds to wait for a response to a request. nslookup set type Changes the resource record type for the query. nslookup set vc Specifies whether or not to use a virtual circuit when sending requests to the server. nslookup view Sorts and lists the output of the previous ls subcommand or commands.

Feedback

If computerTofind is

  • an IP address and the query is for a resource record type A or PTR, the computer name is returned. If computerTofind

  • is a name

  • and does not have an endpoint, the default DNS domain name is appended to the name. This behavior depends on the state of the following set subcommands: domain, srchlist, defname, and search.

  • If

  • you type a hyphen (-) instead of computerTofind, the command prompt switches to nslookup interactive mode. If

  • the

  • search request fails, the command-line tool provides an error message, including: Error message

    Description timed out The server did not respond to a request after a certain period of time and a certain number of retries. You can set the timeout period with the nslookup set timeout command. You can set the number of retries with the nslookup set retry command. No response from the server There is no DNS name server running on the server computer. No records The DNS name server does not have resource records of the current query type for the computer, even though the computer name is valid. The query type is specified with the nslookup set querytype command. Nonexistent domain The computer or DNS domain name does not exist. Connection rejected or Network is unreachable Could not connect to DNS name server or finger server. This error commonly occurs with ls and finger requests. Server error The DNS name server encountered an internal inconsistency in its database and was unable to return a valid response. Rejected The DNS name server refused to serve the request. format error The DNS name server found that the request packet was not properly formatted. It may indicate an error in nslookup.

Related Links

  • Command Line Syntax Key