Wednesday, January 06, 2010

Path MTU discovery

What's Path MTU discovery:
http://en.wikipedia.org/wiki/Path_MTU_discovery

預設Linux box是把pmtud的機制打開的,可透過以下的kernel參數檢查:
cat /proc/sys/net/ipv4/ip_no_pmtu_disc
0 代表pmtud enable (default)
1 代表pmtud disable
以下是我實驗時的環境:

Remote Server (mtu=1500) ----- (mtu=1400) Linux NAT Box (mtu=1400) ----- Client (mtu=1500)

1. 從Client往Server端送出icmp packet size大於1400bytes但小於1500bytes的包,for example 1450 bytes, DF=1
2. Linux NAT Box將會回報封包需要分片!並透過icmp unreachable包告訴Client,本機的mtu為1400bytes
opensuse:~ # ping 10.12.64.220 -s 1450
PING 10.12.64.220 (10.12.64.220) 1450(1478) bytes of data.
From 10.12.95.3: icmp_seq=1 Frag needed and DF set (mtu = 1400)
From 10.12.95.3 icmp_seq=1 Frag needed and DF set (mtu = 1400)
1458 bytes from 10.12.64.220: icmp_seq=2 ttl=63 time=2.85 ms
1458 bytes from 10.12.64.220: icmp_seq=3 ttl=63 time=4.97 ms
1458 bytes from 10.12.64.220: icmp_seq=4 ttl=63 time=3.48 ms
此後將會保持一段時間不需要detect。

No comments: