如何在Windows 7 或Vista中修改MTU

Windows操作系统使用Maximum Transmission Unit (MTU) 来确定在下面的网络层上可以传输的协议数据包(protocol data packet)的最大尺寸. MTU参数通常出现在与某一个接口(网卡, 串口等)的通信中, 并且每个接口都是分开设置的.

 

为了达到最优的网络性能, 并且防止fragmentation (碎片), MTU应该足够大以至于任何IP 数据报(datagram)都可以被一个帧(frame)容纳. 比MTU大的IP数据报会被拆分成大小为8位位组的倍数的碎片. 碎片会被分别传递到目标主机, 然后重新组装成帧, 之后数据报才会被处理. 所以, 很小的MTU的值对于优化的网络性能是没啥好处的.

 

[原文中有更多关于Windows上该选项解释, 请参考最后的链接.]

 

修改步骤:

1. 使用下面的命令来查看所有的网卡, 以及他们的MTU的大小.

netsh interface ipv4 show subinterfaces

netsh interface ipv6 show subinterfaces

2. 使用下面的命令来设置一个新的MTU的值.

netsh interface ipv4 set subinterface "Local Area Connection" mtu=nnnn store=persistent

3. 重启机器,用以使新选项生效.

4. 使用下面的命令来检查修改是否已经生效.

netsh int ip show int

netsh interface ipv4 show subinterfaces

netsh interface ipv6 show subinterfaces

还可以使用注册表来进行同样的修改.

1.Run Registry Editor (RegEdit).

2.Navigate to the following registry key:
        HKEY_LOCAL_MACHINESystemCurrentControlSetServicesTcpipParametersInterfaces
 

3.Select the registry sub-key of the network interface that you want to change its MTU. For example, {ABCD1234-EF56-GH78-IJ90-KLMNOP123456}. As a guide, you can look through the list of interface available, and find the one that has IP address or gateway IP address which is matching.

4.Right click on blank area of the right pane, and select New -> DWORD (32-bit) Value, and name the new registry value as MTU

5.Right click on MTU and select Modify, and enter the desired MTU value in Decimal. Common MTU values in decimal are 1300, 1400, 1462, 1480, and 1500.
 

资料来源

===============================

How to Set and Change MTU in Windows 7 or Vista

http://www.mydigitallife.info/how-to-set-and-change-mtu-in-windows-7-or-vista/

原文地址:https://www.cnblogs.com/awpatp/p/3878538.html