VPN errors 809, 789 and 691 — the tunnel will not come up
Three different failures that look identical to the user: blocked on the way out, refused by the security association, or refused by the credentials.
What you see
"The network connection between your computer and the VPN server could not be established" (809), "the L2TP connection attempt failed because the security layer encountered a processing error" (789), or "the username or password is not valid on this domain" (691).
What is actually wrong
809 is almost always a NAT device between the client and server with no support for IPsec traversal. 789 is a certificate or pre-shared key mismatch, or the IKE service being stopped. 691 is authentication — wrong credentials, or an NPS network policy that does not permit the connection.
Codes and articles
Fixes (3)
Allow IPsec through the NAT in front of the client
Error 809 or 800, and the same profile works from another network.
Check whether the server is even reachable on the right port. L2TP is UDP 500 and 4500, SSTP is TCP 443, IKEv2 is UDP 500 and 4500.
Test-NetConnection vpn.example.com -Port 443 -InformationLevel DetailedSet the NAT traversal value so the client will build a tunnel through a NAT device.
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\PolicyAgent' -Name AssumeUDPEncapsulationContextOnSendRule -PropertyType DWord -Value 2 -ForceBy default Windows will not build an IPsec tunnel when both ends sit behind NAT. A value of 2 permits it, which is the standard fix for a home router in front of a client and a firewall in front of the server.
Restart the machine. The policy agent reads this at boot.
If it still fails on that network only, the router is dropping UDP 500 — switch the profile to SSTP over TCP 443, which passes through anything.
Set-VpnConnection -Name 'Work VPN' -TunnelType Sstp -Force
Get-VpnConnection -Name 'Work VPN' | Format-List Name,ConnectionStatus,TunnelTypeipconfig | findstr /i "PPP"
Fix the security association — key, certificate or service
Error 789 or 812. The connection reaches the server and is refused at the IPsec layer.
Confirm the IKE services are running. 789 appears immediately if they are not.
Get-Service IKEEXT,PolicyAgent,RasMan | Format-Table Name,Status,StartTypeFor a pre-shared key profile, re-enter the key — a trailing space pasted from an email is a genuine and frequent cause.
Set-VpnConnection -Name 'Work VPN' -L2tpPsk 'TheKey' -ForceFor IKEv2 with certificates, check the client actually trusts the server's issuing CA.
Get-ChildItem Cert:\LocalMachine\Root | Where-Object Subject -like '*YourCA*' | Format-List Subject,NotAfter,ThumbprintAn expired or missing root is the most common 789 on a rebuilt machine, and the error text never mentions certificates.
Read what the server thought. On the RRAS server, the Security log records the SA failure with a reason.
Get-WinEvent -LogName Security -MaxEvents 50 | Where-Object Id -in 4653,4654 | Format-Table TimeCreated,Id,Message -Wrap
Get-NetIPsecMainModeSA | Format-Table LocalEndpoint,RemoteEndpoint,CipherAlgorithmWork out which side is refusing the credentials
Error 691. The tunnel is fine; the account is being turned away.
Look for the rejection on the NPS server. It states the reason code and the policy that matched, which is the whole answer.
Get-WinEvent -LogName Security -MaxEvents 60 | Where-Object Id -in 6273,6274,6278 | Format-List TimeCreated,MessageReason code 65 is "the connection was rejected by a policy", 16 is bad credentials, 48 is "no policy matched". Match the code to what to change.
Check the account is in the group the network policy requires, and that dial-in access is not set to Deny.
Get-ADUser jbloggs -Properties MemberOf,msNPAllowDialin | Format-List Name,msNPAllowDialin,MemberOfmsNPAllowDialin set to False overrides group membership and policy entirely, and nothing in the client error hints at it.
Confirm the authentication method the policy allows matches what the client offers — a client set to MS-CHAPv2 against a policy that only permits EAP fails as 691.
Where this stops. This write-up was written and checked by hand. It says what each step changes, how to confirm it worked and how to reverse it, and anything destructive is flagged before you reach it. If it does not match what your machine is doing, search the Support Centre for the exact code or message — and when something needs a person, get in touch.