CentOS dig,nslookup,hostコマンドのインストール(bind-utils)

はじめに
===

CentOS 6をminimalインストールすると、デフォルトでは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 release 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 ~]#
```

***

以上になります。