Ubuntu – Encrypted Host-to-Host Tunnel on Ubuntu/Debian

ipsecSecuritytunnelingUbuntu

I'd like to connect two remote sites via a secure point to point tunnel. I've been using OpenVPN, but it's a little flakey and really seems to be more for connecting lots of users rather than a point to point link.

Redhat seems to have some nice built in scripts for building Point to Point IPSEC tunnels, but I haven't found anything similar in Ubuntu.

Any guidance on what to use here and how to do it? I'd like to keep it as simple as possible, but still have basic PSK security.

Best Answer

Assuming the following network settings:

Your public IP: 192.168.1.1
Your private network: 192.168.50.0/24
Remote public IP: 192.168.2.1
Remote private network: 192.168.51.0/24

1) Install StrongSwan using "sudo apt-get install strongswan"

2) Set up a secret key using "sudo vim /etc/ipsec.secrets":
192.168.1.1 192.168.2.1: PSK "secret_password"

3) Configure the routes using "sudo vim /etc/ipsec.conf":
conn partner
left=192.168.1.1
right=192.168.2.1
authby=secret
ike=3des-sha1-modp1024
esp=3des-sha1
pfs=yes
auto=start

conn local_to_partner
leftsubnet=192.168.1.1/32
rightsubnet=192.168.51.0/24
also=partner

conn partner_to_local
leftsubnet=192.168.50.0/24
rightsubnet=192.168.2.1/32
also=partner

Related Topic