mutao.net

いわゆる雑記。

traceroute と tracepath

traceroute/traceroute6

traceroute と tracepath の違いがよくわからなかったのでメモ書き。

宛先アドレスまでの経路を確認できる。

なおtraceroute6はIPv6対応のコマンド。 -g オプションはない。

オプション 説明
-n 結果表示の形式をアドレスで表示。途中で到達したホスト名の名前解決をしないので表示が早くなる。
-p 使用するポート番号を指定
-g 使用するgatewayを指定
-T TCPを使用
-I ICMPを使用
traceroute -p 443 -n example.com
traceroute to example.com (93.184.216.34), 64 hops max, 52 byte packets
 1  XXXXXXXXX 7.401 ms  3.710 ms  2.990 ms
 2  153.153.224.244  9.576 ms  9.456 ms  12.821 ms
 3  153.153.224.157  10.585 ms  10.823 ms  10.101 ms
 4  118.23.39.65  11.832 ms  10.740 ms  14.740 ms
 5  153.146.147.13  12.326 ms  10.515 ms  12.819 ms
 6  122.1.245.185  15.555 ms
    118.23.168.137  14.818 ms  11.836 ms
 7  120.88.53.25  13.867 ms  16.458 ms
    120.88.53.21  16.787 ms
 8  129.250.3.34  17.236 ms  16.156 ms  17.477 ms
 9  129.250.3.193  125.385 ms  127.117 ms
    129.250.5.78  119.447 ms
10  129.250.4.107  124.336 ms
    129.250.3.175  119.893 ms  124.003 ms
11  128.241.4.218  132.632 ms  142.837 ms
    128.241.4.222  140.268 ms
12  152.195.85.133  125.230 ms  153.076 ms  121.937 ms

tracepath

宛先アドレスまでの経路と経路上のPathMTUを確認することができる。

オプション 説明
-n 結果表示の形式をアドレスで表示。途中で到達したホスト名の名前解決をしないので表示が早くなる。
-b ホスト名とIPアドレスの両方を表示
-l 初期パケットの長さを設定。 tracepathの場合は65535、tracepath6の場合は128000を設定
-m 最大ホップ数をmax_hopsに設定する。
-p ポートを指定する
$ tracepath -n example.com
 1?: [LOCALHOST]                                         pmtu 9001
 1:  172.31.16.1                                           0.200ms pmtu 1500
 1:  no reply
 2:  no reply
 3:  no reply
 4:  no reply
 5:  no reply

man コマンド一部抜粋

DESCRIPTION
       It traces path to destination discovering MTU along this path.  It uses UDP port port or some random port.  It is similar to traceroute, only does not require superuser privileges and has no fancy options.

       tracepath6 is good replacement for traceroute6 and classic example of application of Linux error queues.  The situation with IPv4 is worse, because commercial IP routers do not return enough information in
       ICMP error messages.  Probably, it will change, when they will be updated.  For now it uses Van Jacobson's trick, sweeping a range of UDP ports to maintain trace history.

tracerouteと違うのはスーパーユーザ権限を必要とせず、UDPportを使うというところ。あとは、MTUを確認できること。