linux下我们要查看服务器的DNS信息可以通过命令来实现,下面由学习啦小编为大家整理了linux查看dns命令的相关知识,希望对大家有帮助!
linux查看dns命令1:查看/etc/resolv.con文件
[root@localhost ~]# cat /etc/resolv.conf
nameserver 192.168.xxx.xxx
#search localdomain
[root@localhost ~]#
linux查看dns命令2:使用nslookup命令查看DNS信息
[root@localhost ~]# nslookup 127.0.0.1 | grep Server
Server: 192.168.xxx.xxx
[root@localhost ~]#
linux查看dns命令3:使用dig命令来查看DNS信息
root@localhost ~]# dig
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>>
;; global options: printcmd
;; Got answer:
;; ->>HEADER<
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 3
;; QUESTION SECTION:
;. IN NS
;; ANSWER SECTION:
. 86163 IN NS m.root-servers.net.
. 86163 IN NS a.root-servers.net.
. 86163 IN NS j.root-servers.net.
. 86163 IN NS l.root-servers.net.
. 86163 IN NS e.root-servers.net.
. 86163 IN NS d.root-servers.net.
. 86163 IN NS k.root-servers.net.
. 86163 IN NS f.root-servers.net.
. 86163 IN NS h.root-servers.net.
. 86163 IN NS c.root-servers.net.
. 86163 IN NS g.root-servers.net.
. 86163 IN NS b.root-servers.net.
. 86163 IN NS i.root-servers.net.
;; ADDITIONAL SECTION:
a.root-servers.net. 3599 IN A 112.4.20.71
b.root-servers.net. 86163 IN A 192.228.79.201
i.root-servers.net. 86173 IN A 192.36.148.17
;; Query time: 8 msec
;; SERVER: 192.168.xxx.xxx#53(192.168.xxx.xxx)
;; WHEN: Sat Apr 16 07:34:37 2016
;; MSG SIZE rcvd: 289
[root@localhost ~]# dig | grep SERVER: | awk -F# ‘{ print $1 }’ | awk -F: ‘{ print $2 }’
192.168.xxx.xxx
linux查看dns命令4:其它一些方法查看DNS信息
在网上看到还有一些其他方法,查看服务器的DNS配置信息,如下所示,不过这些方法,由于环境限制,我没有验证过,仅供参考。
nm-tool | grep DNS
nmcli dev list iface eth0 | grep IP4
本文链接:https://www.kinber.cn/post/3023.html 转载需授权!
推荐本站淘宝优惠价购买喜欢的宝贝: