You are not logged in.

#1 2015-04-11 04:17:15

gmhafiz
Member
From: Sydney
Registered: 2008-07-19
Posts: 27
Website

[VPN] [GUIDE] Setting up nordvpn with systemd

Since I haven't seen specific guide to setting up nordvpn for archlinux with systemd, I thought I should write them up what I have done. This might be useful for those unfamiliar with systemd. Simply connecting with provided *.ovpn file do not update the DNS correctly and the command
sudo systemctl start openvpn@someovpnfile.ovpn do not work.

1. Follow nordvpn's connecting with shell instruction at https://nordvpn.com/tutorials/linux/linux-openvpn/ and make sure you can manually connect by typing:

sudo openvpn vpn_at_nordvpn_tcp.ovpn

2. Create unit systemd for a server

sudo nano /etc/systemd/system/nordvpn.service
[Unit]
Description=OpenVPN connection to yourovpn.ovpn

[Service]
Type=forking
ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/yourovpn.ovpn --daemon openvpn@yourovpn.ovpn --writepid /run/openvpn@yourovpn.ovpn.pid
PIDFile=/run/openvpn@yourovpn.ovpn.pid

[Install]
WantedBy=multi-user.target

replace yourovpn with the desired server.

For whatever reason, the following modified /usr/lib/systemd/system/openvpn@.service do not work.

[Unit]
Description=OpenVPN connection to %i

[Service]
Type=forking
#ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/%i.conf --daemon openvpn@%i --writepid /run/openvpn@%i.pid
ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/%i.ovpn --daemon openvpn@%i --writepid /run/openvpn@%i.pid
PIDFile=/run/openvpn@%i.pid

[Install]
WantedBy=multi-user.target

3. The DNS was not updated. So use the guide from the wiki and add these to your .ovpn file

# auto update /etc/resolv.conf
script-security 2	
up /etc/openvpn/update-resolv-conf.sh
down /etc/openvpn/update-resolv-conf.sh

the shell script is found at https://raw.githubusercontent.com/maste … lv-conf.sh

One issue I found is that you do not get that "Initialization Sequence Completed" to indicate a successful vpn connection. I had to either google my public ip address or type:

ip addr show | grep tun0

Any feedback or improvisations are appreciated.

Offline

Board footer

Powered by FluxBB