Ubuntu 18環境でネットワーク経路を確認しようとtracerouteコマンドを使おうとしたら入ってなかったのでシュパッとインストールする
tracerouteコマンドとは
特定のIPやホストへのネットワーク経路や疎通を確認するためのコマンド
詳しくは:
Ubuntu 18.04.2 LTSにはデフォルトではインストールされていない
インフラ屋か、構築直後しか使わないし、しょうがないね
$ traceroute Command 'traceroute' not found, but can be installed with: sudo apt install inetutils-traceroute sudo apt install traceroute
おや、二個勧められたぞ?
inetutils-tracerouteは、GNUのやつなので安心感がありそう
tracerouteは、少ない権限で動いたり何かモダンらしい (SOURCEFORGEのdescription読んだだけw)
inetutils-tracerouteとtraceroute、どちらを使うべきか?
ぱっと調べた感じではtracerouteがおすすめっぽい
理由は、それぞれで blog.pinkumohikan.com
への経路を調べたところ、 inetutils-traceroute ではオプションいじいじしても目的ホストまでたどり着けなかったが traceroute を使えばすんなりたどり着けたため
この記事も参考にした:
ということでtracerouteのパッケージをインストール
$ sudo apt install traceroute Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: traceroute 0 upgraded, 1 newly installed, 0 to remove and 9 not upgraded. Need to get 45.4 kB of archives. After this operation, 152 kB of additional disk space will be used. Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu bionic/universe amd64 traceroute amd64 1:2.1.0-2 [45.4 kB] Fetched 45.4 kB in 1s (35.1 kB/s) Selecting previously unselected package traceroute. (Reading database ... 175935 files and directories currently installed.) Preparing to unpack .../traceroute_1%3a2.1.0-2_amd64.deb ... Unpacking traceroute (1:2.1.0-2) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Setting up traceroute (1:2.1.0-2) ... update-alternatives: using /usr/bin/traceroute.db to provide /usr/bin/traceroute (traceroute) in auto mode update-alternatives: using /usr/bin/lft.db to provide /usr/bin/lft (lft) in auto mode update-alternatives: using /usr/bin/traceproto.db to provide /usr/bin/traceproto (traceproto) in auto mode update-alternatives: using /usr/sbin/tcptraceroute.db to provide /usr/sbin/tcptraceroute (tcptraceroute) in auto mode
すんなり入った
$ traceroute --version Modern traceroute for Linux, version 2.1.0 Copyright (c) 2016 Dmitry Butskoy, License: GPL v2 or any later
お試しで調査してみる
$ traceroute --icmp blog.pinkumohikan.com You do not have enough privileges to use this traceroute method. socket: Operation not permitted
おおん!? 少ない権限で動くとは何だったのか
$ sudo traceroute --icmp blog.pinkumohikan.com traceroute to blog.pinkumohikan.com (13.115.18.61), 30 hops max, 60 byte packets 1 xxx.g.tyo1.static.cnode.io (xxx.xxx.xxx.xxx) 0.918 ms 0.988 ms 1.096 ms 2 g-o-4eb-a13-4-v-712.interq.or.jp (157.7.41.129) 6.723 ms 6.833 ms 6.961 ms 3 unused-133-130-013-013.interq.or.jp (133.130.13.13) 0.754 ms 0.855 ms 0.965 ms 4 unused-133-130-012-034.interq.or.jp (133.130.12.34) 0.856 ms 0.965 ms 1.029 ms 5 16509.tyo.equinix.com (203.190.230.53) 0.600 ms 0.604 ms 0.604 ms 6 * * * 7 * * * 8 54.239.52.93 (54.239.52.93) 2.063 ms 1.693 ms 1.560 ms 9 52.95.30.38 (52.95.30.38) 0.560 ms 0.566 ms 0.651 ms 10 * * * 11 * * * 12 * * * 13 52.95.31.55 (52.95.31.55) 2.160 ms 2.135 ms 2.151 ms 14 52.95.31.173 (52.95.31.173) 1.720 ms 1.692 ms 1.691 ms 15 52.95.31.158 (52.95.31.158) 3.173 ms 3.199 ms 3.215 ms 16 52.95.31.72 (52.95.31.72) 2.948 ms 3.509 ms 3.500 ms 17 * * * 18 * * * 19 * * * 20 * * * 21 * * * 22 * * * 23 * * * 24 * * * 25 * * * 26 * * * 27 * * * 28 * * * 29 * * * 30 * * *
失敗しとるやんけw
ICMPだと無理っぽいけど、TCP SYNを使うモードを見つけたので試してみる
$ sudo traceroute --tcp blog.pinkumohikan.com traceroute to blog.pinkumohikan.com (13.115.18.61), 30 hops max, 60 byte packets 1 xxx.g.tyo1.static.cnode.io (xxx.xxx.xxx.xxx) 0.910 ms 1.024 ms 1.045 ms 2 g-o-4eb-a13-4-v-712.interq.or.jp (157.7.41.129) 1.107 ms 1.326 ms 1.527 ms 3 unused-133-130-013-013.interq.or.jp (133.130.13.13) 0.614 ms 0.630 ms 0.619 ms 4 unused-133-130-012-034.interq.or.jp (133.130.12.34) 0.774 ms 0.717 ms 0.844 ms 5 16509.tyo.equinix.com (203.190.230.53) 1.041 ms 1.033 ms 1.030 ms 6 * * * 7 * * * 8 54.239.52.89 (54.239.52.89) 1.954 ms 54.239.52.103 (54.239.52.103) 9.649 ms 54.239.52.107 (54.239.52.107) 1.492 ms 9 52.95.30.44 (52.95.30.44) 0.988 ms 52.95.30.48 (52.95.30.48) 0.996 ms 52.95.30.60 (52.95.30.60) 0.870 ms 10 * * * 11 * * * 12 * * * 13 52.95.31.19 (52.95.31.19) 2.169 ms 52.95.31.43 (52.95.31.43) 2.507 ms 52.95.31.47 (52.95.31.47) 2.097 ms 14 52.95.31.221 (52.95.31.221) 2.020 ms 52.95.31.183 (52.95.31.183) 2.802 ms 52.95.31.215 (52.95.31.215) 2.092 ms 15 52.95.31.168 (52.95.31.168) 2.189 ms 52.95.31.188 (52.95.31.188) 4.170 ms 52.95.31.172 (52.95.31.172) 3.172 ms 16 52.95.31.86 (52.95.31.86) 2.249 ms 52.95.31.72 (52.95.31.72) 3.035 ms 2.943 ms 17 27.0.0.158 (27.0.0.158) 2.431 ms * * 18 * * * 19 * * * 20 * * * 21 * * * 22 * * * 23 ec2-13-115-18-61.ap-northeast-1.compute.amazonaws.com (13.115.18.61) 1.688 ms 2.683 ms 2.617 ms 24 ec2-13-115-18-61.ap-northeast-1.compute.amazonaws.com (13.115.18.61) 1.945 ms 2.926 ms 2.171 ms
いけた 🎉