コンテンツ
コマンド一つでかんたんにできます!
コマンドを実行するために必要なソフトのインストール
sudo apt-get install dnsutils
インストール時の様子
sudo apt-get install dnsutils Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: bind9-host libbind9-90 libdns100 libisc95 libisccfg90 liblwres90 Suggested packages: rblcheck The following NEW packages will be installed: dnsutils The following packages will be upgraded: bind9-host libbind9-90 libdns100 libisc95 libisccfg90 liblwres90 6 upgraded, 1 newly installed, 0 to remove and 143 not upgraded. Need to get 1,063 kB of archives. After this operation, 326 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main bind9-host armhf 1:9.9.5.dfsg-9+deb8u5 [65.1 kB] Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main libisc95 armhf 1:9.9.5.dfsg-9+deb8u5 [149 kB] Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main libdns100 armhf 1:9.9.5.dfsg-9+deb8u5 [598 kB] Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main libisccfg90 armhf 1:9.9.5.dfsg-9+deb8u5 [49.8 kB] Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main libbind9-90 armhf 1:9.9.5.dfsg-9+deb8u5 [40.7 kB] Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main liblwres90 armhf 1:9.9.5.dfsg-9+deb8u5 [47.3 kB] Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main dnsutils armhf 1:9.9.5.dfsg-9+deb8u5 [113 kB] Fetched 1,063 kB in 3s (343 kB/s) (Reading database ... 149326 files and directories currently installed.) Preparing to unpack .../bind9-host_1%3a9.9.5.dfsg-9+deb8u5_armhf.deb ... Unpacking bind9-host (1:9.9.5.dfsg-9+deb8u5) over (1:9.9.5.dfsg-9+deb8u3) ... Preparing to unpack .../libisc95_1%3a9.9.5.dfsg-9+deb8u5_armhf.deb ... Unpacking libisc95 (1:9.9.5.dfsg-9+deb8u5) over (1:9.9.5.dfsg-9+deb8u3) ... Preparing to unpack .../libdns100_1%3a9.9.5.dfsg-9+deb8u5_armhf.deb ... Unpacking libdns100 (1:9.9.5.dfsg-9+deb8u5) over (1:9.9.5.dfsg-9+deb8u3) ... Preparing to unpack .../libisccfg90_1%3a9.9.5.dfsg-9+deb8u5_armhf.deb ... Unpacking libisccfg90 (1:9.9.5.dfsg-9+deb8u5) over (1:9.9.5.dfsg-9+deb8u3) ... Preparing to unpack .../libbind9-90_1%3a9.9.5.dfsg-9+deb8u5_armhf.deb ... Unpacking libbind9-90 (1:9.9.5.dfsg-9+deb8u5) over (1:9.9.5.dfsg-9+deb8u3) ... Preparing to unpack .../liblwres90_1%3a9.9.5.dfsg-9+deb8u5_armhf.deb ... Unpacking liblwres90 (1:9.9.5.dfsg-9+deb8u5) over (1:9.9.5.dfsg-9+deb8u3) ... Selecting previously unselected package dnsutils. Preparing to unpack .../dnsutils_1%3a9.9.5.dfsg-9+deb8u5_armhf.deb ... Unpacking dnsutils (1:9.9.5.dfsg-9+deb8u5) ... Processing triggers for man-db (2.7.0.2-5) ... Setting up libisc95 (1:9.9.5.dfsg-9+deb8u5) ... Setting up libdns100 (1:9.9.5.dfsg-9+deb8u5) ... Setting up libisccfg90 (1:9.9.5.dfsg-9+deb8u5) ... Setting up libbind9-90 (1:9.9.5.dfsg-9+deb8u5) ... Setting up liblwres90 (1:9.9.5.dfsg-9+deb8u5) ... Setting up bind9-host (1:9.9.5.dfsg-9+deb8u5) ... Setting up dnsutils (1:9.9.5.dfsg-9+deb8u5) ... Processing triggers for libc-bin (2.19-18+deb8u1) ...
使い方の例
以下のコマンドを実行すると、ドメイン「www.google.co.jp」をDNSサーバに問い合わせます
host www.google.co.jp
実行例
pi@raspberrypi:~ $ host www.google.co.jp www.google.co.jp has address 202.224.62.114 www.google.co.jp has address 202.224.62.118 www.google.co.jp has address 202.224.62.104 www.google.co.jp has address 202.224.62.93 www.google.co.jp has address 202.224.62.119 www.google.co.jp has address 202.224.62.99 www.google.co.jp has address 202.224.62.123 www.google.co.jp has address 202.224.62.108 www.google.co.jp has address 202.224.62.103 www.google.co.jp has address 202.224.62.113 www.google.co.jp has address 202.224.62.109 www.google.co.jp has address 202.224.62.84 www.google.co.jp has address 202.224.62.88 www.google.co.jp has address 202.224.62.98 www.google.co.jp has address 202.224.62.94 www.google.co.jp has address 202.224.62.89
解説
hostコマンドは、DNSサーバに問い合わせを行うためのコマンドです。DNSサーバがきちんと動作しているかを確認するときに、使用されます。DNSサーバに問い合わせを行うコマンドには、他に「dig」コマンドや「nslookup」コマンドがあります。hostコマンドはDNSサーバに問い合わせを行うときに使用するコマンドのうち、もっともシンプルなコマンドです。
ラズベリーパイでネットワークの勉強をする時にすごく便利だと思います!