DNS是计算机域名系统(Domain Name System 或Domain Name Service) 的缩写,它是由域名解析器和域名服务器组成的。域名服务器是指保存有该网络中所有主机的域名和对应IP地址,并具有将域名转换为IP地址功能的服务器。
DNS是计算机域名系统(Domain Name System 或Domain Name Service) 的缩写,它是由域名解析器和域名服务器组成的。域名服务器是指保存有该网络中所有主机的域名和对应IP地址,并具有将域名转换为IP地址功能的服务器。
查看/etc/resolv.con文件
[root@localhost ~]# cat /etc/resolv.conf
nameserver 192.168.xxx.xxx
#search localdomain
[root@localhost ~]#
使用nslookup命令查看DNS信息
[root@localhost ~]# nslookup 127.0.0.1 | grep Server
Server: 192.168.xxx.xxx
[root@localhost ~]#
使用dig命令来查看DNS信息
root@localhost ~]# dig
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>>
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36888
;; 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