Linux下DNS查询命令使用host、dig、nslookup。
一、安装软件包
Centos:
一般格式:
常用选项:
举例:
一般格式:
参数说明:
d-opt常用选项:
举例: # dig www.163.com ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> www.163.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60034 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.163.com. IN A ;; ANSWER SECTION: www.163.com. 40 IN CNAME www.163.com.lxdns.com. www.163.com.lxdns.com. 600 IN CNAME 163.xdwscache.glb0.lxdns.com. 163.xdwscache.glb0.lxdns.com. 120 IN A 113.107.76.19 ;; Query time: 779 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Fri Jan 31 03:23:36 2014 ;; MSG SIZE rcvd: 110
# dig +trace www.163.com ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> +trace www.163.com ;; global options: +cmd . 8854 IN NS f.root-servers.net. . 8854 IN NS c.root-servers.net. . 8854 IN NS d.root-servers.net. . 8854 IN NS k.root-servers.net. . 8854 IN NS a.root-servers.net. . 8854 IN NS b.root-servers.net. . 8854 IN NS i.root-servers.net. . 8854 IN NS g.root-servers.net. . 8854 IN NS j.root-servers.net. . 8854 IN NS m.root-servers.net. . 8854 IN NS e.root-servers.net. . 8854 IN NS h.root-servers.net. . 8854 IN NS l.root-servers.net. ;; Received 228 bytes from 8.8.8.8#53(8.8.8.8) in 583 ms com. 172800 IN NS j.gtld-servers.net. com. 172800 IN NS b.gtld-servers.net. com. 172800 IN NS k.gtld-servers.net. com. 172800 IN NS l.gtld-servers.net. com. 172800 IN NS h.gtld-servers.net. com. 172800 IN NS f.gtld-servers.net. com. 172800 IN NS m.gtld-servers.net. com. 172800 IN NS g.gtld-servers.net. com. 172800 IN NS d.gtld-servers.net. com. 172800 IN NS c.gtld-servers.net. com. 172800 IN NS i.gtld-servers.net. com. 172800 IN NS a.gtld-servers.net. com. 172800 IN NS e.gtld-servers.net. ;; Received 501 bytes from 192.33.4.12#53(192.33.4.12) in 542 ms 163.com. 172800 IN NS ns2.nease.net. 163.com. 172800 IN NS ns3.nease.net. 163.com. 172800 IN NS ns4.nease.net. 163.com. 172800 IN NS ns5.nease.net. 163.com. 172800 IN NS ns6.nease.net. 163.com. 172800 IN NS ns1.nease.net. ;; Received 242 bytes from 192.43.172.30#53(192.43.172.30) in 471 ms www.163.com. 600 IN CNAME www.163.com.lxdns.com. ;; Received 61 bytes from 61.135.255.140#53(61.135.255.140) in 278 ms
一般格式:
参数说明:
set命令说明: 具体说明可以查看man手册。 举例: # nslookup www.163.com 4.2.2.2 Server: 4.2.2.2 Address: 4.2.2.2#53 Non-authoritative answer: www.163.com canonical name = www.163.com.lxdns.com. www.163.com.lxdns.com canonical name = 163.xdwscache.glb0.lxdns.com. Name: 163.xdwscache.glb0.lxdns.com Address: 113.107.76.19 (责任编辑:IT) |