Howdy, Stranger!

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

Advertise on LowEndTalk.com
Auto install script for IPsec L2TP VPN
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

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:

https://github.com/sarfata/voodooprivacy/blob/master/voodoo-vpn.sh

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 - 'http://169.254.169.254/latest/meta-data/local-ipv4'`
PUBLIC_IP=`wget -q -O - 'http://169.254.169.254/latest/meta-data/public-ipv4'`

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 https://blog.ls20.com

Comments

Sign In or Register to comment.