DNS解析工具--nslookup和dig使用

1、nslookup使用

[root@master ~]# nslookup
> server 8.8.8.8    #指定域名服务器
Default server: 8.8.8.8
Address: 8.8.8.8#53
> www.baidu.com
Server: 8.8.8.8
Address: 8.8.8.8#53

Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
www.a.shifen.com canonical name = www.wshifen.com.
Name: www.wshifen.com
Address: 103.235.46.39     #解析结果


2、dig的使用

yum -y install bind-utils  #安装dig命令

格式如下:
@:来指定域名服务器
-t :指定要解析的类型
A:为解析类型,A记录

[root@master ~]# dig -t A www.baidu.com @8.8.8.8

; <<>> DiG 9.9.4-RedHat-9.9.4-73.el7_6 <<>> -t A www.baidu.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55539
;; 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. 1149 IN CNAME www.a.shifen.com.
www.a.shifen.com. 8 IN CNAME www.wshifen.com.
www.wshifen.com. 31 IN A 103.235.46.39    #解析结果

;; Query time: 54 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: 四 3月 21 14:45:16 CST 2019
;; MSG SIZE rcvd: 111

原文地址:https://www.cnblogs.com/chuangcc/p/10571697.html