The maximum transmission unit (Maximum Transmission Unit, MTU)

The relationship between the concept of IP MTU and MSS, and between them this paper analyzes the second floor MTU. These three concepts are very important for routers.

The maximum transmission unit (Maximum Transmission Unit, MTU) is the maximum size of data packets in a communication protocol can be adopted by a given layer (in bytes), it usually has a close relationship with the link layer protocol.

Ethernet frames have a length of a transmission limit, referred to as the MTU maximum transmission unit, 1500 is typically Ethernet.

The maximum transmission unit (Maximum Transmission Unit, MTU)

A, EthernetII frame structure

The maximum transmission unit (Maximum Transmission Unit, MTU)

Field Interpretation:

Ø destination address: 6 bytes, the hardware address of a network card, fixing the card on
Ø Source Address: 6 bytes, a network card hardware address (the MAC)
Ø kind: Type: the IP, the ARP, the RARP
Ø data: 46 to 1500 bytes,
Ø the CRC: cyclic redundancy verify

Second, understanding MTU:

 MTU, the maximum transmission unit limit corresponds to the size of the package when made express, limiting generated by the physical layer, generally related to the communication interface (network interface card)
When an Ethernet frame data Ø minimum length 46, ARP packets the 46 bytes long enough to fill up the back of
the maximum Ethernet frame Ø data 1500, maximum transmission unit called an Ethernet (the MTU), different network types have different the MTU
Ø If the Ethernet transmission the packets larger than the MTU, will have to be fragmented

The maximum transmission unit (Maximum Transmission Unit, MTU)

Ethernet transmission due to the limitation of the electrical aspect, a minimum of 64 bytes per Ethernet frame, can not exceed the maximum 1518 bytes, smaller or larger than the limit for the Ethernet frame, the Ethernet data can be regarded as an error frame. General Ethernet forwarding devices will discard the data frames. (Note: less than 64 bytes of Ethernet data frames is generally due to the conflicts of "debris" or line interference or bad generated Ethernet interface, the data frame is larger than 1518 bytes we generally call it Giant frame, which species generally due to line interference generated Ethernet port or bad).

这个MTU是网络层协议非常关心的地方,因为网络层协议比如IP协议会根据这个值来决定是否把上层传下来的数据进行分片。就好比一个盒子没法装下一大块面包,就需要把面包切成片,装在多个盒子里面一样的道理。当两台远程PC互联的时候,它们的数据需要穿过很多的路由器和各种各样的网络媒介才能到达对端,网络中不同媒介的MTU各不相同,就好比一长段的水管,由不同粗细的水管组成(MTU不同)通过这段水管最大水量就要由中间最细的水管决定。

三、IP MTU

对于网络层的上层协议而言(以TCP/IP协议族为例),网络层IP协议会检查每个从上层协议下来的数据包的大小,并根据本机MTU的大小决定是否作“分片”处理。分片最大的坏处就是降低了传输性能,本来一次可以搞定的事情,分成多次搞定,所以在网络层更高一层(传输层)的实现中往往会对此加以注意!有些高层因为某些原因就会要求本层这个面包不能切片,需要完整的“面包”,所以会在IP数据包包头里面加上一个标签:DF(Do not Fragment)。这样当这个IP数据包在一大段网络(水管里面)传输的时候,如果遇到MTU小于IP数据包的情况,转发设备就会根据要求丢弃这个数据包,然后返回一个错误信息给发送者。这样往往会造成某些通讯上的问题,不过幸运的是大部分网络链路MTU都是等于1500或者小于1500。

MTU对IP协议的影响:

由于数据链路层MTU的限制,对于较大的IP数据包要进行分包

 将较大的IP包分为多个小包,并给每个小包打上标签
 每个小包的IP协议头的16位标识(id)都是相同的
 每个小包IP协议头的三位标志字段中,第一位保留,第二位置0,表示允许切片,第三位表示结束标志(最后一个小包置1,其余的小包置0)
 到达对端将这些小包按顺序重组,拼装在一起返回给传输层
 一但这些小包中任意一个丢失,接受端重组就会失败,但是IP层不负载重传(IP协议无连接,不可靠)

The maximum transmission unit (Maximum Transmission Unit, MTU)

三、MTU对TCP的影响

 TCP的一个数据报也不可能无限大,还是受制于MTU,TCP单个数据报的最大消息长度,称为MSS
 TCP在建立连接的过程中,双方会进行MSS协商
 最理想的情况下,MSS的值正好是在IP不会被分片处理的最大长度(这个长度受限于数据链路层的MTU)
 双方在发送SYN的时候会在TCP的头部写入字节能支持的MSS值
 然后双方得知对方的MSS值之后,选择较小的作为最终MSS
 MMS的值就在TCP首部的40字节变长选项中(kind=2)

对于TCP协议而言,这个协议是面向连接的协议,对于TCP协议而言它非常在意数据包的到达顺序以及是否传输中有错误发生,所以有些TCP应用对分片有要求——不能分片(DF)。

四、MTU对UDP的影响

一旦UDP携带的数据超过1472(1500-20(IP首部)-8(UDP首部)),那么UDP数据就会在网络层被分成多个IP数据报

对于UDP协议而言,这个协议本身是无连接的协议,对数据包的到达顺序以及是否正确到达不甚关心,所以一般UDP应用对分片没有特殊要求。

五、MTU和MSS的关系

MTU: Maximum Transmission Unit, the data link layer corresponding to different (predetermined hardware) generated in the physical layer, Ethernet = 1500 of the MTU
MSS: Maximum section size, TCP packets per maximum segment size of the transfer data
MSS the value is limited by the MTU

If the network layer a data packet to be transmitted is larger than the MTU of the link layer, it would executing IP fragmentation so that each fragment size no larger than MTU. However, the excessive fragmentation, for recombinant end is a more difficult task, so in order to avoid IP fragmentation, the one proposed in segment (the MSS), which try to ensure that the data transmitted to the IP layer, reported less than the MTU, the IP layer so that no data packets to be fragmented, reducing the time slice too time-consuming process.

Similar path MTU and above, only need to know the minimum MTU entire path

And the data link layer information unit MTU

Information is a frame unit link layer, a link layer protocol different maximum frame size (Maximum Transmission Unit: MTU) have been restricted, the maximum Ethernet frame length is the agreement 1500Byte.

Information element corresponding to the OSI layers are as follows:
section -------> transport layer
packets, datagrams -> Network layer
data frame -----> data link layer

If the IP datagram length is greater than the MTU, it is necessary at this time for the IP datagram to be fragmented and then forwarded via the link layer processing.

Guess you like

Origin blog.51cto.com/11659526/2452174