Skip navigation

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?

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_MACHINE\SYSTEM\CurrentControlSet\Services\NdisWan\Parameters\Protocols 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 off
setlocal
@echo REGEDIT4>%TEMP%\MTU.REG
@echo.>>%TEMP%\MTU.REG
set Proto=N
set PType=N
if \{%1\}

\{\} goto undo :loop if \{%1\}

\{\} goto doit set param=%1 shift if /i "%param:~0,3%" EQU "/p:" goto OK if /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.REG endlocal goto :EOF :OK set work2=#%Param:~3% :OKL set work1=%work2% set work2=%work1:#0=#% if "%work1%" NEQ "%work2%" goto OKL set work1=%work2:#=% call Dec2Hex %work1% Hex Len if %Len% EQU 0 goto :err set /a filllen=8 - %len% set work2=00000000 call set work1=%%work2:~0^,%filllen%%%%hex% if "%Proto%" EQU "Y" goto out set Proto=Y @echo \[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NdisWan\Parameters\Protocols\0\]>>%TEMP%\MTU.REG @echo "ProtocolType"=dword:00000800>>%TEMP%\MTU.REG @echo "PPPProtocolType"=dword:00000021>>%TEMP%\MTU.REG :out if /i "%param:~0,3%" EQU "/p:" goto PPP if "%PType%" EQU "V" goto err set PType=V @echo "TunnelMTU"=dword:%work1%>>%TEMP%\MTU.REG goto :loop :PPP if "%PType%" EQU "P" goto err set PType=P @echo "ProtocolMTU"=dword:%work1%>>%TEMP%\MTU.REG goto :loop :undo set Proto=Y @echo \[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NdisWan\Parameters\Protocols\]>>%TEMP%\MTU.REG :doit @echo.>>%TEMP%\MTU.REG if "%Proto%" EQU "N" goto :err regedit /s %TEMP%\MTU.REG del /q %TEMP%\MTU.REG endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish