windows的ping中-l(length)是指ICMP的净荷,不包括IP包头(一般20字节)和ICMP头(8字节),所以默认情况下MTU为1500字节,windows中:
ping 1.1.1.1 -f -l 1472
ping 1.1.1.1 -f -l 1473
IOS的ping中Datagram size和sweep size都是指MTU,即
R1#ping
Protocol [ip]:
Target IP address: 1.1.1.1
Repeat count [5]: 1
Datagram size [100]: 1600 (在扩展ping中此选项好像失效,没起作用)
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header? [no]: y
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]: y
Sweep min size [36]: 1500
Sweep max size [18024]: 1501
Sweep interval [1]:
Type escape sequence to abort.
Sending 2, [1500..1501]-byte ICMP Echos to 34.1.1.4, timeout is 1 seconds:
Packet sent with the DF bit set
!.
Success rate is 50 percent (1/2), round-trip min/avg/max = 212/212/212 ms
如图,所有路由器均为3620路由器,将R2的s0/0口MTU设为1480,
R1#ping
Protocol [ip]:
Target IP address: 34.1.1.4
Repeat count [5]: 1
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header? [no]: y
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]: y
Sweep min size [36]: 1475
Sweep max size [18024]: 1485
Sweep interval [1]:
Type escape sequence to abort.
Sending 11, [1475..1485]-byte ICMP Echos to 34.1.1.4, timeout is 2 seconds:
Packet sent with the DF bit set
!!!!!!.....
Success rate is 54 percent (6/11), round-trip min/avg/max = 100/127/200 ms
从图中可看出编号1002的包,也就是图中最后一行显示的Data值为1453的包(加上ICMP和IP包头共1453+8+20=1481字节)开始因为超过R2的s0/0口MTU而回不到R1,于是向R4发送不可达的包。
但实际上从R1发出去的request包是可以通过R2的s0/0口的。也就是端口的MTU值只限制从该端口发出去的包MTU大小,不限制收到的包。