How To:  

Harden Windows Server 2012R2 Routing and Remote Access (RRAS) VPN server.  Implement strong IKEv2 VPN cryptography:
• Diffe-Hellman Group (DH) 14 or DH Group 19
• Enable AES256 and SHA256 L2TP/IPsec and IKEv2 on Windows Server VPNs.

This simple method significantly improves security strength for Windows 2012 IPsec VPNs.


Windows RRAS server negotiates insecure IKEv2 and L2TP/IPsec cryptographic algorithms:

  • DH2-3DES-SHA1.   
Weak security strength risks data integrity and confidentiality.  IKE SA authenticates with RSA certificates.

This problem impacts all RRAS VPN clients:  Windows 10 phones, iPhones, Android, Cisco, Juniper and Sawn.  


Enable strong IPsec security algorithms in the Windows server registry:

  • IKEv2 DH14-AES256-SHA256

This (mostly) original approach is hands-down the easiest way to secure a Windows 2012 IKEv2 or L2TP/IPsec VPN.

Step 1:  Regedit:


Step 2:  Create new key:


Step 3:  Create new DWORDs (Table 1):

Table 1
IKEv2CustomPolicy DWORD Attributes

IntegrityMethod1Integrity check algorithm to be negotiated during MM SA negotiation [RFC4306].
EncryptionMethod4Encryption algorithm to be negotiated during MM SA negotiation [RFC4306].
CIPHER_AES_128 (0x2)
CIPHER_AES_256 (0x4)
CipherTransformConstant5Encryption algorithm to be negotiated during QM SA negotiation [RFC4306].
AuthTransformConstant1Specifies the hash algorithm to be negotiated during QM SA negotiation [RFC4306].
HMAC secret key authentication algorithm. SHA-1 (Secure Hash Algorithm) data integrity and data origin authentication algorithm. [RFC2404].
AUTH_CONFIG_HMAC_SHA_256_128 (0x2).
HMAC secret key authentication algorithm. SHA-256 data integrity and data origin authentication algorithm.
DHGroup3Type of Diffie-Hellman group used for Internet Key Exchange (IKE) key generation during MM SA negotiation [RFC4306].
DH_GROUP_2 (0x2)
DH_GROUP_14 (0x3)
DH_GROUP_2048 (0x3) - IKE for DH-14. Name change to match standard terminology
PfsGroup0Diffie-Hellman algorithm to be used for Quick Mode Perfect Forward Secrecy (PFS) [RFC4306].
PFS_NONE (0x0)
PFS_2 (0x2)
PFS_2048 (i.e., DH-14) (0x3)
PFS_MM (0x6) - Uses same DH as MM that contains this QM.
Note: DWORD values for IKEv2 Custom Policy Key: HKLM\SYSTEM\CurrentControlSet\Services\RemoteAccess\Parameters\IKEV2\IKEv2CustomPolicy\
This method also supports stronger security (e.g., DH-EC and GCM).  See MSDN MS-RRASM for additional options.

Additional Thoughts:

Client Requirements:

VPN clients must support the same cryptography in order to connect.  Consider how Windows clients use DH2-3DES-SHA1 by default (yikes).  I'll provide instructions on how to update Windows 10, iPhones, and Android IPsec clients in an upcoming article.


PowerShell can implement stronger IKEv2 secuirty targets for both Windows 8.1 and 2012R2:

New-NetIPsecMainModeCryptoProposal -Encryption AES256127 -Hash SHA256 -KeyExchange DH19
Be warned, the process is challenging.  If you go this route don't test it out on production servers.  Also, the TechNet examples create new GPO policy specific to IKEv2.  It does not account for all the other firewall rules.  In other words, it creates a new firewall policy that only permits IKEv2 traffic -it's easy to get locked out without console access.  

The trick is to copy ALL firewalls rules and IPsec rules, crypto-sets, and IPsec rules (and anything else I haven't thought of) to the new GPO -all through PowerShell.  Alternately, use the GUI to copy the existing firewall settings to a separate firewall policy (i.e., separate from the PowerShell IKEv2 GPO).  Do not use the GPO GUI to edit the IKEv2 (i.e., PowerShell) firewall or you risk corrupting it.   You can then apply both GPOs to the VPN server.     

Also, we may be able to accomplish the same thing by saving the object to the local policy store.  Don't take my word on this because I haven't tried it yet.  So yeah, this is a bit more work but the benefits should provide solid security and greater interoperability.   

If anyone completes this script before I get around to it please forward me your work!  Either way, I'm sure it will be good material for another blog article.

That's it!  


About Steven Jordan

Steven Jordan is an infrastructure and process management specialist. Steven holds a Master of Science degree in ICT from the University of Wisconsin Stout. Steven is also a Cisco Certified Network Professional (CCNP) and Master Gardener.
Newer Post
Older Post


  1. When I add reg key IKEv2CustomPolicy with DH14-AES256-SHA256 settings, I cannot connect to server with less security settings (for example from Win Phone).
    Is it possible to configure server to support more then one type of cipher sttings?

    1. Yes, this is a limitation (or strength). It prevents the use of weak cryptographic algorithms.
      For your situation, I suggest using dynamic site-to-site VPNs. You can define a different cipher-suite for every S2S interface. You can then assign S2S interfaces to specific clients. S2S VPNs work alongside RRAS remote access client VPNs:

  2. Hi Steven. I know this is an old post. Hope you reply.
    There is "IPsec Settings" in "Windows Firewall with Advanced Security", I tried to set the above parameters in there instead of registry but it didn't work. Why?

  3. It probably doesn't work because IPSec policies, in the Windows Firewall GUI, only apply to IKEv1 -not IKEv2. N.B., IPsec firewall policy will affect L2TP VPNs. That's only because L2TP and Win Firewall use the same flavor of IPsec (v1).

    The absolute easiest way to improve IPsec in Windows is with the NegotiateDH2048_AES256 regedit. Instructions are found here:

    This registry change provides acceptable security: DH14-AES1288-SHA1. It works for both IKEv1 (Win Firewall and L2TP) and IKEv2 VPNs. It also works for both clients and servers.

    The only limitation is that it prevents stronger cryptography. Nonetheless, it's a MUCH better option than doing nothing.

    1. Thanks. One more question. For Integrity Method you choose SHA-1. Why not SHA-256?

    2. By all means, choose the highest encryption levels that your hardware (i.e., servers and clients) supports. The only caveat is the highest encryption and hashing levels limit the number and types of devices that can connect.

      For example, the very first comment describes how their client was unable to connect after they implemented stronger security measures. Their old Windows phone simply could not connect to the server via DH14-AES256-SHA256. N.B., Neither can iPhone 6 or iPhone 7.

      In a perfect world, we implement a policy that prevents insecure devices altogether. In the real world, we support Windows laptops, Android phones, iPhones, Chromebooks, etc.. Each device has different encryption and hashing limitations. However, in my experience most devices support MM:IKE-DH14-AES256-SHA1 and QM: AES128-SHA1.