Always On VPN IKEv2 Load Balancing with KEMP LoadMaster

Always On VPN IKEv2 Load Balancing with KEMP LoadMasterInternet Key Exchange version 2 (IKEv2) is an IPsec-based VPN protocol with configurable security parameters that allows administrators to ensure the highest level of security for Windows 10 Always On VPN clients. It is the protocol of choice for deployments that require the best possible protection for communication between remote clients and the VPN server. IKEv2 has some unique requirements when it comes to load balancing, however. Because it uses UDP on multiple ports, configuring the load balancer requires some additional steps for proper operation. This article demonstrates how to enable IKEv2 load balancing using the Kemp LoadMaster load balancer.

IKEv2 and NAT

IKEv2 VPN security associations (SAs) begin with a connection to the VPN server that uses UDP port 500. During this initial exchange, if it is determined that the client, server, or both are behind a device performing Network Address Translation (NAT), the connection switches to UDP port 4500 and the connection establishment process continues.

IKEv2 Load Balancing Challenges

Since UDP is connectionless, there’s no guarantee that when the conversation switches from UDP 500 to UDP 4500 that the load balancer will forward the request to the same VPN server on the back end. If the load balancer forwards the UDP 500 session from a VPN client to one real server, then forwards the UDP 4500 session to a different VPN server, the connection will fail. The load balancer must be configured to ensure that both UDP 500 and 4500 from the same VPN client are always forwarded to the same real server to ensure proper operation.

Port Following

To meet this unique requirement for IKEv2 load balancing, it is necessary to use a feature on the KEMP LoadMaster load balancer called “port following”. Enabling this feature will ensure that a VPN client using IKEv2 will always have their UDP 500 and 4500 sessions forwarded to the same real server.

Load Balancing IKEv2

Open the web-based management console and perform the following steps to enable load balancing of IKEv2 traffic on the KEMP LoadMaster load balancer.

Create the Virtual Server

  1. Expand Virtual Services.
  2. Click Add New.
  3. Enter the IP address to be used by the virtual server in the Virtual Address field.
  4. Enter 500 in the Port field.
  5. Select UDP from the Protocol drop-down list.
  6. Click Add this Virtual Service.

Always On VPN IKEv2 Load Balancing with KEMP LoadMaster

Add Real Servers

  1. Expand Real Servers.
  2. Click Add New.
  3. Enter the IP address of the VPN server in the Real Server Address field.
  4. Click Add This Real Server.
  5. Repeat the steps above for each VPN server in the cluster.

Always On VPN IKEv2 Load Balancing with KEMP LoadMaster

Repeat all the steps above to create another virtual server using UDP port 4500.

Always On VPN IKEv2 Load Balancing with KEMP LoadMaster

Enable Layer 7 Operation

  1. Click View/Modify Services below Virtual Services in the navigation tree.
  2. Select the first virtual server and click Modify.
  3. Expand Standard Options.
  4. Uncheck Force L4.
  5. Check Transparency (additional configuration may be required – details here).
  6. Select Source IP Address from the Persistence Options drop-down list.
  7. Choose an appropriate value from the Timeout drop-down list.
  8. Choose an appropriate setting from the Scheduling Method drop-down list.
  9. Click Back.
  10. Repeat these steps on the second virtual server.

Always On VPN IKEv2 Load Balancing with KEMP LoadMaster

Enable Port Following

  1. Click View/Modify Services below Virtual Services in the navigation tree.
  2. Select the first virtual server and click Modify.
  3. Expand Advanced Properties.
  4. Select the virtual server using UDP 500 from the Port Following drop-down list.
  5. Click Back.
  6. Repeat these steps on the second virtual server.

Always On VPN IKEv2 Load Balancing with KEMP LoadMaster

Demonstration Video

The following video demonstrates how to enable IKEv2 load balancing for Windows 10 Always On VPN using the KEMP LoadMaster Load Balancer.


With the KEMP LoadMaster load balancer configured to use port following, Windows 10 Always On VPN clients using IKEv2 will be assured that their connections will always be delivered to the same back end VPN server, resulting in reliable load balancing for IKEv2 connections.

Additional Information

Windows 10 Always On VPN Certificate Requirements for IKEv2

Windows 10 Always On VPN Protocol Recommendations for Windows Server RRAS

Leave a comment


  1. Dhana

     /  September 24, 2019

    Great post, really helps. A quick question – in this guidance, the VPN servers may not see the actual client IP address. Is this the best approach, or can we configure the LBs without replacing the actual client IPs?

    • Great observation. Indeed, in this case the load balancer appears as the source IP address to the VPN server, which might be problematic. You can always disable Subnet Originating Reqeusts and enable Transparency on the LoadMaster, which will result in the real IP address being presented as the source IP address to the VPN server. You just need to be mindful of routing and firewall configuration to ensure traffic is handled correctly in this scenario.

      • Luca

         /  March 31, 2020

        Hi Richard,

        I would like to report my last experience with a AlwaysON environment with a custom load balancer who doesn’t support “Transparency”.
        On both (2) RRAS nodes, all the clients (Device Tunnel) were saw with the load balancer IP address. The users were experiencing a lot of issues and the customer opened a ticket to Microsoft Support.
        Microsoft specialist has applied a change to a registry key (on the RRAS servers) in order to bypass the client IP address problem, as a workaround. Now the situation it seems to be more stable.
        Do you think that the workaround could cause other issues?

        Thanks in advance.

      • I’m assuming the registry key you made changes to was HKLM\SYSTEM\CurrentControlSet\Services\IKEEXT\Parameters\IkeNumEstablishedForInitialQuery, correct? FYI, I have a PowerShell script that configures this setting here:

        While this setting can provide some stability for Always On VPN IKEv2 connections behind a load balancer or firewall performing NAT, it is not a complete solution. There are other settings in Windows that are hard coded that can present issues as well. The best way to resolve this is to ensure that the RRAS server sees the real client IP address.

        To answer your question though, I don’t believe enabling this workaround will cause any other issues.

      • Luca

         /  April 2, 2020

        Than you Richard, I completely agree with you.

  2. Matthew Rawles

     /  November 3, 2019

    Hi Richard,

    (i’ve also commented under you BIG-IP Load balancing section)

    I’ve been testing a KEMP Loadmaster with always-on over the last few days and i’m seeing some 809 errors after the Loadmaster has had clients connecting sucessfully for a few days.

    When I orginally reached out I thought the errors were down to the number of IKE ports the real servers had, but they now have 1000s so thats not the issue.

    I’ve been testing with 40 virtual clients and a couple of real users, the virtual clients i’ve moved about (changing the source IP and therefore the real server they get directed to). For 2 days had no issues, managed to load up the clients with a file copy to push 800Mbps through them collectively (something that crashed our orginal Jet Nexus load balancer).

    Then this evening I was unable to connect one of the test laptops with IKE (user was ok). Rebootind the real servers didnt resolve this, rebooting the Load Master fixed it immedaitely.

    The Load Master is configured single-arm, with it’s interface in the same VLAN as the external interfaces of the RRAS servers.

    I’ll go back to Kemp tomorrow, see if they have any ideas, they already made me downgrade to version as the current version 7.2.48 wouldnt allow any UDP VPNs to work!

    I would go back and try the BIG-IP from F5 but that is so poorly documented online, there is no step by step guide to the working always-on setup I can find.


    Matthew Rawles

    • Yes, I’ve found that the latest LMOS release is causing problems for IKEv2 connections. I’ve made Kemp aware of the issue, so hopefully they’ll be addressing soon!

  3. Julien Potier

     /  November 14, 2019

    Hi Richard. Thanks for your article. I spoke to you about a year ago when i was deploying OAVPN for a customer i look after. Back then i was trying to bring some resilience into the design which AOVPN fundamentally lacks. I can’t remember if i tried Kemp but i know i tried a couple of solutions and each time the encrypted throughput when proxied was disappointing. At best i’d get 30-40Mbps max from a single connection whereas i got several hundred Mbps when targeting the server directly. Have you tried doing some throughput test with Kemp ?

    • I’ve done some basic performance testing for the Kemp and F5 load balancers and never really noticed a significant drop off in performance. No question any load balancer (the Kemp and F5 included) do impede throughput a little bit, not not substantially in my limited testing. The most impactful in terms of performance is firewalls. Depending on which security features are enabled I’ve seen dramatic reduction in performance.

    • Matthew Rawles

       /  November 14, 2019

      Hi Julien,

      I have been testing a KEMP loadmaster this last few weeks and have had the loadmaster up to 800Mbps using multiple clients running looping file copy tasks (the clients are all located in a test virtual environment with >1gb ethernet access to the loadmaster). This was only IKE device VPNs which do seem to perform better.

      It is worth talking to KEMP , they have a number of tweaks to the loadmaster even after you use the template to create the VS (we for example have the IP persistence timeout set to a very large value, currently 8 hours, considering making that 24 hours as we get occasional issues with persistence on test clients).

      Its better to have a more realistic load with multiple clients than one massive client.



  4. RKast

     /  November 21, 2019

    Hi sir,
    Can we use Windows NLB on 2 RRAS servers in a cluster in Multicast for always on vpn nlb ? What are recommedations for windows nlb and affinity, single ? I have set this up and if i initiate a vpn and get connected to RAS1 then disconnect then turn of RAS1 and initiate VPN again i cannot connect, any idea? I have set udp 500 4500 and 443 in nlb ports am i missing ports?
    Thanks for your reply.

    • I don’t have much experience with NLB, so I don’t have a lot of guidance to offer you unfortunately. I would suggest that you use Unicast mode unless you have a very specific reason to use Multicast (for example you’re running in VMware). Other than that, I would think single affinity should work.

  5. Luca

     /  March 17, 2020

    Hi Richard, based on your experience, which is the correct value for persistence timeout?
    Thanks in advance,

    • There is no correct value, really. It can be set to whatever you like, really. I typically recommend 5 minutes, but you can set it lower or higher if that better suits your needs! 🙂

      • Luca

         /  March 25, 2020

        Thanks for your reply. 👍🏼

  6. Andrew

     /  March 27, 2020

    Thank you for the very helpful article!

    How would IPSec (e.g. ESP, IP protocol 50, and AH, IP protocol 51) be directed to the correct VPN server by LoadMaster in the case where IKE does not detect NAT?

    • I’m not sure. The only options for virtual server configuration on the Kemp are TCP and UDP. Doesn’t appear to support IP protocols. :/

  7. Stan Ley

     /  August 13, 2020

    It may be worth for people that are using Kemp to load balance IKEv2 Always On VPN, to look at the below link. The port following when configured through the GUI was not working before Firmware 7.2.51

  8. primethirty7

     /  April 21, 2021

    Really good article, we are looking at deploying this behind a pair of A10 devices. I notice you have other articles for F5’s etc, any plans for an A10 write up ?


    • No plans, but I’m not opposed. Is there a virtual appliance I could download that includes a free evaluation? If so, I’d be happy to write something up. 🙂

  1. Always On VPN IKEv2 Security Configuration | Richard M. Hicks Consulting, Inc.
  2. Always On VPN IKEv2 Connection Failure Error Code 800 | Richard M. Hicks Consulting, Inc.
  3. Always On VPN IKEv2 and SSTP Fallback | Richard M. Hicks Consulting, Inc.
  4. Always On VPN and Network Policy Server (NPS) Load Balancing | Richard M. Hicks Consulting, Inc.
  5. Always On VPN IKEv2 Load Balancing with F5 BIG-IP | Richard M. Hicks Consulting, Inc.
  6. Always On VPN IKEv2 Features and Limitations | Richard M. Hicks Consulting, Inc.
  7. Always On VPN Load Balancing Deployment Guide for Kemp Load Balancers | Richard M. Hicks Consulting, Inc.
  8. Always On VPN Load Balancing with Kemp in Azure | Richard M. Hicks Consulting, Inc.
  9. Always On VPN IKEv2 Load Balancing Issue with Kemp LoadMaster | Richard M. Hicks Consulting, Inc.
  10. Always On VPN IKEv2 Load Balancing and NAT | Richard M. Hicks Consulting, Inc.

Leave a Reply to Stan Ley Cancel reply

%d bloggers like this: