Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Windows Server 2003 : Using DNS Troubleshooting Tools (part 1) - Querying DNS with Nslookup

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/14/2011 9:48:29 PM

Querying DNS with Nslookup

Nslookup is a command-line tool provided in most operating systems, including the Windows Server 2003 family. It offers the ability to perform query testing of DNS servers and to obtain detailed responses at the command prompt. This information can be useful for diagnosing and solving name resolution problems, for verifying that resource records are added or updated correctly in a zone, and for debugging other server-related problems.

Nslookup can be run either as a simple command executed once (noninteractive mode) or as a program that accepts serial commands and queries (interactive mode).

Performing Simple Queries

You can use Nslookup in noninteractive mode to determine the IP address(es) associated with a single host name. For example, the following command executed at the command prompt returns the IP addresses associated with the fully qualified domain name (FQDN) www.microsoft.com:

C:\>nslookup www.microsoft.com

The following sample output is generated from this command:

C:\>nslookup www.microsoft.com

Server: localhost
Address: 127.0.0.1

Non-authoritative answer:
Name: www.microsoft.akadns.net
Addresses: 207.46.230.220, 207.46.197.102, 207.46.197.100, 207.46.230.218
Aliases: www.microsoft.com

To resolve the query, the Nslookup utility submits the name to the DNS server specified for the primary connection on the local client computer. This DNS server can then answer the query from its cache or through recursion.

If you would like to troubleshoot a specific DNS server instead of the one specified for the primary connection on the local client computer, you can specify that DNS server in the Nslookup command. For example, the following command executed at the command prompt queries the DNS server at 207.46.123.2 for the name www.microsoft.com:

C:\>nslookup www.microsoft.com 207.46.138.20

You can also use Nslookup to resolve IP addresses to host names. For example, the following command executed at the command prompt returns the FQDN associated with the address 207.46.230.220, as shown in this output:

C:\>nslookup 207.46.249.222
Server: localhost
Address: 127.0.0.1

Name: www.microsoft.com
Address: 207.46.249.222

Note

Reverse lookups rely on pointer (PTR) resource records configured in reverse lookup domains. Reverse lookup domains are not available for all Internet hosts.


Using Interactive Mode

If you need to resolve more than a single host name or IP address, or if you want to troubleshoot DNS by performing various functions, you can use Nslookup as an interactive program. To enter interactive mode, simply type nslookup at the command prompt and press Enter.

In interactive mode, Nslookup accepts commands that allow the program to perform a variety of functions, such as displaying the specific contents of messages included in DNS exchanges, simulating a zone transfer, or searching for any or all records of a specific type at a given server. These commands can be displayed by entering the Help or ? command, as shown in Figure 1.

Figure 1. Nslookup commands


Exploring Nslookup Options

When in interactive mode, you can also use the Set command to configure Nslookup options that determine how the resolver carries out queries. For example, Nslookup can be set to Debug or Nodebug. By default, the Nodebug option is enabled, but when you enable the Debug option by using the Set Debug command, Nslookup enters Debug mode. In Debug mode, Nslookup displays the DNS response messages communicated from the DNS server.

Important

Commands entered in Nslookup interactive mode are case-sensitive and must be typed in lowercase.


You can view the options currently configured for Nslookup by running the Set All command, as shown in Figure 2.

Figure 2. Displaying Nslookup options


Table 1 describes the most common options configured with the Set command.

Table 1. Command-Line Options Available with Set
OptionPurpose
set allShows the configuration status of all options.
set [no]debugPuts Nslookup in Debug mode. With Debug mode turned on, more information is printed about the packet sent to the server and the resulting answer.
set [no]d2Puts Nslookup in Verbose Debug mode so you can examine the query and response packets between the resolver and the server.
set domain=<domain name>Tells the resolver which domain name to append for unqualified queries, including all queried names not followed by a trailing dot.
set timeout=<time-out value>Tells the resolver which time-out value to use, in seconds. This option is useful for slow links where queries frequently time out and the wait time must be lengthened.
set type=<record type> or set querytype=<record type> or set q=<record type>Tells the resolver which type of resource records to search for (for example, A, PTR, or SRV). If you want the resolver to query for all types of resource records, type set type=all.

The next section describes how to perform common tasks by using Nslookup in interactive mode.

Looking Up Different Data Types

By default, names queried for in Nslookup return only matching host address (A) resource records. To look up different data types within the domain namespace, use the Set Type or Set Querytype (Set Q) command at the command prompt. For example, to query for mail exchanger (MX) resource records only instead of A resource records, type set q=mx, as shown here:

C:\>nslookup
Default Server: localhost
Address: 127.0.0.1

set q=mx
> microsoft.com
Server: localhost
Address: 127.0.0.1

Non-authoritative answer:
microsoft.com MX preference = 10, mail exchanger = mailc.microsoft.com
microsoft.com MX preference = 10, mail exchanger = maila.microsoft.com
microsoft.com MX preference = 10, mail exchanger = mailb.microsoft.com

microsoft.com nameserver = dns1.cp.msft.net
microsoft.com nameserver = dns1.tk.msft.net
microsoft.com nameserver = dns3.uk.msft.net
microsoft.com nameserver = dns1.dc.msft.net
microsoft.com nameserver = dns1.sj.msft.net
mailc.microsoft.com internet address = 131.107.3.121
mailc.microsoft.com internet address = 131.107.3.126
maila.microsoft.com internet address = 131.107.3.124
maila.microsoft.com internet address = 131.107.3.125
mailb.microsoft.com internet address = 131.107.3.122
mailb.microsoft.com internet address = 131.107.3.123
dns1.cp.msft.net internet address = 207.46.138.20
dns1.tk.msft.net internet address = 207.46.245.230
dns3.uk.msft.net internet address = 213.199.144.151
dns1.dc.msft.net internet address = 64.4.25.30
dns1.sj.msft.net internet address = 65.54.248.222>


Tip

To query for a record of any type, execute the Nslookup command Set q=any.


The first time a query is made for a remote name, the answer is authoritative, but subsequent queries are nonauthoritative. This pattern appears for the following reason: The first time a remote host is queried, the local DNS server contacts the DNS server that is authoritative for that domain. The local DNS server then caches that information so that subsequent queries are answered nonauthoritatively out of the local server’s cache.

Querying Another Name Server Directly

To query another name server directly, use the Server or Lserver commands to switch to that name server. The Lserver command uses the local server to get the address of the server to switch to, whereas the Server command uses the current default server to get the address.

After you execute either of these commands, all subsequent lookups in the current Nslookup session are performed at the specified server until you switch servers again. The following lines illustrate such a server switch:

  C:\> nslookup
Default Server: nameserver1.lucernepublishing.com
Address: 10.0.0.1

server nameserver2

Default Server: nameserver2.lucernepublishing.com
Address: 10.0.0.2
>

Using Nslookup to View Zone Data

You can use Nslookup to simulate a zone transfer using the Ls command, which is useful to see all the hosts within a remote domain. The syntax for the Ls command is as follows:

ls [- a | d | t type] domain [> filename]

Using Ls with no switches returns a list of all address and name server data. The –a switch returns alias and canonical names, –d returns all data, and –t filters by type. The following lines present an example Ls output when this command is used without switches:

>ls contoso.com
[nameserver1.contoso.com]
nameserver1.contoso.com. NS server = ns1.contoso.com
nameserver2.contoso.com NS server = ns2.contoso.com
nameserver1 A 10.0.0.1
nameserver2 A 10.0.0.2
>

Zone transfers can be blocked at the DNS server so that only authorized addresses or networks can perform this function. The following error is returned if zone transfer security has been set:

*** Can't list domain <example>.: Query refused

Tip

For the exam, you need to remember that the Ls command simulates a zone transfer, and that zone transfers are restricted by default in Windows Server 2003. To query a Windows Server 2003 DNS server with the Ls command, be sure to allow zone transfers to the computer on which you are running Nslookup.

Other -----------------
- Maintaining Windows Server 2008 R2
- Windows Server 2008 R2 : Keeping Up with Service Packs and Updates
- Managing Windows Server 2008 R2 Remotely
- Windows Server 2003 : Implementing a DNS Infrastructure - Deploying Stub Zones
- Windows Server 2003 : Implementing a DNS Infrastructure - Creating Zone Delegations
- Windows Server 2003 : Configuring Advanced DNS Server Properties - Tuning Advanced Server Options (part 3)
- Windows Server 2003 : Configuring Advanced DNS Server Properties - Tuning Advanced Server Options (part 2)
- Windows Server 2003 : Configuring Advanced DNS Server Properties - Tuning Advanced Server Options (part 1) -
- Windows Server 2008 R2 : Auditing the Environment (part 3) - Auditing Resource Access
- Windows Server 2008 R2 : Auditing the Environment (part 2) - Audit Policy Subcategories
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server