Tricks & How To's

Build Your Own IPsec VPN Server: Auto Setup Scripts

Set up your own IPsec VPN server in just a few minutes, with both IPsec/L2TP and Cisco IPsec on Ubuntu, Debian and CentOS.

An IPsec VPN encrypts your network traffic, so that nobody between you and the VPN server can eavesdrop on your data as it travels via the Internet. This is especially useful when using unsecured networks, e.g. at coffee shops, airports or hotel rooms.

Scripts use Libreswan as the IPsec server, and xl2tpd as the L2TP provider.

 

Quick start

First, prepare your Linux server with a fresh install of Ubuntu LTS, Debian or CentOS.

Use this one-liner to set up an IPsec VPN server:

wget https://git.io/vpnsetup -O vpnsetup.sh && sudo sh vpnsetup.sh

If using CentOS, replace the link above with https://git.io/vpnsetup-centos.

Your VPN login details will be randomly generated, and displayed on the screen when finished.

For other installation options and how to set up VPN clients, read the sections below.

A dedicated server or virtual private server (VPS). OpenVZ VPS is not supported.

 

Features

  • New: The faster IPsec/XAuth ("Cisco IPsec") mode is supported
  • New: A pre-built Docker image of the VPN server is now available
  • Fully automated IPsec VPN server setup, no user input needed
  • Encapsulates all VPN traffic in UDP – does not need ESP protocol
  • Can be directly used as “user-data” for a new Amazon EC2 instance
  • Includes sysctl.conf optimizations for improved performance
  • Tested with Ubuntu 16.04/14.04, Debian 9/8 and CentOS 7/6

 

Requirements

A newly created Amazon EC2 instance, from these images (AMIs):

– or –

A dedicated server or KVM/Xen-based virtual private server (VPS), freshly installed with one of the above OS. OpenVZ VPS is not supported, users could instead try OpenVPN or Shadowsocks.

This also includes Linux VMs in public clouds, such as DigitalOceanVultrLinodeGoogle Compute EngineAmazon LightsailMicrosoft AzureIBM BluemixOVH and Rackspace.

 

To Top

Pin It on Pinterest

Share This