1.udp
The traditional, ancient method of tracerouting. Used by default.
Probe packets are udp datagrams with so-called "unlikely" destination ports. The "unlikely" port of the first probe is 33434, then for each next probe it is incremented by one. Since the ports are expected to be unused, the destination host normally returns "icmp unreach port" as a final response. (Nobody knows what happens when some application listens for such ports, though).
发送udp至很大的udp-port 期望得到"icmp unreach port"报文回复
$ traceroute -M udp -p 2000 www.baidu.com -n -w 1 -q 1 -m 20 | ix $ traceroute -M udp -p 2000 www.baidu.com -f 12 -m 12 -n -w 1 -q 10 | ix
2.icmp
Most usual method for now, which uses icmp echo packets for probes.
If you can ping(8) the destination host, icmp tracerouting is applicable as well.
icmp探测
$ traceroute -M icmp 8.8.8.8 -n -w 1 -q 1 -m 20 | ix $ traceroute -M icmp 8.8.8.8 -f 8 -m 8 -n -w 1 -q 10 | ix
3.tcp
tcp half open to bypass firewall,如果对方tcp服务已开启,这种方式能有效地穿透防火墙
$ traceroute -M tcp -p 443 www.baidu.com -n -w 1 -q 1 -m 20 | ix $ traceroute -M tcp -p 443 www.baidu.com -f 14 -m 14 -n -w 1 -q 10 | ix
4.remotest ping
以上三种方法均失效 将使用udp方式选择出最远的一跳 对其进行测试延迟
$ traceroute -M udp -p 2000 www.baidu.com -n -w 1 -q 1 -m 20 | ix
$ traceroute -M udp -p 2000 www.baidu.com -f 12 -m 12 -n -w 1 -q 10 | ix