Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Advertise on
Auto install script for IPsec L2TP VPN
New on LowEndTalk? Please Register and read our Community Rules.

Auto install script for IPsec L2TP VPN

howardsl2howardsl2 Member
edited January 2014 in Tutorials

Just want to share with you guys an auto install script for IPsec L2TP VPN. The script was not written by me; however I found it very useful for automating VPN setup on a fresh Ubuntu 12.04 server:

Although the script was created for EC2, it can be easily adapted for other VPS running on a public IP. Just replace all $PRIVATE_IP with $PUBLIC_IP and it should work. The IPsec configuration already includes forceencaps=yes, which means the VPN encapsulates everything in UDP so it works even without GRE protocol support.

There's a typo in the script for getting the IP info from EC2. The correct lines are:

PRIVATE_IP=`wget -q -O - ''`
PUBLIC_IP=`wget -q -O - ''`

Also, I wrote a bash script to automatically update IP addresses in VPN config files at boot time. This can be useful if the IP of your VPS ever changes, for example when taking snapshots and later re-deploy in iwStack, DigitalOcean, etc., and avoids the time-consuming task of editing config files manually. Please browse to my tech blog at


Sign In or Register to comment.