Discovery学习之路-交换机-MTU、和路径MTU

MTU是什么

MTU(Maximum Transmission Unit)即最大传输单元。是指一种通信协议的某一层上面所能通过的最大数据报大小(以字节为单位)。最大传输单元这个参数通常与通信接口有关(网络接口卡、串口等)。不同的网络类型对于MTU的限制不一样例如:ppp-296;IEEE 802.3-1492;以太网-1500;FDDI-4352;超通道:65535;点到点的链路层(如SLIP和PPP)的MTU并非指的物理限制,而是一种逻辑限制,目的是为交互使用提供足够快的响应时间(数据量过大则必然导致传输时间过长)。


详细解释为:因特网协议允许IP分片,这样就可以将数据报分成足够小的片段以通过那些最大传输单元小于该数据包原始大小的链路了。这一分片过程发生在传输层(OSI模型的第四层,传输层:O S I模型中最重要的一层。传输协议同时进行流量控制或是基于接收方可接收数据的快慢程度规定适当的发送速率。除此之外,传输层按照网络能处理的最大尺寸将较长的数据包进行强制分割。例如,以太网无法接收大于15 0 0字节的数据包。发送方节点的传输层将数据分割成较小的数据片,同时对每一数据片安排一序列号,以便数据到达接收方节点的传输层时,能以正确的顺序重组。该过程即被称为排序。),它使用的是将分组发送到链路上的网络接口的最大传输单元的值。原始分组的分片都被加上了标记,这样目的主机的IP层就能将分组重组成原始的数据报了.


MaxMTU是最大的TCP/IP传输单元,在TCP/IP协议中,将要传输的数据分成较小的组进行传输,每个组的大小为576字节。Windows默认的字节为1500,这是以太网的分组标准。ADSL使用的PPPoE略小于这个数值,一般为1492.

In computer networking, themaximum transmission unit (MTU) of acommunications protocol of a layer is the size (inbytes) of the largestprotocol data unit that the layer canpass onwards. MTU parameters usually appear in association with acommunications interface (NIC,serial port, etc.). Standards(Ethernet, for example) can fix the sizeof an MTU; or systems (such as point-to-point serial links) maydecide MTU at connect time.

A larger MTU brings greater efficiency because each packetcarries more user data while protocol overheads, such as headers orunderlying per-packet delays, remain fixed; the resulting higherefficiency means a slight improvement in bulk protocol throughput.A larger MTU also means processing of fewer packets for the sameamount of data. In some systems, per-packet-processing can be acritical performance limitation.

Large packets can occupy a slow link for some time, causinggreater delays to following packets and increasinglag and minimum latency. For example, a1500-byte packet, the largest allowed by Ethernet at the networklayer (and hence over most of theInternet), ties up a14.4k modem for about one second.

Large packets are also problematic in the presence ofcommunications errors. Corruption of a single bit in a packetrequires that the entire packet be retransmitted. At a givenbit error rate larger packets are morelikely to be corrupted. Retransmissions of a larger packet takeslonger.

Table of MTUs of common media

Note: the MTUs in this section are given as the maximum size ofIP packet that can be transmitted without fragmentation - includingIP headers but excluding headers from lower levels in the protocolstack. The MTU must not be confused with the maximumdatagram size (size of reassembled packet), which has aminimum value of 576 for IPv4[1]and of 1500 for IPv6.[2]

MediaMaximum Transmission Unit (bytes)Notes
Internet IPv4 Path MTUAt least 576[3]Practical path MTUs are generally higher. All hosts must beprepared to accept datagrams of up to 576 octets (whether theyarrive whole or in fragments). Systems may usepath MTU discovery[4]to find the actual path MTU.
Internet IPv6 Path MTUAt least 1280[5]Practical path MTUs are generally higher. Systems may usepath MTU discovery[6]to find the actual path MTU.
Ethernet v21500[4]Nearly all IP over Ethernet implementations use theEthernet V2 frame format.
Ethernet (802.3)1492[4]
Ethernet Jumbo Frames1500-9000The limit varies by vendor. For correct interoperation, thewhole Ethernet network must have the same MTU. Jumbo frames areusually only seen in special purpose networks.
WLAN (802.11)2272[7] 
Token Ring (802.5)4464 
FDDI4500[4]

MTU检测

在本机打开dos窗口,执行: ping -f -l 1472 192.168.0.1 其中192.168.0.1是网关IP地址,1472是数据包的长度。请注意,上面的参数是“-l”(小写的L),而不是“-1”,“-f”表示对于本数据报不要进行分片。 如果能ping通,表示数据包不需要拆包,可以通过网关发送出去。 如果出现: Packet needs to be fragmented but DF set. 表示数据包需要拆开来发送。此时,减少数据包长度,再执行上面的ping命令。从1400到1472之间多试几次,就能找到合适的数据包长度了。把数据包长度加上数据包头28字节,就得到MTU的值。 如果检测到网关的MTU值是1500,不需要修改。 如果网关有防火墙ping不通,可以试试直接把MTU设为1400。

如果本机的MTU比网关的MTU大,大的数据包就会被拆开来传送,这样会产生很多数据包碎片,增加丢包率,降低网络速度。把本机的MTU设成比网关的MTU小或相同,相对于之前就可以减少丢包。所以设置MTU有时是很有用的!

路径MTU

从源地址到目的地址所经过“路径”上的所有IP跳的最大传输单元的最小值。或者从另外一个角度来看,就是无需进一步分片就能穿过这条“路径”的最大传输单元的最大值。

路径MTU检测

这是一种确定两个IP主机之间路径最大传输单元的技术,其目的是为了避免IP分片。在这项技术中,源地址将数据报的DF(Don't Fragment,不要分片)位置位,再逐渐增大发送的数据报的大小——路径上任何需要将分组进行分片的设备都会将这种数据报丢弃并返回一个“数据报过大”的ICMP响应到源地址——这样,源主机就“学习”到了不用进行分片就能通过这条路径的最大的最大传输单元了。


  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值