1. 程式人生 > >用host, nslookup, dig命令來查dns

用host, nslookup, dig命令來查dns

[email protected]:~$ host www.baidu.com
www.baidu.com is an alias for www.a.shifen.com.
www.a.shifen.com has address 115.239.211.112
www.a.shifen.com has address 115.239.210.27
[email protected]:~$ 
[email protected]:~$ 
[email protected]:~$ 
[email protected]:~$ nslookup www.baidu.com
Server:         183.60.83.19
Address:        183.60.83.19#53

Non-authoritative answer:
www.baidu.com   canonical name = www.a.shifen.com.
Name:   www.a.shifen.com
Address: 115.239.210.27
Name:   www.a.shifen.com
Address: 115.239.211.112

[email protected]
:~$ [email protected]:~$ [email protected]:~$ [email protected]:~$ dig www.baidu.com ; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.baidu.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21805 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;www.baidu.com. IN A ;; ANSWER SECTION: www.baidu.com. 123 IN CNAME www.a.shifen.com. www.a.shifen.com. 286 IN A 115.239.211.112 www.a.shifen.com. 286 IN A 115.239.210.27 ;; Query time: 1 msec ;; SERVER: 183.60.83.19#53(183.60.83.19) ;; WHEN: Tue Oct 23 18:58:16 CST 2018 ;; MSG SIZE rcvd: 101
[email protected]
:~$ [email protected]:~$ [email protected]:~$ [email protected]:~$ dig @8.8.8.8 www.baidu.com ; <<>> DiG 9.10.3-P4-Ubuntu <<>> @8.8.8.8 www.baidu.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9526 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;www.baidu.com. IN A ;; ANSWER SECTION: www.baidu.com. 1067 IN CNAME www.a.shifen.com. www.a.shifen.com. 299 IN A 115.239.211.112 www.a.shifen.com. 299 IN A 115.239.210.27 ;; Query time: 88 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Tue Oct 23 18:58:36 CST 2018 ;; MSG SIZE rcvd: 101
[email protected]
:~$

          注意下那個Query time, 其餘的不多說。