Lascade VPN

Windows 7, 8, 10 and 11

Windows 8, 10 and 11 users can automatically import IKEv2 configuration:

  1. Securely transfer the generated .p12 file to your computer.
  2. Right-click on ikev2_config_import.cmd and save this helper script to the same folder as the .p12 file.
  3. Right-click on the saved script, select Properties. Click on Unblock at the bottom, then click on OK.
  4. Right-click on the saved script, select Run as administrator and follow the prompts.

To connect to the VPN: Click on the wireless/network icon in your system tray, select the new VPN entry, and click Connect. Once connected, you can verify that your traffic is being routed properly by looking up your IP address on Google. It should say "Your public IP address is Your VPN Server IP".

If you get an error when trying to connect, see Troubleshooting.

Remove the IKEv2 VPN connection.

Using the following steps, you can remove the VPN connection and optionally restore the computer to the status before IKEv2 configuration import.

  1. Remove the added VPN connection in Windows Settings - Network - VPN. Windows 7 users can remove the VPN connection in Network and Sharing Center - Change adapter settings.

  2. (Optional) Remove IKEv2 certificates.

    1. Press Win+R, or search for mmc in the Start Menu. Open Microsoft Management Console.

    2. Open File - Add/Remove Snap-In. Select to add Certificates and in the window that opens, select Computer account -> Local Computer. Click on Finish -> OK to save the settings.

    3. Go to Certificates - Personal - Certificates and delete the IKEv2 client certificate. The name of the certificate is the same as the IKEv2 client name you specified (default: vpnclient). The certificate was issued by IKEv2 VPN CA.

    4. Go to Certificates - Trusted Root Certification Authorities - Certificates and delete the IKEv2 VPN CA certificate. The certificate was issued to IKEv2 VPN CA by IKEv2 VPN CA. Before deleting, make sure that there are no other certificate(s) issued by IKEv2 VPN CA in Certificates - Personal - Certificates.

  3. (Optional. For users who manually created the VPN connection) Restore registry settings. Note that you should backup the registry before editing.

    1. Press Win+R, or search for regedit in the Start Menu. Open Registry Editor.

    2. Go to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Rasman\Parameters and delete the item with name NegotiateDH2048_AES256, if it exists.

OS X (macOS)

First, securely transfer the generated .mobileconfig file to your Mac, then double-click and follow the prompts to import as a macOS profile. If your Mac runs macOS Big Sur or newer, open System Preferences and go to the Profiles section to finish importing. For macOS Ventura and newer, open System Settings and search for Profiles. When finished, check to make sure “IKEv2 VPN” is listed under System Preferences -> Profiles.

To connect to the VPN:

  1. Open System Preferences and go to the Network section.
  2. Select the VPN connection with Your VPN Server IP (or DNS name).
  3. Check the Show VPN status in menu bar checkbox. For macOS Ventura and newer, this setting can be configured in System Settings -> Control Center -> Menu Bar Only section.
  4. Click Connect, or slide the VPN switch ON.

(Optional feature) Enable VPN On Demand to automatically start a VPN connection when your Mac is on Wi-Fi. To enable, check the Connect on demand checkbox for the VPN connection, and click Apply. To find this setting on macOS Ventura and newer, click on the “i” icon on the right of the VPN connection.

You can customize VPN On Demand rules to exclude certain Wi-Fi networks (such as your home network).

Once connected, you can verify that your traffic is being routed properly by looking up your IP address on Google. It should say "Your public IP address is Your VPN Server IP".

If you get an error when trying to connect, see Troubleshooting.

Note: macOS 14 (Sonoma) has a minor issue that may cause IKEv2 VPN to disconnect and reconnect once every 24-48 minutes. Other macOS versions are not affected. For more details and a workaround, see macOS Sonoma clients reconnect.

Remove the IKEv2 VPN connection.

To remove the IKEv2 VPN connection, open System Preferences -> Profiles and remove the IKEv2 VPN profile you added.

iOS

First, securely transfer the generated .mobileconfig file to your iOS device, then import it as an iOS profile. To transfer the file, you may use:

  1. AirDrop, or
  2. Upload to your device (any App folder) using File Sharing, then open the “Files” App on your iOS device, move the uploaded file to the “On My iPhone” folder. After that, tap the file and go to the “Settings” App to import, or
  3. Host the file on a secure website of yours, then download and import it in Mobile Safari.

When finished, check to make sure “IKEv2 VPN” is listed under Settings -> General -> VPN & Device Management or Profile(s).

To connect to the VPN:

  1. Go to Settings -> VPN. Select the VPN connection with Your VPN Server IP (or DNS name).
  2. Slide the VPN switch ON.

(Optional feature) Enable VPN On Demand to automatically start a VPN connection when your iOS device is on Wi-Fi. To enable, tap the “i” icon on the right of the VPN connection, and enable Connect On Demand.

You can customize VPN On Demand rules to exclude certain Wi-Fi networks (such as your home network).

Once connected, you can verify that your traffic is being routed properly by looking up your IP address on Google. It should say "Your public IP address is Your VPN Server IP".

If you get an error when trying to connect, see Troubleshooting.

Remove the IKEv2 VPN connection.

To remove the IKEv2 VPN connection, open Settings -> General -> VPN & Device Management or Profile(s) and remove the IKEv2 VPN profile you added.

Android

Using strongSwan VPN client ( Older than Android 10 )

Android users can connect using strongSwan VPN client (recommended).

  1. Securely transfer the generated .sswan file to your Android device.
  2. Install strongSwan VPN Client from Google Play, F-Droid or strongSwan download server.
  3. Launch the strongSwan VPN client.
  4. Tap the “more options” menu on top right, then tap Import VPN profile.
  5. Choose the .sswan file you transferred from the VPN server.
    Note: To find the .sswan file, tap the three-line menu button, then browse to the location you saved the file.
  6. On the “Import VPN profile” screen, tap IMPORT CERTIFICATE FROM VPN PROFILE, and follow the prompts.
  7. On the “Choose certificate” screen, select the new client certificate, then tap Select.
  8. Tap IMPORT.
  9. Tap the new VPN profile to connect.

(Optional feature) You can choose to enable the “Always-on VPN” feature on Android. Launch the Settings app, go to Network & internet -> Advanced -> VPN, click the gear icon on the right of “strongSwan VPN Client”, then enable the Always-on VPN and Block connections without VPN options.

Android 10 and newer

  1. Securely transfer the generated .p12 file to your Android device.
  2. Install strongSwan VPN Client from Google Play, F-Droid or strongSwan download server.
  3. Launch the Settings application.
  4. Go to Security -> Advanced -> Encryption & credentials.
  5. Tap Install a certificate.
  6. Tap VPN & app user certificate.
  7. Choose the .p12 file you transferred from the VPN server, and follow the prompts.
    Note: To find the .p12 file, tap the three-line menu button, then browse to the location you saved the file.
  8. Launch the strongSwan VPN client and tap Add VPN Profile.
  9. Enter Your VPN Server IP (or DNS name) in the Server field.
    Note: If you specified the server’s DNS name (instead of its IP address) during IKEv2 setup, you must enter the DNS name in the Server field.
  10. Select IKEv2 Certificate from the VPN Type drop-down menu.
  11. Tap Select user certificate, select the new client certificate and confirm.
  12. (Important) Tap Show advanced settings. Scroll down, find and enable the Use RSA/PSS signatures option.
  13. Save the new VPN connection, then tap to connect.

Once connected, you can verify that your traffic is being routed properly by looking up your IP address on Google. It should say "Your public IP address is Your VPN Server IP".

If you get an error when trying to connect, see Troubleshooting.

Using native IKEv2 client

  1. Securely transfer the generated .p12 file to your Android device.
  2. Launch the Settings application.
  3. Go to Security -> Advanced -> Encryption & credentials.
  4. Tap Install a certificate.
  5. Tap VPN & app user certificate.
  6. Choose the .p12 file you transferred from the VPN server.
    Note: To find the .p12 file, tap the three-line menu button, then browse to the location you saved the file.
  7. Enter a name for the certificate, then tap OK.
  8. Go to Settings -> Network & internet -> VPN, then tap the “+” button.
  9. Enter a name for the VPN profile.
  10. Select IKEv2/IPSec RSA from the Type drop-down menu.
  11. Enter Your VPN Server IP (or DNS name) in the Server address field.
    Note: This must exactly match the server address in the output of the IKEv2 helper script.
  12. Enter anything (e.g. empty) in the IPSec identifier field.
    Note: This field should not be required. It is a bug in Android.
  13. Select the certificate you imported from the IPSec user certificate drop-down menu.
  14. Select the certificate you imported from the IPSec CA certificate drop-down menu.
  15. Select (receive from server) from the IPSec server certificate drop-down menu.
  16. Tap Save. Then tap the new VPN connection and tap Connect.

Once connected, you can verify that your traffic is being routed properly by looking up your IP address on Google. It should say "Your public IP address is Your VPN Server IP".

If you get an error when trying to connect, see Troubleshooting.

Linux

Before configuring Linux VPN clients, you must make the following change on the VPN server: Edit /etc/ipsec.d/ikev2.conf on the server. Append authby=rsa-sha1 to the end of the conn ikev2-cp section, indented by two spaces. Save the file and run service ipsec restart.

To configure your Linux computer to connect to IKEv2 as a VPN client, first install the strongSwan plugin for NetworkManager:

# Ubuntu and Debian
sudo apt-get update
sudo apt-get install network-manager-strongswan

# Arch Linux
sudo pacman -Syu  # upgrade all packages
sudo pacman -S networkmanager-strongswan

# Fedora
sudo yum install NetworkManager-strongswan-gnome

# CentOS
sudo yum install epel-release
sudo yum --enablerepo=epel install NetworkManager-strongswan-gnome

Next, securely transfer the generated .p12 file from the VPN server to your Linux computer. After that, extract the CA certificate, client certificate and private key. Replace vpnclient.p12 in the example below with the name of your .p12 file.

# Example: Extract CA certificate, client certificate and private key.
#          You may delete the .p12 file when finished.
# Note: You may need to enter the import password, which can be found
#       in the output of the IKEv2 helper script. If the output does not
#       contain an import password, press Enter to continue.
# Note: If using OpenSSL 3.x (run "openssl version" to check),
#       append "-legacy" to the 3 commands below.
openssl pkcs12 -in vpnclient.p12 -cacerts -nokeys -out ca.cer
openssl pkcs12 -in vpnclient.p12 -clcerts -nokeys -out client.cer
openssl pkcs12 -in vpnclient.p12 -nocerts -nodes  -out client.key
rm vpnclient.p12

# (Important) Protect certificate and private key files
# Note: This step is optional, but strongly recommended.
sudo chown root:root ca.cer client.cer client.key
sudo chmod 600 ca.cer client.cer client.key

You can then set up and enable the VPN connection:

  1. Go to Settings -> Network -> VPN. Click the + button.
  2. Select IPsec/IKEv2 (strongswan).
  3. Enter anything you like in the Name field.
  4. In the Gateway (Server) section, enter Your VPN Server IP (or DNS name) for the Address.
  5. Select the ca.cer file for the Certificate.
  6. In the Client section, select Certificate(/private key) in the Authentication drop-down menu.
  7. Select Certificate/private key in the Certificate drop-down menu (if exists).
  8. Select the client.cer file for the Certificate (file).
  9. Select the client.key file for the Private key.
  10. In the Options section, check the Request an inner IP address checkbox.
  11. In the Cipher proposals (Algorithms) section, check the Enable custom proposals checkbox.
  12. Leave the IKE field blank.
  13. Enter aes128gcm16 in the ESP field.
  14. Click Add to save the VPN connection information.
  15. Turn the VPN switch ON.

Alternatively, you may connect using the command line. See #1399 and #1007 for example steps. If you encounter error Could not find source connection, edit /etc/netplan/01-netcfg.yaml and replace renderer: networkd with renderer: NetworkManager, then run sudo netplan apply. To connect to the VPN, run sudo nmcli c up VPN. To disconnect: sudo nmcli c down VPN.

Once connected, you can verify that your traffic is being routed properly by looking up your IP address on Google. It should say "Your public IP address is Your VPN Server IP".

If you get an error when trying to connect, see Troubleshooting.

RouterOS

Note: These steps were contributed by @Unix-User. It is recommended to run terminal commands via an SSH connection, e.g. via Putty.

  1. Securely transfer the generated .p12 file to your computer.

  2. In WinBox, go to System > certificates > import. Import the .p12 certificate file twice (yes, import the same file two times!). Verify in your certificates panel. You will see 2 files, the one that is marked KT is the key.

    Or you can use terminal instead (empty passphrase):

    [admin@MikroTik] > /certificate/import file-name=mikrotik.p12
    passphrase:
    
      certificates-imported: 2
      private-keys-imported: 0
             files-imported: 1
        decryption-failures: 0
      keys-with-no-certificate: 0
    
    [admin@MikroTik] > /certificate/import file-name=mikrotik.p12
    passphrase:
    
         certificates-imported: 0
         private-keys-imported: 1
                files-imported: 1
           decryption-failures: 0
      keys-with-no-certificate: 0
    
    
  3. Run these commands in terminal. Replace the following with your own values.
    YOUR_VPN_SERVER_IP_OR_DNS_NAME is your VPN server IP or DNS name.
    IMPORTED_CERTIFICATE is the name of the certificate from step 2 above, e.g. vpnclient.p12_0
    (the one flagged with KT - Priv. Key Trusted - if not flagged as KT, import certificate again).
    THESE_ADDRESSES_GO_THROUGH_VPN are the local network addresses that you want to browse through the VPN.
    Assuming that your local network behind RouterOS is 192.168.0.0/24, you can use 192.168.0.0/24
    for the entire network, or use 192.168.0.10 for just one device, and so on.

    /ip firewall address-list add address=THESE_ADDRESSES_GO_THROUGH_VPN list=local
    /ip ipsec mode-config add name=ike2-rw responder=no src-address-list=local
    /ip ipsec policy group add name=ike2-rw
    /ip ipsec profile add name=ike2-rw
    /ip ipsec peer add address=YOUR_VPN_SERVER_IP_OR_DNS_NAME exchange-mode=ike2 \
        name=ike2-rw-client profile=ike2-rw
    /ip ipsec proposal add name=ike2-rw pfs-group=none
    /ip ipsec identity add auth-method=digital-signature certificate=IMPORTED_CERTIFICATE \
        generate-policy=port-strict mode-config=ike2-rw \
        peer=ike2-rw-client policy-template-group=ike2-rw
    /ip ipsec policy add group=ike2-rw proposal=ike2-rw template=yes
    
  4. For more information, see #1112.

tested on
mar/02/2022 12:52:57 by RouterOS 6.48
RouterBOARD 941-2nD

IKEv2 troubleshooting

See also: Check logs and VPN status, IKEv1 troubleshooting and Advanced usage.

Cannot connect to the VPN server

First, make sure that the VPN server address specified on your VPN client device exactly matches the server address in the output of the IKEv2 helper script. For example, you cannot use a DNS name to connect if it was not specified when setting up IKEv2. To change the IKEv2 server address, read this section.

For servers with an external firewall (e.g. EC2/GCE), open UDP ports 500 and 4500 for the VPN. Aliyun users, see #433.

Check logs and VPN status for errors. If you encounter retransmission related errors and are unable to connect, there may be network issues between the VPN client and server. If you are connecting from mainland China, consider switching to alternative solutions other than IPsec VPN.

Ubuntu 20.04 cannot import client config

If you installed the IPsec VPN before 2024-04-10, and your VPN server runs Ubuntu Linux version 20.04, you may have encountered an issue where newly generated client configuration files (.mobileconfig) fail to import on iOS or macOS device(s) with errors like “incorrect password”. This could be caused by updates to libnss3 related packages on Ubuntu 20.04, which required some changes (25670f3) in the IKEv2 script.

To fix this issue, first update the IKEv2 script on your server to the latest version using these instructions. After that, run sudo ikev2.sh and select “export” to re-create the client configuration files.

macOS Sonoma clients reconnect

macOS 14 (Sonoma) has a minor issue that may cause IKEv2 VPN to disconnect and reconnect once every 24-48 minutes. Other macOS versions are not affected. First check your macOS version. To work around this issue, follow the steps below.

Note: If you installed IPsec VPN after December 10, 2023, no action is required because the following fixes are already included.

  1. Edit /etc/ipsec.d/ikev2.conf on the VPN server. Find the line:
      ike=aes256-sha2,aes128-sha2,aes256-sha1,aes128-sha1
    
    and replace it with the following:
      ike=aes_gcm_c_256-hmac_sha2_256-ecp_256,aes256-sha2,aes128-sha2,aes256-sha1,aes128-sha1
    
    Note: Docker users should first open a Bash shell inside the container.
  2. Save the file and run service ipsec restart. Docker users: After step 4 below, exit the container and run docker restart ipsec-vpn-server.
  3. Edit /opt/src/ikev2.sh on the VPN server. Find and replace the following sections with these new values:
      <key>ChildSecurityAssociationParameters</key>
      <dict>
        <key>DiffieHellmanGroup</key>
        <integer>19</integer>
        <key>EncryptionAlgorithm</key>
        <string>AES-256-GCM</string>
        <key>LifeTimeInMinutes</key>
        <integer>1410</integer>
      </dict>
    
      <key>IKESecurityAssociationParameters</key>
      <dict>
        <key>DiffieHellmanGroup</key>
        <integer>19</integer>
        <key>EncryptionAlgorithm</key>
        <string>AES-256-GCM</string>
        <key>IntegrityAlgorithm</key>
        <string>SHA2-256</string>
        <key>LifeTimeInMinutes</key>
        <integer>1410</integer>
      </dict>
    
  4. Run sudo ikev2.sh to export (or add) updated client config files for each macOS device you have.
  5. Remove the previously imported IKEv2 profile (if any) from your macOS device(s), then import the updated .mobileconfig file(s). See Configure IKEv2 VPN clients. Docker users, see Configure and use IKEv2 VPN.

Unable to connect multiple IKEv2 clients

To connect multiple IKEv2 clients from behind the same NAT (e.g. home router) at the same time, you will need to generate a unique certificate for each client. Otherwise, you could encounter the issue where a later connected client affects the VPN connection of an existing client, which may lose Internet access.

To generate certificates for additional IKEv2 clients, run the helper script with the --addclient option. To customize client options, run the script without arguments.

sudo ikev2.sh --addclient [client name]

IKE authentication credentials are unacceptable

If you encounter this error, make sure that the VPN server address specified on your VPN client device exactly matches the server address in the output of the IKEv2 helper script. For example, you cannot use a DNS name to connect if it was not specified when setting up IKEv2. To change the IKEv2 server address, read this section.

Policy match error

To fix this error, you will need to enable stronger ciphers for IKEv2 with a one-time registry change. Download and import the .reg file below, or run the following from an elevated command prompt.

REG ADD HKLM\SYSTEM\CurrentControlSet\Services\RasMan\Parameters /v NegotiateDH2048_AES256 /t REG_DWORD /d 0x1 /f

Parameter is incorrect

If you encounter “Error 87: The parameter is incorrect” when trying to connect using IKEv2 mode, try the solutions in this issue, more specifically, step 2 “reset device manager adapters”.

Cannot open websites after connecting to IKEv2

If your VPN client device cannot open websites after successfully connecting to IKEv2, try the following fixes:

  1. Some cloud providers, such as Google Cloud, set a lower MTU by default. This could cause network issues with IKEv2 VPN clients. To fix, try setting the MTU to 1500 on the VPN server:

    # Replace ens4 with the network interface name on your server
    sudo ifconfig ens4 mtu 1500
    

    This setting does not persist after a reboot. To change the MTU size permanently, refer to relevant articles on the web.

  2. If your Android or Linux VPN client can connect using IKEv2 mode, but cannot open websites, try the fix in Android/Linux MTU/MSS issues.

  3. Windows VPN clients may not use the DNS servers specified by IKEv2 after connecting, if the client’s configured DNS servers on the Internet adapter are from the local network segment. This can be fixed by manually entering DNS servers such as Google Public DNS (8.8.8.8, 8.8.4.4) in network interface properties -> TCP/IPv4. For more information, see Windows DNS leaks and IPv6.

Windows 10 connecting

If using Windows 10 and the VPN is stuck on “connecting” for more than a few minutes, try these steps:

  1. Right-click on the wireless/network icon in your system tray.
  2. Select Open Network & Internet settings, then on the page that opens, click VPN on the left.
  3. Select the new VPN entry, then click Connect.

Other known issues

The built-in VPN client in Windows may not support IKEv2 fragmentation (this feature requires Windows 10 v1803 or newer). On some networks, this can cause the connection to fail or have other issues. You may instead try the IPsec/L2TP or IPsec/XAuth mode.