By Hester / Last Updated March 3, 2023

How do I fix the L2TP connection attempt failed because the security layer encountered?

 

Today, I want to remote into another computer over the Internet to access some files. But my computer can’t connect to VPN because of the error ‘L2TP connection attempt failed because the security layer encountered a processing error during initial negotiations with the remote computer’ How can I fix this problem? Thanks.”

- Question from Windows Forum

L2TP Connection Error

How to resolve the L2TP connection attempt failed error [7 solutions]

VPN is necessary these days, as it makes it possible to safely transfer data over the Internet without disclosing your IP and location. Some users also establish a VPN connection to connect to Remote Desktop via the Internet. But occasionally, the VPN connection may fail with the error message “the L2TP connection attempt failed”. The good news is that we can resolve this issue in several ways. Let’s move on to the solutions.

Solution 1. Use local IP address

To fix L2TP connection attempt failed, you can try connecting to the network with the Local IP address rather than the public IP.

Step 1. Open Control Panel, click View network status and tasks, and click Change adapter settings.

Change Adapter Setting

Step 2. Right-click the VPN connection and select Properties.

VPN Connection Properties

Step 3. Go to the Security tab, select L2TP/IPSec as the type of VPN, and click Advanced Settings.

VPN Properties Advanced Settings

Step 4. Tick Use preshared key for authentication and click OK.

Use Preshared Key for Authentication

Solution 2. Install the necessary Windows update

The error “L2TP connection attempt failed because the security layer” might be because of the Windows update KB5009543. So, you need to manually uninstall the latest update and install the necessary Windows update on your system.

Part 1. Uninstall the faulty update

Step 1. Navigate to Settings > Windows Update > View update history.

View Update History

Step 2. Click Uninstall updates.

Uninstall Update History

Step 3. Find update KB5009543 and click Uninstall.

Uninstall KB5009543

Part 2. Disable automatic updates

Disable the automatic updates to prevent Windows download and install the fault update again.

Step 1. Press Win + R, enter “gpedit.msc”, and click OK.

Local Group Policy Editor Window

Step 2. Navigate to Computer Configuration > Administrative Templates > Windows Components > Windows Update > Manage end user experience, and click Configure Automatic Updates.

Configure Automatic Updates

Step 3. Tick Enabled, choose Notify for download and auto install, and click OK.

Notify for Download and Auto Install

Then Windows will notify you before downloading and installing updates.

Part 3. Install the necessary update

Step 1. Go to Windows Update and click View optional updates.

View Optional Updates

Step 2. Download and install the available update.

Solution 3. Turn on the Microsoft CHAP Version 2 protocol and the LCP extensions

When using VPN, Microsoft CHAP Version 2 protocol and LCP protocol extensions help configure and establish the Internet connection. You need to enable these protocols to fix the error.

Step 1. Open Control Panel, click View network status and tasks, and click Change adapter settings.

Step 2. Right-click the VPN connection and select Properties.

Step 3. Go to the Security tab, enable Allow these protocols, and check Microsoft CHAP version 2. Finally, click OK to save the changes.

Check Microsoft CHAP Version

Step 4. Go to the Options tab, click PPP Settings, check Enable LCP Extensions and click OK > OK.

Enable LCP Extensions

Solution 4. Restart IPSec services

The IPSec services are essential for secure Internet data transfer in VPN tunneling. You can restart these services to solve the problem.

Step 1. Press Win + R, type “services.msc”, and hit OK.

Open Services

Step 2. Find IPSec Policy Agent, right-click it, and select Restart.

Ipsec Policy Agent

Step 3. Then double-click the service, select the Startup type to Automatic, and click OK.

Ipsec Policy Agent Startup Type

Step 4. Repeat the same steps for IKE and AuthIP IPsec Keying Modules.

Ike and Authip Ipsec Keying Modules

Solution 5. Reinstall the network adapters

When you can not connect to the VPN successfully, sometimes the problem might lie in the VPN network adapter itself. You can reinstall the network adapters with the following steps.

Step 1. Press Win + X and click Device Manager.

Open Device Manager

Step 2. Expand Network adapters, right-click the VPN adapter, and click Uninstall device.

Wan Miniport Uninstall Device

Step 3. Click Uninstall in the prompt window.

Uninstall Wan Miniport

Step 4. Repeat the same steps to uninstall all the VPN adapters.

Step 5. Install the new VPN again.

Solution 6. Check UDP Ports 500 and 4500

If you want a VPN connection, you should make the UDP Ports 500 and 4500 accessible to Windows Firewall.

Step 1. Press Win + R, enter "cmd”, and click OK.

Run Box CMD

Step 2. Run the command “netstat -ano”.

Netstat Command

Step 3. Check if the UDP Ports 500 and 4500 are on the list. If not, you need to make the Ports available from Windows Firewall.

Check UDP Ports List

Step 4. Search and open Windows Defender Firewall in the start menu. Click Advanced settings.

Advanced Settings

Step 5. Click Inbound Rules and click New Rule.

Inbound Rules Firewall

Step 6. Tick Port and click Next.

Port

Step 7. Tick UDP and type 500 on Specific local ports.

Udp Port 500

Step 8. Tick Allow the connection and click Next.

All the Connection

Step 9. Check Domain, Private and Public options. Click Next.

Specify the Profile

Step 10. Name it 500 and click Finish.

Rule Name 500

Step 11. Repeat the same steps for UDP Port 4500.

Solution 7. Create a registry key

If you want to use a VPN, creating a registry key on the client PC is necessary.

Step 1. Press Win + R, enter “regedit”, and click OK.

Run Box regedit

Step 2. Navigate to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > PolicyAgent. Right-click the empty area, and click New > DWORD (32-bit) value. Name it AssumeUDPEncapsulationContextOnSendRule.

Policy Agent

Step 3. Double-click the created value, set the Value data to 2, and click OK.

UDP Key Value

Bonus tip: How to remote access data over the Internet without a VPN

If none of the above methods have resolved the issue, we recommend using AnyViewer to remotely access data from another computer via the Internet without a VPN connection.

Why do you need AnyViewer? As professional yet powerful remote desktop software, AnyViewer offers simple ways to perform remote control or file transfer between devicesin different locations. It is beneficial for individuals or businesses to give remote technical support, access files from a work computer, manage remote personal computers, play PC games on another device, etc.

Besides, AnyViewer is secured by ECC encryption and devotes to protecting your data from leakage.

Download AnyViewer on your devices to enjoy its advanced features!

Download Freeware Win 11/10/8.1/8/7
Secure Download

Step 1. Open AnyViewer on the host computer, and click Sign up for a new account registration.

Log in Anyviewer

Step 2. Type in the information and click Sign up.

Sign Up for Anyviewer

Step 3. Start AnyViewer on the client computer and log in to the same account. The device will automatically assign to the account when you successfully log in.

Free Editions

Step 4. Go to Device, click the computer you want to connect to, and click One-click control.

Connect to My Devices

There are several considerate options you can use during the remote session. For example, instant chat, remote lock/shut down, change screen resolution, etc.

Remote Access Operations

Notes:✎...AnyViewer also has specified plans for businesses. You can select Professional or Enterprise plan to enjoy more rights!
More concurrent channels.
More simultaneous sessions.
More assigned devices to an account.
Privacy mode.
Unlimited file transfer at high speed.
Mass Deployment(MSI).

Conclusion

That’s all the solutions for the error “L2TP connection attempt failed because the security layer”. I hope they are helpful to you! If you think setting a VPN connection to access resources remotely is complicated, we recommend you use AnyViewer instead.