DNS域名解析命令 —— host
阿新 • • 發佈:2019-07-21
命令host
-
用途: 使用域名伺服器查詢主機名字
-
語法:
]# host [選項] 主機名 [伺服器]
-
常用選項:
-t 指定查詢的域名資訊型別 A CERT DNAME IPSECKEY MX NSEC3 RRSIG SRV AAAA CNAME DNSKEY KEY NAPTR NSEC3PARAM SIG SSHFP AFSDB DHCID DS KX NS PTR SOA TXT APL DLV HIP LOC NSEC RP SPF -r 不使用遞迴的查詢方式查詢域名,只返回它自身資料庫的資料 -m 設定記憶體除錯標誌(trace跟蹤|record記錄|usage使用情況) -a 顯示詳細的DNS資訊,等同於-v -t ANY -v 顯示指令執行的詳細資訊 -d 開啟除錯,等同於-v -c 指定查詢型別,預設值為“IN” -C 查詢指定主機的完整的SOA記錄 -l 使用AXFR列出域中的所有主機,執行全部的區域傳輸, 然後過濾出要求的資訊,輕易不要使用 -i IP6.INT反向解析 -R 指定UDP資料包的重試次數 -T 啟用TCP/IP模式 -w 持續等待應答,直到域名伺服器給出結果 -W 指定域名查詢的最長時間,如果在指定時間內域名伺服器沒有給出應答資訊則退出 -4 預設,使用IPv4查詢傳輸 -6 使用IPv6查詢傳輸
-
例項:
-
查詢域名對應的ip地址
]# host www.aliyun.com www.aliyun.com is an alias for www-jp-de-intl-adns.aliyun.com. www-jp-de-intl-adns.aliyun.com is an alias for www-jp-de-intl-adns.aliyun.com.gds.alibabadns.com. www-jp-de-intl-adns.aliyun.com.gds.alibabadns.com is an alias for sh.wagbridge.aliyun.aliyun.com. sh.wagbridge.aliyun.aliyun.com is an alias for aliyun-adns.aliyun.com. aliyun-adns.aliyun.com is an alias for aliyun-adns.aliyun.com.gds.alibabadns.com. aliyun-adns.aliyun.com.gds.alibabadns.com has address 106.11.62.15 aliyun-adns.aliyun.com.gds.alibabadns.com has IPv6 address 2401:b180:1:50::2 aliyun-adns.aliyun.com.gds.alibabadns.com has IPv6 address 2401:b180:1:60::3
-
查詢域名的詳細資訊
]# host -v www.aliyun.com Trying "www.aliyun.com" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34469 ;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.aliyun.com. IN A ;; ANSWER SECTION: www.aliyun.com. 5 IN CNAME www-jp-de-intl-adns.aliyun.com. www-jp-de-intl-adns.aliyun.com. 5 IN CNAME www-jp-de-intl-adns.aliyun.com.gds.alibabadns.com. www-jp-de-intl-adns.aliyun.com.gds.alibabadns.com. 5 IN CNAME sh.wagbridge.aliyun.aliyun.com. sh.wagbridge.aliyun.aliyun.com. 5 IN CNAME aliyun-adns.aliyun.com. aliyun-adns.aliyun.com. 5 IN CNAME aliyun-adns.aliyun.com.gds.alibabadns.com. aliyun-adns.aliyun.com.gds.alibabadns.com. 5 IN A 140.205.135.3 Received 228 bytes from 192.168.199.2#53 in 18 ms Trying "aliyun-adns.aliyun.com.gds.alibabadns.com" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56063 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;aliyun-adns.aliyun.com.gds.alibabadns.com. IN AAAA ;; ANSWER SECTION: aliyun-adns.aliyun.com.gds.alibabadns.com. 5 IN AAAA 2401:b180:1:50::2 aliyun-adns.aliyun.com.gds.alibabadns.com. 5 IN AAAA 2401:b180:1:60::3 Received 115 bytes from 192.168.199.2#53 in 16 ms Trying "aliyun-adns.aliyun.com.gds.alibabadns.com" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59837 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;aliyun-adns.aliyun.com.gds.alibabadns.com. IN MX ;; AUTHORITY SECTION: gds.alibabadns.com. 5 IN SOA gdsns1.alibabadns.com. none. 2018122017 1800 600 3600 360 Received 106 bytes from 192.168.199.2#53 in 20 ms
-
查詢域名的MX記錄
]# host -t MX www.aliyun.com www.aliyun.com is an alias for www-jp-de-intl-adns.aliyun.com. www-jp-de-intl-adns.aliyun.com is an alias for www-jp-de-intl-adns.aliyun.com.gds.alibabadns.com. www-jp-de-intl-adns.aliyun.com.gds.alibabadns.com is an alias for sh.wagbridge.aliyun.aliyun.com. sh.wagbridge.aliyun.aliyun.com is an alias for aliyun-adns.aliyun.com. aliyun-adns.aliyun.com is an alias for aliyun-adns.aliyun.com.gds.alibabadns.com.
-