您当前的位置:首页 > 计算机 > 系统应用 > Linux

Linux:使用nslookup和dig查询DNS记录信息

时间:03-16来源:作者:点击数:

nslookup

nslookup(Name Server Lookup)用于从 DNS 服务器查询域名、IP 或其他 DNS 记录信息

示例

查询域名信息

$ nslookup baidu.com

Server:     114.114.114.114
Address:    114.114.114.114#53

Non-authoritative answer:
Name:   baidu.com
Address: 39.156.66.10
Name:   baidu.com
Address: 110.242.68.66

查询域名对应的文本信息

$ nslookup  -q=TXT baidu.com

Server:     114.114.114.114
Address:    114.114.114.114#53

Non-authoritative answer:
baidu.com   text = "_globalsign-domain-verification=qjb28W2jJSrWj04NHpB0CvgK9tle5JkOq-EcyWBgnE"
baidu.com   text = "google-site-verification=GHb98-6msqyx_qqjGl5eRatD3QTHyVB6-xQ3gJB5UwM"
baidu.com   text = "v=spf1 include:spf1.baidu.com include:spf2.baidu.com include:spf3.baidu.com include:spf4.baidu.com mx ptr -all"
baidu.com   text = "9279nznttl321bxp1j464rd9vpps246v"

Authoritative answers can be found from:

参考文章

DIG

DIG命令(Domain Information Groper命令)用于进行不同的DNS(域名系统)查询

使用示例

基本使用

$ dig www.baidu.com

; <<>> DiG 9.10.6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20828
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.baidu.com.         IN  A

;; ANSWER SECTION:
www.baidu.com.      300 IN  CNAME   www.a.shifen.com.
www.a.shifen.com.   300 IN  A   110.242.68.3
www.a.shifen.com.   300 IN  A   110.242.68.4

;; Query time: 8 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: Fri Mar 01 14:32:50 CST 2024
;; MSG SIZE  rcvd: 90

查看简易信息

$ dig www.baidu.com +short

www.a.shifen.com.
110.242.68.3
110.242.68.4

查看 TXT记录

$ dig google.com TXT

; <<>> DiG 9.10.6 <<>> google.com TXT
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32043
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com.            IN  TXT

;; ANSWER SECTION:
google.com.     31  IN  TXT "docusign=1b0a6754-49b1-4db5-8540-d2c12664b289"
google.com.     31  IN  TXT "globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="
google.com.     31  IN  TXT "webexdomainverification.8YX6G=6e6922db-e3e6-4a36-904e-a805c28087fa"
google.com.     31  IN  TXT "MS=E4A68B9AB2BB9670BCE15412F62916164C0B20BB"
google.com.     31  IN  TXT "facebook-domain-verification=22rm551cu4k0ab0bxsw536tlds4h95"
google.com.     31  IN  TXT "atlassian-domain-verification=5YjTmWmjI92ewqkx2oXmBaD60Td9zWon9r6eakvHX6B77zzkFQto8PQ9QsKnbf4I"

;; Query time: 15 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: Fri Mar 01 14:35:01 CST 2024
;; MSG SIZE  rcvd: 488

参考文章

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门