SREとはのブログ

日々の作業メモ

macのtarcerouteでUDPを出す方法

macのtracerouteはUDPでやっている?

調べていると下記コマンドで出せると書いてあったが

traceroute -U -p ポート番号 [ホスト名 or IPアドレス]

manを見ると存在しない

SYNOPSIS traceroute [-adeFISdNnrvx] [-A as_server] [-f first_ttl] [-g gateway] [-i iface] [-M first_ttl] [-m max_ttl] [-P proto] [-p port] [-q nqueries] [-s src_addr] [-t tos] [-w waittime] [-z pausemsecs] host [packetsize]

その代わり -Pがあって

 -P proto
         Send packets of specified IP protocol. The
         currently supported protocols are: UDP ,
         TCP , GRE and ICMP Other protocols may also
         be specified (either by name or by number),
         though traceroute does not implement any
         special knowledge of their packet formats.
         This option is useful for determining which
         router along a path may be blocking packets
         based on IP protocol number. But see BUGS
         below.

と書いてある

But see BUGS below.

ってなんだろ、、

BUGS When using protocols other than UDP, functionality is reduced. In particular, the last packet will often appear to be lost, because even though it reaches the des- tination host, there's no way to know that because no ICMP message is sent back. In the TCP case, traceroute should listen for a RST from the destination host (or an intermediate router that's filtering packets), but this is not implemented yet.

 The AS number capability reports information that may sometimes be inaccurate due
 to discrepancies between the contents of the routing database server and the cur-
 rent state of the Internet.

MACでやる場合は

traceroute -P UDP -p ポート番号 [ホスト名 or IPアドレス]

かな

そもそもデフォルトUDPだから

traceroute -p ポート番号 [ホスト名 or IPアドレス]

だけでよかったかもしれない

私のMACのTracerouteのVersionが低いのかな、、 Version 1.4a12+Darwin

traceroute(8) manページ