Support >
  About cybersecurity >
  Practice Guide for permanently Setting MTU values in Windows
Practice Guide for permanently Setting MTU values in Windows
Time : 2025-03-12 17:09:05
Edit : Jtti

The MTU setting affects packet transmission efficiency and stability in network communication. The default MTU in Windows is 1500 bytes. However, in special scenarios, such as virtual network tunnel encapsulation, specific ISP restrictions, or game latency optimization, the MTU value may need to be adjusted to avoid fragment packet loss or performance degradation. However, MTU values modified through traditional graphical interfaces or command-line tools such as netsh often fail after the system is restarted. How to achieve permanent curing of MTU? This article delves into three options for registry editing, policy scripting, and automation tools, and provides landable code examples.

You can use the netsh command to quickly adjust the MTU value, but this method is only valid for the current network session. For example, to set the MTU of the WiFi interface to 1400 bytes: cmd netsh interface ipv4 set subinterface "WiFi" mtu=1400 store=active

The store=active parameter of this command means that the change only applies to memory, and the default value is restored after restart. For production environments that require long-term stability, such as enterprise gateways or cloud servers, such temporary tweaks are clearly not enough.

Solution 1: Permanently lock the MTU through the Registry Editor The Windows system stores the configuration information of all network adapters in the registry in the following path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces

Each network interface corresponds to a unique GUID subentry. You need to perform the following steps to locate the target interface:

Run the command prompt as an administrator and do:

cmd  
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards" /s | find "ServiceName"  

The output of the ServiceName is the interface GUID (e.g., 8 a3f1e2b6b7c4d5e9a1f0c3d8e9b7a2d {}).

Navigate to the registry key for the corresponding GUID and create or modify the following DWORD values:

Key name: MTU

Key value: decimal target MTU value (e.g. 1400)

After the operation is complete, restart the network adapter or system to take effect.

Risk warning:

Network functions may be abnormal if the registry is incorrectly modified. You are advised to back up the registry:

cmd  
reg export "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces" interfaces_backup.reg  

Some security software blocks registry changes and temporarily disables protection.

Solution 2: Automatic configuration by PowerShell script For scenarios that require batch deployment (such as enterprise terminal management), you can use the PowerShell script to permanently set the MTU. The following script automatically identifies the active interface and modifies the registry: powershell

Obtain the GUID $adapters = GetNetAdapter | WhereObject {$_.Status eq 'Up'}
foreach ($adapter in $adapters) {  
$interfaceKey = "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" + $adapter.InterfaceGuid  
if (TestPath $interfaceKey) {  
SetItemProperty Path $interfaceKey Name "MTU" Value 1400 Type DWord  
WriteHost "MTU set to 1400 for interface $($adapter.Name)"
}}

Restart the network adapter to make the configuration effective. RestartNetAdapter Name "" Confirm:$false

The script must be run with administrator rights and can be delivered to all hosts in the domain using group policy (GPO).

Solution 3: Combine netsh and scheduled tasks for persistence If the registry cannot be modified directly, you can use the Windows scheduled task to automatically run the netsh command each time the system starts. The steps are as follows:

Create the set_mtu.cmd file with the following contents:

cmd  
netsh interface ipv4 set subinterface Ethernet mtu=1400 store=persistent

To run PowerShell as an administrator, do:

powershell  
$action = NewScheduledTaskAction Execute "cmd.exe" Argument "/c C:\Path\to\set_mtu.cmd"  
$trigger = NewScheduledTaskTrigger AtStartup  
RegisterScheduledTask TaskName "SetMTU" Action $action Trigger $trigger User "SYSTEM" RunLevel Highest  

This task will run silently at boot time with system permissions to ensure that the MTU Settings persist.

Verification and debugging After the configuration is complete, verify whether the MTU takes effect:

Use the ping command to test fragmentation

cmd  
ping f l 1472 8.8.8.8

l 1472: packet size (1472 bytes + 28 bytes header = 1500 bytes MTU)

If the message Need to split packets but set DF is displayed, the actual MTU is less than 1500.

View the current MTU value

cmd  
netsh interface ipv4 show subinterfaces  

The MTU field in the output should be the set value.

Troubleshooting and Rollback Solution If a network exception occurs after the configuration, take the following measures:

To restore the default MTU, delete the MTU key from the registry or run the netsh interface ipv4 set subinterface "Ethernet" mtu=1500 store=persistent command

Diagnose route compatibility: Some routers may forcibly change the MTU. Therefore, adjust the router configuration (for example, set the PPPoE MTU to 1492).

Driver compatibility: Update the NIC driver to the latest version, especially the virtual NIC in HyperV or VMware

Permanently setting MTU is not only a technical operation, but also a comprehensive consideration of network architecture and service requirements. For common users, you are advised to use the registry. Enterprise IT teams can choose from PowerShell scripts or scheduled tasks for batch management. It is important to note that MTU optimization is not "bigger is better" - too high a value can result in shards being transmitted across network segments, while too low a value can reduce throughput. Before the actual deployment, you are advised to run the ping ACL step by step test to find the minimum MTU value (PMTUD) in the network path to achieve the best balance between performance and stability.

Pre-sales consultation
JTTI-COCO
JTTI-Ellis
JTTI-Defl
JTTI-Eom
JTTI-Selina
Technical Support
JTTI-NOC
Title
Email Address
Type
Sales Issues
Sales Issues
System Problems
After-sales problems
Complaints and Suggestions
Marketing Cooperation
Information
Code
Submit