用 ping -M do 测试路径 MTU
逐步探测链路能通过的最大不分包大小,排查 VPN/PPPoE 下'网页打不开'的经典问题。
运行 ping -M do -s 1472 example.com(1500 减去 28 字节包头),如果超时就每次把 -s 减 8 再试,能通的最大值加 28 就是路径 MTU。
01命令
命令
$ ping -M do -s 1472 example.com02作用说明
-M do 会设置不分片标志,超过路径真实 MTU 的包会被直接丢弃而不是拆开,这样才能测出链路的真实上限。每个 IP 包有 20 字节 IP 头加 8 字节 ICMP 头,所以 -s 1472 正好对应 MTU 1500。当小包能过、大包卡死(比如 TLS 握手失败、网页只出一半)时,基本都是 VPN 或 PPPoE 接口的 MTU 设大了。
03风险
!注意: 不要盲目把 MTU 调得很小,值太小会让每个包都浪费带宽。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- ping(8) — Ubuntu man page依据: Man page text includes '-M' and the do|dont|want path-mtu options plus -s packet size, confirming the exact flags used.
- ping(8) — Linux man page依据: Documents -M mtu options including 'do' (prohibit fragmentation, from RFC 1191) and -s packetsize; confirms '-M' and 'mtu' text on the page.
最后验证: 2026-09-19 · 分类: 网络