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.
-
Make sure your operating system is up-to-date with this command:
sudo apt-get update && sudo apt-get upgrade -
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 -
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 -
Change the username and “your password” as follows:
- Log in to your Nord Account.
- Click “NordVPN” on the left side of the browser.
- Click on “Set up NordVPN manually.”
- Click "Service credentials."
- Click "Verify email."
- You will receive a verification code in your registered email. Type the code in.
- Use the “Copy” button to copy the service credential username and paste it into the “Username” string.
-
Use the “Copy” button to copy the service credential password and paste it into the “Password” string. The password must be enclosed in double quotes.
NOTE: Make sure to have a space between username, :, and EAP.
-
Save and open the “/etc/ipsec.conf” file with root privileges:
sudo nano /etc/ipsec.conf -
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 - Get your server hostname.
- Log in to your Nord Account, and click NordVPN.
- Scroll down to Advanced Settings and click Set up NordVPN manually.
- Select the Server recommendation tab.
- Next to Available protocols, select IKEv2/IPSec.
- Copy the server hostname and use it in your config file.
- Change Username to your NordVPN service credentials username from step 4. Fill in the “SERVER_IP” and “SERVER_HOSTNAME” fields with the server hostname you got in step 7. For example, us5783.nordvpn.com.
-
Open the “constraints.conf” file by writing this command:
sudo nano /etc/strongswan.d/charon/constraints.conf - Inside the file, change “load = yes” to “load = no”.
-
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 -
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. -
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:-
Remove all “ipsec.secrets” files by running:
sudo rm /etc/ipsec.sec* -
Create a new “ipsec.secrets” file using this command:
sudo nano /etc/ipsec.secrets - Enter the credentials described in step 4 of the main guide and save the file.
-
Restart the “ipsec” service and try connecting again:
sudo ipsec restartsudo ipsec up NordVPN
-
Additional tips
- Restart your device.
- Try a different network.
- Turn off any additional VPN services.