Prerequisites

I use libreswan on my Debian box. Install required packages:

1
apt install -y xl2tpd libreswan

Example Configurations

1
2
3
4
5
6
7
8
9
10
conn someconnnamehere
auto=add
authby=secret
type=transport
# ... or 17/1701 for L2TP
leftprotoport=gre
rightprotoport=gre
# set right to the ip address of your vpn server
right=1.1.1.1
left=192.168.1.1

… and edit /etc/ipsec.secrets, for a line of your PSK for the connection:

1
192.168.1.1 1.1.1.1 : PSK "your_pre_shared_key"

Then service ipsec restart to reload confs, and enable the connection by ipsec auto --add someconnnamehere.