How to connect to NordVPN with IKEv2/IPSec on Linux

Introduction

This guide will show you how to use StrongSwan to set up a manual IKEv2/IPSec connection to NordVPN on Linux (Debian-based, but works similarly on other distributions).

Before you start

  • Ensure you can log in to your Nord Account.
  • Make sure you can access your email account.

Here’s what to do

NOTE: If you use a different package manager, replace apt-get with the one you use.

  1. Make sure your operating system is up-to-date with this command:
sudo apt-get update && sudo apt-get upgrade
  1. Download the packages by running these commands in the terminal:
sudo apt-get install strongswan libcharon-extra-plugins 


NOTE: For Arch-based distributions and others, you might not have libcharon packages, as they are in the strongswan package. Therefore, run this command instead:

pacman -S strongswan
  1. Open the “ipsec.secrets” file. 
    NOTE: Copy-pasting the command may lead to issues. It would be best to type it out by hand.
sudo nano /etc/ipsec.secrets
  1. Change the username and “your password” as follows:
     
    1. Log in to your Nord Account.
    2. Click “NordVPN” on the left side of the browser.
    3. Click on “Set up NordVPN manually.”
    4. Click "Service credentials."
    5. Click "Verify email." 
    6. You will receive a verification code in your registered email. Type the code in.
    7. Use the “Copy” button when copying the username and password.
    8. Enter username and password into /etc/ipsec.secrets file as in this example:
      SDwdwd225 : EAP “@Dwhis89$”

       NOTE: Make sure to have a space between username, :, and EAP.
  2. Save and open the “/etc/ipsec.conf” file with root privileges:
sudo nano /etc/ipsec.conf 
  1. Write this into the configuration file:
conn NordVPN
keyexchange=ikev2
dpdaction=clear
dpddelay=300s
eap_identity=”Username”
leftauth=eap-mschapv2
left=%defaultroute
leftsourceip=%config
right=SERVER_IP
rightauth=pubkey
rightsubnet=0.0.0.0/0
rightid=%SERVER_HOSTNAME
rightca=/etc/ipsec.d/cacerts/NordVPN.pem
type=tunnel
auto=add
  1. Update the configuration file:
     
    1. Fill in the Username, take it from step 4, for example:
      eap_identity="SDwdwd225"
    2. Fill in the “SERVER_HOSTNAME” field:
       
      1. Log in to your Nord Account.
      2. Click “NordVPN” on the left side of the browser.
      3. Click on “Set up NordVPN manually.”
      4. Click "Server recommendation."
      5. Next to "Available protocols," click "IKEv2/IPsec."
      6. Copy the server hostname, and use it in your config file, for example:
        rightid=%us5783.nordvpn.com
         
    3. Fill in the "SERVER_IP" field:
       
      1. Open a new terminal window.
      2. Run this command, but change the hostname to the one you got from step 2:
dig +short us5783.nordvpn.com

Copy the returned IP and use it in your config file, for example:
right=84.17.45.205

  1. Open the “constraints.conf” file by writing this command:
sudo nano /etc/strongswan.d/charon/constraints.conf
  1. Inside the file, change “load = yes” to “load = no”.
  2. Download the NordVPN RSA certificate by running this command:
sudo wget https://downloads.nordcdn.com/certificates/root.pem -O /etc/ipsec.d/cacerts/NordVPN.pem
  1. Restart “ipsec” in order to reload all configuration files:
sudo ipsec restart

NOTE: If you have made any typos in the “/etc/ipsec.conf” file, you will be notified when the service starts.

  1. Connect to the “NordVPN” configuration by writing:
sudo ipsec up NordVPN 

NOTE: If you connected, “ipsec” should output: “Connection NordVPN has been established successfully.” If you don’t get it and you see many “auth_fail” errors, follow these steps:

  1. Remove all “ipsec.secrets” files by running:
sudo rm /etc/ipsec.sec*
  1. Create a new “ipsec.secrets” file using this command:
sudo nano /etc/ipsec.secrets
  1. Enter the credentials described in step 4 of the main guide and save the file.
  2. Restart the “ipsec” service and try connecting again:
sudo ipsec restart 
sudo ipsec up NordVPN

Additional tips

  • Restart your device.
  • Try a different network.
  • Turn off any additional VPN services.
Was this article helpful?

Still having issues?

  • Live chat

  • Email form

By clicking “Chat with support”, you agree to our Terms of Service and acknowledge our Privacy Policy. Chat functionality relies on cookies. By starting the chat, you agree to their use. Learn more in our Cookie Policy.