【Windows &MTU】Windows上最大传输单元MTU值的查看和设置

您所在的位置:网站首页 网卡的mtu 【Windows &MTU】Windows上最大传输单元MTU值的查看和设置

【Windows &MTU】Windows上最大传输单元MTU值的查看和设置

2024-07-06 23:50| 来源: 网络整理| 查看: 265

Win11 22000.120 IPv6 MTU 值怎么是 1472,Win10 中却是 1500 ? 以管理员 cmd 输入:

netsh interface ipv4 show subinterfaces netsh interface ipv6 show subinterfaces

image.png

image.png

How to set MTU size on Windows 10?

C:\Windows\system32>netsh interface ipv4 set subinterface "Ethernet" mtu=352 Ok. C:\Windows\system32>netsh interface ipv4 set subinterface "Ethernet" mtu=100 The parameter is incorrect.

ping使用的ICMP协议,ICMP信息占用8个字节,ICMP信息的信息被封装到IP的数据包中,IP包头大小为20-60字节,会指明源地址、目标地址、TOS(Type Of Service)等等,所以,ICMP的数据包中数据的最大长度只有1500-20-8=1472。

IP包头: 4 bits VER (Version) 4 bits HLEN (Header Length) 8 bits Service Type 16 bits Total Length(Header + DATA) 16 bits Identification 3 bits Flags 13 bits Fragmenttation offset 8 bits Time to live 8 bits Protocol 16 bits Header checksum 4 byte source IP address 4 byte Destination IP Address ICMP: ICMP包头占用8个Byte,封装在IP包的数据部分: 8bits Type 8bits Code 16bits Checksum 其他4字节,共计8字节包头 ICMP信息分两类:Error-reporting 和Query Error-reporting: 3 Destination unreachable 4 Source quench 11 Time exceeded 12 Parameter proble 5 redirection Query: 8 or 0 Echo request or Reply 13 or 14 Timestamp request and Reply 17 or 18 Address mask request & reply 10 or 19 Route; solicitation & Advertisement

image.png

关于Ping -l 和 MTU 的详细说明

Windows xp默认的MTU=1500(字节),即允许发送不需要分段的最大IP单包字节数。 如果使用ping –l data_length命令来ping大包的话,则其中的data_length指的是ICMP的数据长度,而不是IP包的数据长度,即data_length不等于MTU 。

他们两者之间的关系为:

data_length = MTU(典型值为1500)- IP头(20)- ICMP头(8)

在MTU=1500的情况下: IP包的最大长度 = 20(IP头)+ IP包的数据长度 = 1500字节 IP包数据的最大长度 = 8(ICMP头)+ 1472(ICMP的数据)=1480字节 ICMP数据的最大长度(单IP包) = 1472 字节

通过以上描述,我们搞清了网络接口的配置数据MTU和Ping命令中的数据包长度这2 个概念,即:MTU是网络接口发送单个IP包的最大字节数,典型值=1500。Ping命令中的data_length是ICMP的数据长度。

例如(假设本端接口的MTU=1500,对端接口的MTU=1500):

1.ping x.x.x.x 这是一条不带-l参数的ping命令,网络接口以缺省的ICMP的数据长度(32字节或64字节)发送IP包(IP包长度=60或92)。

2.ping x.x.x.x –l 1472 这是一条带-l参数的ping命令,由于1472 + 20(IP头)+ 8(ICMP头) 1500(MTU),所以IP包需要被分段发送(先发IP包长度=1500,后发IP包长度=1500-1472+20+8=56)。

4.ping x.x.x.x –f –l 3000 这是一条带-l参数的ping命令,由于3000 + 20(IP头)+ 8(ICMP头)> 1500(MTU),所以IP包需要被分段发送,但由于本命令带了-f参数(不允许分段),故网络接口无法将此IP发送出去,ping命令执行失败。

当总长度=N字节的IP包到达接收端接口时,如果接收端接口的MTU



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3