CentOS安装dig, nslookup, host命令(bind-utils)

首先

CentOS 6进行最小安装时,默认情况下不会安装用于DNS名解析测试的dig、nslookup和host命令。

[root@example-CentOS-6 ~]# which host
/usr/bin/which: no host in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@example-CentOS-6 ~]# which dig
/usr/bin/which: no dig in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@example-CentOS-6 ~]# which nslookup
/usr/bin/which: no nslookup in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@example-CentOS-6 ~]#

如果要在CentOS 6上安装dig, nslookup, host命令,可以安装bind-utils。

[root@example-CentOS-6 ~]# yum -y install bind-utils

目前适用环境

CentOS发布6.6版本(2.6.32-504.8.1.el6.x86_64)

安装 bind-utils

安装bind-utils。

[root@example-CentOS-6 ~]# yum -y install bind-utils

通过安装bind-utils,您将安装dig、nslookup和host命令。

[root@example-CentOS-6 ~]# which dig
/usr/bin/dig
[root@example-CentOS-6 ~]# which host
/usr/bin/host
[root@example-CentOS-6 ~]# which nslookup
/usr/bin/nslookup
[root@example-CentOS-6 ~]#

通过dig、nslookup和host命令,可以进行DNS名称解析测试。

[root@example-CentOS-6 ~]# dig www.example.com +trace

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.1 <<>> www.example.com +trace
;; global options: +cmd
.                       518400  IN      NS      M.ROOT-SERVERS.NET.
.                       518400  IN      NS      A.ROOT-SERVERS.NET.
.                       518400  IN      NS      B.ROOT-SERVERS.NET.
.                       518400  IN      NS      C.ROOT-SERVERS.NET.
.                       518400  IN      NS      D.ROOT-SERVERS.NET.
.                       518400  IN      NS      E.ROOT-SERVERS.NET.
.                       518400  IN      NS      F.ROOT-SERVERS.NET.
.                       518400  IN      NS      G.ROOT-SERVERS.NET.
.                       518400  IN      NS      H.ROOT-SERVERS.NET.
.                       518400  IN      NS      I.ROOT-SERVERS.NET.
.                       518400  IN      NS      J.ROOT-SERVERS.NET.
.                       518400  IN      NS      K.ROOT-SERVERS.NET.
.                       518400  IN      NS      L.ROOT-SERVERS.NET.
;; Received 496 bytes from 172.31.0.2#53(172.31.0.2) in 9 ms

com.                    172800  IN      NS      i.gtld-servers.net.
com.                    172800  IN      NS      e.gtld-servers.net.
com.                    172800  IN      NS      a.gtld-servers.net.
com.                    172800  IN      NS      g.gtld-servers.net.
com.                    172800  IN      NS      c.gtld-servers.net.
com.                    172800  IN      NS      l.gtld-servers.net.
com.                    172800  IN      NS      k.gtld-servers.net.
com.                    172800  IN      NS      h.gtld-servers.net.
com.                    172800  IN      NS      m.gtld-servers.net.
com.                    172800  IN      NS      j.gtld-servers.net.
com.                    172800  IN      NS      f.gtld-servers.net.
com.                    172800  IN      NS      d.gtld-servers.net.
com.                    172800  IN      NS      b.gtld-servers.net.
;; Received 493 bytes from 192.112.36.4#53(192.112.36.4) in 79 ms

example.com.            172800  IN      NS      a.iana-servers.net.
example.com.            172800  IN      NS      b.iana-servers.net.
;; Received 169 bytes from 192.48.79.30#53(192.48.79.30) in 143 ms

www.example.com.        86400   IN      A       93.184.216.34
example.com.            172800  IN      NS      b.iana-servers.net.
example.com.            172800  IN      NS      a.iana-servers.net.
;; Received 185 bytes from 199.43.133.53#53(199.43.133.53) in 125 ms

[root@example-CentOS-6 ~]#
[root@example-CentOS-6 ~]# host -t ns example.com b.iana-servers.net
Using domain server:
Name: b.iana-servers.net
Address: 199.43.133.53#53
Aliases:

example.com name server b.iana-servers.net.
example.com name server a.iana-servers.net.
[root@example-CentOS-6 ~]#
[root@example-CentOS-6 ~]# nslookup a.iana-servers.net.
Server:         XX.XX.XX.XX
Address:        XX.XX.XX.XX#53

Non-authoritative answer:
Name:   a.iana-servers.net
Address: 199.43.132.53

[root@example-CentOS-6 ~]#

以上就是。

广告
将在 10 秒后关闭
bannerAds