Technorati 标签: MPLS MTU caculate

MPLS AToM CISCO MTU计算方法,这个文章说的是AToM(VPWS),实际上我认为所有的MPLS都是一样的mtu就算方法。

本文章里解释我对PC还有router之间MTU计算区别的粗浅认识。

 

测试拓扑图:

MPLS AToM CISCO MTU计算方法_第1张图片

和上面实验一样的。但是MTU该怎么计算呢?R1,R2,R3上面,每个路由器的mpls的MTU是1500.

那么,我们从R0到R4的净负荷怎么计算呢?首先看看电脑和路由器ping包的区别:

ping排错功能的强大不在话下,下面着重对PC机上win系统的ping过程和cisco路由器上的ping的过程的差异进行研究。

首先在PC上,带上-f参数,并指定源地址大小ping网关:

C:\Documents and Settings\zhl>ping 172.16.5.254 -l 1472 -f

Pinging 172.16.5.254 with 1472 bytes of data:

Reply from 172.16.5.254: bytes=1472 time=1ms TTL=255

Reply from 172.16.5.254: bytes=1472 time=1ms TTL=255

Reply from 172.16.5.254: bytes=1472 time=1ms TTL=255

Reply from 172.16.5.254: bytes=1472 time=1ms TTL=255

Ping statistics for 172.16.5.254:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 1ms, Maximum = 1ms, Average = 1ms

C:\Documents and Settings\zhl>ping 172.16.5.254 -l 1473 -f

Pinging 172.16.5.254 with 1473 bytes of data:

Packet needs to be fragmented but DF set.

Packet needs to be fragmented but DF set.

Packet needs to be fragmented but DF set.

Packet needs to be fragmented but DF set.

Ping statistics for 172.16.5.254:

Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

网卡的默认MTU是1500,通过设置DF位,我们测试的结果是-l的值1472,而1500-20-8=1472正好是1472(记得否,ICMP包是直接封装在IP包里的,8个byte的ICMP包头和20个byte的IP包头),由此可以看出,在win xp环境下,ping进程对-l参数识别为数据净负荷,即,不包括IP包头部分和ICMP包头部分;

下面是在cisco路由器上的测试:

R6#sh int s1/1

Serial1/1 is up, line protocol is up

Hardware is M4T

Internet address is 172.16.36.2/30

MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,

-----------out put omit---------------------

R6#ping 192.168.100.3 size 1500 df-bit

Type escape sequence to abort.

Sending 5, 1500-byte ICMP Echos to 192.168.100.3, timeout is 2 seconds:

Packet sent with the DF bit set

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 40/47/68 ms

R6#ping 192.168.100.3 size 1501 df-bit

Type escape sequence to abort.

Sending 5, 1501-byte ICMP Echos to 192.168.100.3, timeout is 2 seconds:

Packet sent with the DF bit set

.....

显然,cisco设备上的ping进程的-size参数表示的是MTU,包括了IP报头和ICMP包头。你发现了没?

好了,既然到了这里都知道了该怎么计算MTU了。

从PC1到PC2 1.1.1.1到1.1.1.2 ping包,只能是1470.具体是怎么计算的呢?

1470净负荷+8字节(2层标签)+4字节(控制字)+18字节(二层以太帧)=1500字节

那么二层以太帧解构:

clip_p_w_picpath004

除去data净负荷.还有18个字节。

这里就清楚了吧。路由器ping包,20字节的以太包头和8字节的ICMP包头不用减去了。