On Windows 11 devices, an L2TP/IPsec VPN connection issue may occur when the computer or the VPN server is located behind NAT.
In this case, a value named AssumeUDPEncapsulationContextOnSendRule must be added to the Windows Registry.
After completing this process, the computer must be restarted.
This process requires administrator privileges.
1. Open Windows PowerShell as Administrator
Right-click the Start button at the bottom of the screen.
Select Terminal (Admin) from the menu.
On some Windows 11 versions, this option may appear as one of the following:
Windows Terminal (Admin)
or
Windows PowerShell (Admin)
If the User Account Control window appears, click Yes.
If Windows Terminal opens, make sure that the active tab is PowerShell.
The terminal prompt will usually look similar to the following:
PS C:\Windows\System32>
2. Run the Required PowerShell Command
Copy the following command exactly:
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\PolicyAgent" -Name "AssumeUDPEncapsulationContextOnSendRule" -PropertyType DWord -Value 2 -Force
Paste the command into the PowerShell or Windows Terminal window by pressing Ctrl + V.
Then press Enter.
If the command runs successfully, information similar to the following will appear:
AssumeUDPEncapsulationContextOnSendRule : 2
PSPath : Microsoft.PowerShell.Core\Registry...
If no red error message appears, the Registry value has been created successfully.
3. Restart the Computer
The computer must be restarted for the Registry change to take effect.
