天天看點

用PMTU封包尋找營運商最大MTU值

首先把ADSL連接配接的MTU設為較大的一個值

ifconfig ppp0 mtu 2000

下面開始ping

[email protected]:~$ ping -s 1472 -c 2 -M do g.cn

PING g.cn (203.208.39.104) 1472(1500) bytes of data.

--- g.cn ping statistics ---

2 packets transmitted, 0 received, 100% packet loss, time 1010ms

因為IP和ICMP報頭占了28位元組,是以1472是ICMP負載大小,加起來就是PPPOE的負載1500位元組

由高到低依次往下試

[email protected]:~$ ping -s 1464 -c 2 -M do g.cn

PING g.cn (203.208.39.99) 1464(1492) bytes of data.

1472 bytes from bi-in-f99.1e100.net (203.208.39.99): icmp_seq=1 ttl=239 time=43.7 ms

1472 bytes from bi-in-f99.1e100.net (203.208.39.99): icmp_seq=2 ttl=239 time=43.7 ms

--- g.cn ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 999ms

rtt min/avg/max/mdev = 43.707/43.723/43.739/0.016 ms

可以看出我的MTU值是1492,這也是理論上的最大值了MAC幀的MTU是1500,減去PPPOE8個位元組的報頭正是1492

然後運作 pppoeconf或修改/etc/ppp/peers目錄下的ADSL連接配接配置檔案,把MTU設為1492