DNS positive, reverse parse query instruction host, dig, nslookup

Source: Internet
Author: User
Tags dns2 domain server nameserver nslookup

I. Host directive
Format: Host [-A] FQDN [server]
HOST-L domain [Server]
-A: Represents a list of all relevant information about the host, including IP, TTL, and error-removing messages, etc.
-L: If the next domain setting allows Allow-transfer, then list all host name data that the domain manages!

Server: This parameter is optional, when you want to use a non-/etc/resolv.conf DNS host to query the host name and IP correspondence, you can use this parameter!

# 1. Use default values to find out Baidu's IP
[Email protected] ~]# host www.baidu.com
Www.baidu.com is a alias for www.a.shifen.com.
Www.a.shifen.com has address
Www.a.shifen.com has address

# 2. Find out all the important parameters of Baidu
[Email protected] ~]# host-a www.baidu.com
Trying "Www.baidu.com"
;; ->>header<<-opcode:query, Status:noerror, id:51104
;; Flags:qr Rd RA; Query:1, Answer:1, authority:0, additional:0

;; QUESTION section:
; Www.baidu.com.INANY

;; ANSWER section:

Received bytes from in Ms <--sure is the data from the server.

# 3. Force to this DNS server to query

[Email protected] ~]# host linux.vbird.org
Using Domain Server:
Linux.vbird.org has address
Linux.vbird.org Mail is handled by ten linux.vbird.org.

# 4. Find all hosts in the sxjy.com domain

[Email protected] ~]# host-l sxjy.com
; Transfer failed.
; Transfer failed.
Host sxjy.com.sxjy.com not Found:9 (Notauth)
; Transfer failed.

How could it not be able to respond? This response is because the management of vbird.org domain DNS and do not allow our domain query, after all, we are not vbird.org system administrator, of course, do not have permission to read the entire vbird.org domain settings! This "Host-l" is used on its own DNS server, later in this chapter, when it comes to server settings, this option will allow you to read the relevant data.

Second, Nslookup
Format: nslookup [FQDN] [Server]

Options and Parameters:
1. Can be directly in the nslookup with the host name or IP to be queried, [server] is optional;
2. If you do not add any host name or IP after Nslookup, that will enter the Nslookup query function, in the Nslookup query function, you can enter other parameters for special queries,
For example:
Set Type=any: Lists all the information "positive solution profile"
Set TYPE=MX: List MX-related information!

(1) Direct search of Baidu IP information
[email protected] ~]# nslookup www.baidu.com

Non-authoritative Answer:
Www.baidu.comcanonical name = www.a.shifen.com.
address: #百度的一个IP
address: #百度的另一个IP

(2) Direct input nslookup, enter the query interface
[[email protected] ~]# nslookup <== into the nslookup query screen
<== query to perform inverse solution
> www.ksu.edu.tw
<== executing a positive solution query
# The above two lists only the positive and negative information, there is no great place!
> Set Type=any
<== change query, not just a, all the information is listed to
> www.ksu.edu.tw
Non-authoritative Answer:
Address: <== This is the answer.
Authoritative answers can be found from: <== This is the relevant authoritative DNS description
nameserver = dns2.ksu.edu.tw.
nameserver = dns1.ksu.edu.tw.
dns1.ksu.edu.tw Internet address =
dns2.ksu.edu.tw Internet address =
> Exit <== leave now! Pikachu

Third, dig
Format: Dig [options] FQDN [@server]

Options and Parameters:
@server: If you do not use the/etc/resolv.conf setting as a DNS query, you can fill in the
Into the other IP
Options: A number of relevant parameters, mainly +trace,-t type and-X are the most commonly used
+trace: It's from. Start tracking and talk in 19.1.2! Look back!
-T type: The query data mainly has MX, NS, SOA and other types,
-x: Query anti-solution information, very important items!

(1) To see the DNS query process
[Email protected] ~]# dig +trace www.baidu.com

; <<>> DiG 9.8.2rc1-redhat-9.8.2-0.37.rc1.el6 <<>> +trace www.baidu.com
;; Global options: +cmd
;; Received 228 bytes from ( in 327 ms
# The upper part is being traced. Server, from a to m.root-servers.net.

;; Received 491 bytes from ( in 706 ms
# The above section is on the server that tracks COM.

;; Received 201 bytes from ( in

;; Received 228 bytes from ( in MS
Let's look at the entire DNS search process! This is achieved by adding the +trace option to the dig. As for the other is the server (NS) Set value and tracking process Oh! Is it clear?

(2) querying with default values

[Email protected] ~]# dig www.baidu.com

; <<>> DiG 9.8.2rc1-redhat-9.8.2-0.37.rc1.el6 <<>> www.baidu.com
;; Global options: +cmd
;; Got Answer:
;; ->>header<<-opcode:query, Status:noerror, id:45046
;; Flags:qr Rd RA; Query:1, Answer:3, authority:0, additional:0

;; QUESTION section:
Www.baidu.com.INA <== raised the question part of asking Baidu's IP

;; ANSWER section: <== main answer stage, answer Baidu's IP

;; Query time:19 msec
;; server: (
;; When:sun Mar 6 21:16:03 2016
;; MSG SIZE rcvd:90

QUESTION (problem): Displays the content to be queried, because we are querying the IP of linux.vbird.org, so here A (Address) is displayed;
ANSWER (answer): According to just QUESTION to query the results obtained, the answer is to answer IP Ah!

(2) Query linux.vbird.org for SOA information!
[Email protected] ~]# dig-t SOA linux.vbird.org
; <<>> DiG 9.7.0-p2-redhat-9.7.0-5.p2.el6_0.1 <<>>-T SOA linux.vbird.org
;; Global options: +cmd
;; Got Answer:
;; ->>header<<-opcode:query, Status:noerror, id:57511
;; Flags:qr Rd RA
; Query:1, answer:0, Authority:1, additional:0

;; QUESTION section:
; linux.vbird.org. In SOA

;; Authority section:
vbird.org. In SOA dns.vbird.org. root.dns.vbird.org. 2007091402 28800 7200 720000 86400

;; Query time:17 msec
;; server: (
;; When:thu 4 14:15:57 2011

Because the output information of dig is too rich, and divided into several parts to return, so it is suitable as a DNS tracking return of an instruction! You can use this command to find out if the DNS database you have set is correct and error-removing. ^_^! In addition, you can use the "-t type" function to query other server settings, you can set the DNS server for reference Oh! Positive solution query is complete, then play a game of anti-solution! # 3. Query the result of information

(3) Query (Baidu) Anti-analysis
[Email protected] ~]# dig-x

; <<>> DiG 9.8.2rc1-redhat-9.8.2-0.37.rc1.el6 <<>>-X
;; Global options: +cmd
;; Got Answer:
;; ->>header<<-opcode:query, Status:nxdomain, id:20695
;; Flags:qr Rd RA; Query:1, answer:0, Authority:1, additional:0

;; QUESTION section:
; In PTR

;; Authority section:
80.112.in-addr.arpa. 5 in SOA ns1.jscnc.net. Root.ns1.jscnc.net. 2010070723 10800 3600 604800 3600

;; Query time:31 msec
;; server: (
;; When:mon Mar 7 06:28:39 2016
;; MSG SIZE rcvd:98
The inverse solution is quite interesting! From the above output, the query target of the inverse solution turns from to 80.112.in-addr.arpa. What the hell is this thing? Don't be afraid, we'll explain it further when we talk about the counter-solution. What you need to know now is that the query domain name of the inverse solution is not quite the same as the positive solution, especially the weird in-addr.arpa. The end of the data can be written down first.

DNS positive, anti-parsing query instruction host, dig, nslookup

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.