Your own IPSEC VPN in about 3 minutes using Digital Ocean

I have been wanting to setup my own IPSEC VPN for a while now to have a little bit of encryption from my network to the internet.  I found a good hosting provider for the VPN because it is so cheap ($5.00 a month) – Digital Ocean, then I realized that they only charge by the hour as long as you destroy the VPS. The VPN took about 30 minutes to setup. After a few times, I realized that I could turn this into a quick script. So now I can setup a VPS with a secure VPN in about two minutes, destroy it when I am done and only get charged a few pennies for having it. Here is how I do it. Please keep in mind that this has no warranty – if it melts down your server, sorry – but it hasn’t melted mine down yet!

First, sign up for an account at (Using the link will get you $10 for free).

Then create a Ubuntu 14.04 x64 droplet and wait for the 55 seconds for the VPS to spin up. While you are waiting, download my script from

when you are in your VPN, run the following commands:


copy and paste the text from the script to the SSH terminal. Press [CTRL+x] then [Y], then [Enter] to save the new script.

chmod +x

Then you must add the users by editing the file /etc/ppp/chap-secrets. After editing the file, use the following command to make the changes:

/etc/init.d/ipsec restart;  /etc/init.d/xl2tpd restart

And you now have your very own VPN server!



  • Digital Ocean – VPN cloud hosting with my referral link. (Using the link will get you $10 for free)
  • BitBucket – This is where the script is housed. Feel free to fork me if you have any improvements.
  • – the original install instructions (I just made it into a script)

One Reply to “Your own IPSEC VPN in about 3 minutes using Digital Ocean”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.