Quick setup of L2TP or IPsec VPN on CentOS, Ubuntu or Debian

One line setup:

First get a fresh install of Ubuntu LTS, Debian or CentOS on your hosteons VPS or Dedicated Server (VPS should be KVM based not OpenVZ, if you are using hosteons.com VPS then need not worry as it’s KVM based VPS)

Use following command to set up an IPsec VPN server on Ubuntu or Debian:

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

If you are on CentOS then use following command:

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

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

Also it’s best to run these commands in a screen session to avoid any interruptions due to any reasons.

Custom Setup of VPN:

Ubuntu and Debian:

Make sure your VPS/Dedicated server is upto date, you can do it with following commands:

apt-get update && apt-get dist-upgrade

and reboot.

Now Edit the script and provide your own VPN credentials:

wget https://git.io/vpnsetup -O vpnsetup.sh
nano -w vpnsetup.sh
[Replace with your own values: YOUR_IPSEC_PSK, YOUR_USERNAME and YOUR_PASSWORD]

sudo sh vpnsetup.sh

CentOS:

Make sure your VPS/Dedicated server is upto date, you can do it with following commands:

yum -y update

(if you are using hosteons.com vps then need not worry, our templates update everything when the VPS is setup)

Now Edit the script and provide your own VPN credentials:

wget https://git.io/vpnsetup-centos -O vpnsetup.sh
nano -w vpnsetup.sh
[Replace with your own values: YOUR_IPSEC_PSK, YOUR_USERNAME and YOUR_PASSWORD]

sh vpnsetup.sh

 

Your VPN server is now ready, just connect using the Shared Key, username and password you provided during setup or displayed on script, depending upon how you setup your VPN.