Setting up Windows built-in VPN client

This guide explains how to configure the Windows built-in L2TP/IPsec VPN client to connect to your VPN gateway.

Creating the VPN connection

  1. Open VPN settings by pressing Win + R, typing ms-settings:network-vpn, and pressing Enter. Run dialog with ms-settings:network-vpn
  2. Click Add a VPN connection and fill in the fields:
    • VPN provider: Windows (built-in)
    • Connection name: GPN
    • VPN type: L2TP/IPsec with pre-shared key
    • Server name or address: your VPN server address (from user credentials)
    • Pre-shared key: your Shared Secret (from user credentials)
    • User name: your Login (from user credentials)
    • Password: your Password (from user credentials) Click Save. Add a VPN connection form filled in

Configuring additional parameters via PowerShell

  1. Open PowerShell: click Start, type PowerShell, and click Windows PowerShell.
  2. Run the following command to check the connection properties:
Get-VpnConnection -Name "GPN" -erroraction 'silentlycontinue'; Get-VpnConnection -AllUserConnection -Name "GPN" -erroraction 'silentlycontinue'

PowerShell showing VPN connection properties 5. Check the AllUserConnection property in the output. If it reads True, the VPN is in the global (machine) phone book — run:

Set-VpnConnection -Name "GPN" -EncryptionLevel "Optional" -AuthenticationMethod CHAP, MSCHAPv2 -SplitTunneling $True -AllUserConnection -PassThru

If AllUserConnection reads False, run:

Set-VpnConnection -Name "GPN" -EncryptionLevel "Optional" -AuthenticationMethod CHAP, MSCHAPv2 -SplitTunneling $True -PassThru

PowerShell output confirming VPN parameters were set

  1. Add the route for the VPN connection:
Add-VpnConnectionRoute -ConnectionName "GPN" -DestinationPrefix "10.0.0.0/8"

Connecting to the VPN

You can connect in any of the following ways:

  • Settings: Press Win + R, type ms-settings:network-vpn, press Enter, select GPN, and click Connect.
  • System tray: Click the network icon, choose GPN, and click Connect.
  • PowerShell: Run rasdial GPN.

Troubleshooting

If you see the error:

The L2TP connection attempt failed because the security layer encountered a processing error during initial negotiations with the remote computer Open Command Prompt as Administrator and run:

Set-VpnConnectionIPsecConfiguration -ConnectionName "GPN" -AuthenticationTransformConstants SHA196 -CipherTransformConstants AES256 -EncryptionMethod AES256 -IntegrityCheckMethod SHA256 -PfsGroup None -DHGroup Group14 -PassThru -Force

Note: Replace "GPN" with your actual VPN connection name if you used a different one.

On this page