tracepath命令 – 追踪报文的路由信息

tracepath命令用来追踪并显示报文到达目的主机所经过的路由信息,能够发现路由中的MTU值。tracepath使用套接字API来实现其所有功能,不需要root权限。

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 not require superuser privileges. Option -c causes tracepath to use the return address instead of the reply type (connection refused) to determine when to stop.

tracepath6 is good replacement for traceroute6 and classic example of application of Linux error queues. The situation with tracepath 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.

# 使用参数

```

Usage: tracepath [-n] [-b] [-l <len>] [-p port] <destination>

-n 只显示ip地址

-b 同时显示ip地址和主机名

-l 设置初始化的数据包长度,默认为65535

-m 设置最大TTL值,默认为30

-p 设置要使用的初始目标端口

```

# 实践

## 追踪到达域名的主机路由信息(同时显示ip地址与主机名)

```

[root@781c38071bbd ~]# tracepath -b www.baidu.com

1?: [LOCALHOST]                                         pmtu 1500

1:  gateway (172.17.0.1)                                  0.140ms

1:  gateway (172.17.0.1)                                  0.091ms

2:  10.6.9.254 (10.6.9.254)                               2.002ms

3:  10.6.111.1 (10.6.111.1)                               0.364ms

4:  123.235.52.17 (123.235.52.17)                        60.508ms

5:  27.223.59.193 (27.223.59.193)                         2.986ms

6:  119.167.86.237 (119.167.86.237)                       2.821ms asymm  5

7:  219.158.114.62 (219.158.114.62)                      15.927ms

8:  219.158.17.210 (219.158.17.210)                      13.737ms asymm  7

9:  221.194.45.130 (221.194.45.130)                      21.492ms

```

## 设置追踪报文路由的最大TTL值

```

[root@781c38071bbd ~]# tracepath -m 5 -b  www.baidu.com

1?: [LOCALHOST]                                         pmtu 1500

1:  gateway (172.17.0.1)                                  0.122ms

1:  gateway (172.17.0.1)                                  0.109ms

2:  10.6.9.254 (10.6.9.254)                               1.976ms

3:  10.6.111.1 (10.6.111.1)                               0.299ms

4:  123.235.52.17 (123.235.52.17)                        27.441ms

5:  27.219.237.45 (27.219.237.45)                         2.979ms

    Too many hops: pmtu 1500

    Resume: pmtu 1500

```

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值