JSI Tip 7457. How do I change the default MTU (Maximum Transmission Unit) size for PPP (Point-to-Point Protocol) or VPN (Virtual Private Network) connections?

Jerold Schulman

November 17, 2003

1 Min Read
ITPro Today logo in a gray background | ITPro Today

The default MTU size for all PPP connections in Windows Server 2003, Windows 2000, and Windows XP, is a fixed size of 1500 bytes.

The default MTU size for all VPN connections in Windows Server 2003, Windows 2000, and Windows XP, is a fixed size of 1400 bytes.

NOTE: The above defaults apply to both clients and servers.

I have scripted MTU.BAT to allow you to set, or reset, these MTU values.

The syntax for using MTU.BAT is:

MTU [/p:nnnn /v:nnnn]

where:

/p:nnnn indicates that the PPP MTU size will be set to nnnn bytes.

/v:nnnn indicates that the VPN MTU size will be set to nnnn bytes.

nnnn is any valid MTU size.

NOTE: If you omit both switches, the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNdisWanParametersProtocols registry key is deleted, which causes the default settings to be used.

NOTE: MTU.BAT uses Dec2Hex.bat.

NOTE: You must restart your computer for these changes to take effect. See PsShutdown

NOTE: If you wish to run MTU.BAT remotely, see tip 4141 PsExec freeware executes programs remotely, or tip 4195 How do I remotely execute a program or script on 'all' computers ...

MTU.BAT contains:

@echo offsetlocal@echo REGEDIT4>%TEMP%MTU.REG@echo.>>%TEMP%MTU.REGset Proto=Nset PType=Nif {%1}
{} goto undo:loopif {%1}
{} goto doitset param=%1shiftif /i "%param:~0,3%" EQU "/p:" goto OKif /i "%param:~0,3%" EQU "/v:" goto OK:err@echo Syntax: MTU [/p:nnnn /v:nnnn]if exist %TEMP%MTU.REG del /q %TEMP%MTU.REGendlocalgoto :EOF:OKset work2=#%Param:~3%:OKLset work1=%work2%set work2=%work1:#0=#%if "%work1%" NEQ "%work2%" goto OKLset work1=%work2:#=%call Dec2Hex %work1% Hex Lenif %Len% EQU 0 goto :errset /a filllen=8 - %len%set work2=00000000call set work1=%%work2:~0^,%filllen%%%%hex%if "%Proto%" EQU "Y" goto outset Proto=Y@echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNdisWanParametersProtocols]>>%TEMP%MTU.REG@echo "ProtocolType"=dword:00000800>>%TEMP%MTU.REG@echo "PPPProtocolType"=dword:00000021>>%TEMP%MTU.REG:outif /i "%param:~0,3%" EQU "/p:" goto PPPif "%PType%" EQU "V" goto errset PType=V@echo "TunnelMTU"=dword:%work1%>>%TEMP%MTU.REGgoto :loop:PPPif "%PType%" EQU "P" goto errset PType=P@echo "ProtocolMTU"=dword:%work1%>>%TEMP%MTU.REGgoto :loop:undoset Proto=Y@echo [-HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNdisWanParametersProtocols]>>%TEMP%MTU.REG:doit@echo.>>%TEMP%MTU.REGif "%Proto%" EQU "N" goto :errregedit /s %TEMP%MTU.REGdel /q %TEMP%MTU.REGendlocal



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like