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 when copying the username and password.
- 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.
- 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- Update the configuration file:
- Fill in the Username, take it from step 4, for example:
eap_identity="SDwdwd225" - Fill in the “SERVER_HOSTNAME” field:
- Log in to your Nord Account.
- Click “NordVPN” on the left side of the browser.
- Click on “Set up NordVPN manually.”
- Click "Server recommendation."
- Next to "Available protocols," click "IKEv2/IPsec."
-
Copy the server hostname, and use it in your config file, for example:
rightid=%us5783.nordvpn.com
- Fill in the "SERVER_IP" field:
- Open a new terminal window.
- Run this command, but change the hostname to the one you got from step 2:
- Fill in the Username, take it from step 4, for example:
dig +short us5783.nordvpn.comCopy the returned IP and use it in your config file, for example:
right=84.17.45.205
- 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 restartNOTE: 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 restart sudo ipsec up NordVPNAdditional tips
- Restart your device.
- Try a different network.
- Turn off any additional VPN services.