How to use Nslookup tools

Source: Internet
Author: User
Tags domain name server domain server mx record nslookup nslookup command top level domain

After you have configured the DNS server and added the corresponding records, as long as the IP address remains the same, in general we no longer need to maintain the DNS data files. However, before confirming that the domain name is properly interpreted, it is best to test all the configurations properly. Many people will simply use the ping command to check it out. However, the ping command is only a check for network connectivity, although the input parameter is the domain name of the case will be queried through DNS, but it can only query a type and CNAME type records, and will only tell you the existence of the domain name, other information is not in service. So if you need to troubleshoot DNS failures you have to be skilled in another, more powerful tool, Nslookup. This command can specify the type of query, which can be traced to the lifetime of the DNS record and can be specified using that DNS server for interpretation.

Querying IP addresses

The simplest use of Nslookup is to query the IP address of the domain name, including the A and CNAME records, and if a CNAME record is found, the settings for the alias record are returned. The usage is:

Nslookup domain name

The following is the return of a record.

The nslookup command uses the name of the DNS server that was used in reverse interpretation, because I am using an internal DNS server, so there is no correct reverse record, resulting in an error in the first few lines of the result. You can ignore it. The focus is on the last two lines here to see that the IP address of www.oray.net is 61.145.112.212. Note that even if the www.oray.net host is not online, the results can be returned.

If the target domain name is an alias record (CNAME), Nslookup will start to show the difference between the ping command and the result of querying the CNAME record. Since the CNAME and A records are all live IP addresses, the two are generally regarded as identical, and the commands are in the same format.

Note This time Nslookup returns three lines of information, the first two lines show that this is a CNAME record, corresponding domain name and IP address. The final display is the target domain name, with the alias (alias) specified.

What happens if the domain name doesn't exist?

Can you read the last line of English, do not know it is OK to remember the shape. This is also true if a specified type of domain name does not exist for the corresponding record.

Querying other types of domain names

We didn't add any parameters to the previous two commands, so by default nslookup queries are records of type A. If we configure other types of records, we want to see if the explanation is OK. There is nothing to ping at this time. For example, we configure the MX record, but the mail server can only send letters cannot receive the letter, in the end is the domain name interpretation problem or other problems ping command check can only let you go astray. Nslookup this time can simulate your other meeting server domain name interpretation of the situation. We need to add the appropriate parameters to the nslookup. The instruction format for specifying the query record type is as follows:

nslookup–qt= type target domain name

Note Qt must be lowercase.

The type can be a character, not case-sensitive:

A address record (IPV4)
AAAA address record (Ipv6)
AFSDB Andrew File System database server record (not understood)
ATMA ATM address record (not ATM)
CNAME alias Record
HINFO hardware configuration records, including CPU, operating system Information
ISDN number corresponding to ISDN domain name
MB the server that holds the specified mailbox
MG Mailing Group Records
MINFO information records for mail groups and mailboxes
MR renamed Mailbox Records
MX Mail server Records
NS Name Server record
PTR Reverse record (interprets domain name from IP address)
RP owner Record
RT Route penetration record (not understood)
SRV TCP Server information record (will be of great use)
TXT domain corresponding to the text information
X. X25 address record for the domain name

Look at Oray.net's mail server record.

Look, nslookup the server name and address are given out, note that preference is the first priority, the smaller the value, the higher the priority level.

Let me see what the name server record is.

It looks similar to the MX record format, and the server typically returns the corresponding address at the same time. However, there are cases where there is no return.

Here I would like to note that one line shows "Non-suthoritativeanswer:", which is not shown in the previous example. Its presence indicates that the result was obtained from the server's cache. So remind you that this is not an authorized answer. In the first few queries we conducted, 192.168.1.104 this machine used the process described in the article that we wrote in the oray.net to query the domain name. In this process, the final results such as Www.oray.net, Test.oray.net, and Oray.net MX records are cached. It also includes intermediate results such as getting the name of the server. The oray.net is implicitly queried for the NS record. We'll also cover the process later.

Specify the name server to use

By default nslookup uses our DNS servers in the native TCP/IP configuration to query, but sometimes we need to specify a specific server for the query experiment. At this time we do not need to change the TCP/IP configuration of the machine, as long as the command after the specified server IP or domain name can be. This parameter is necessary for us to debug a designated server, and we can avoid the results of other server caches by specifying the server's results directly from the servers. The command format is as follows:

nslookup [-qt= type] The DNS server IP or domain name specified by the target domain name

We can look at the following command results:

This command queries the oray.net NS records directly from the top-level domain server. The NS records for all two-level domain names are stored in the top-level domain name server, which is the most authoritative explanation. Note that this time there is no indication of non-authoritative results. For an NS record query for a level two domain name, this is definitely the authorization result. The name of the top-level name server is a to j.gtld-servers.net a total of 10 servers. (gTLD is the abbreviation for global Top level domain). When we modify the NS record of the domain name, we can use the above query to know whether the result of the modification is already in effect on the top-level domain name server. But even if it does, it may not be a normal explanation, note the cache time issue I mentioned in the previous article.

So how long is it going to be cached?

Check the cache time of the domain name

Checking the cache time for a domain name requires that we use a new parameter:-D

The format is as follows:

nslookup–d [other parameters] target domain [specified server address]

See Example

We ignore the other look at the got answer followed by a few lines, including a TTL value. This value is the lifetime of the domain name record.

This kind of query reveals all the parts of the entire DNS packet, and you can see that DNS is actually not as simple as it might seem. The specific sections explain that you can take a look at the relevant standard documentation. You need to be reminded that you must find the answer: the content, the other things are not the final result of the description. There is more than one place and TTL value.

Simulation of domain name interpretation process

Let's now simulate the process of interpreting a DNS server to a domain that is not managed by itself. Recall the process of the first article:

First we'll ask the root server, and then the root server will let us find the corresponding top-level server. If the query is oray.net, we will be asked to find the NET Server.

Take a look at the following example:

Here we let 21cn.com's server explain the domain name of www.oicp.net, it is obvious that this server does not have this domain, need to ask the root server. In general, the DNS server will help us complete the process. This interpretation is called recursive parsing, in order to let everyone see this process my home a parameter let 21cn.com server do not do this. This parameter is-norecurse. This theoretically 21cn.com will let us ask the root server, but since it has cached the records of the top-level servers, it returns the top-level server records for management net directly. In fact, most queries do not need to start from the root server. Everyone sees the address of all the top-level domain servers being returned.

We randomly choose one in which to query.

This time the top-level server returned the Oicp.net server address record. Then we'll query one of these records and we'll be able to get an answer. May be an address, a CNAME record, or tell you that it does not exist.

Nslookup's command is introduced here, in fact Nslookup there are many other parameters. But the usual is the Russian so a few, in addition if people do not like the command line way. There are also several graphical interfaces for the Nslookup functionality of the tool. However, you still need to understand what the domain name interpretation has to be able to use these tools correctly.

Http://www.cnblogs.com/qiubole/archive/2008/01/03/1024550.html

How to use Nslookup tools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.