Scripts for automatic configuration of IPsec/L2TP VPN server on Ubuntu 14.04 & 12.04, Debian 8 and CentOS/RHEL 6 & 7. All you need to do is provide your own values for `IPSEC_PSK`, `VPN_USER` and `VPN_PASSWORD`, and they will handle the rest. These scripts can also be directly used as the Amazon EC2 "user-data" when creating a new instance.
We will use <ahref="https://libreswan.org/"target="_blank">Libreswan</a> as the IPsec server, and <ahref="https://www.xelerance.com/services/software/xl2tpd/"target="_blank">xl2tpd</a> as the L2TP provider.
You may use the scripts `vpnupgrade_Libreswan.sh` (for Ubuntu/Debian) and `vpnupgrade_Libreswan_centos.sh` (for CentOS/RHEL) to upgrade <ahref="https://libreswan.org/"target="_blank">Libreswan</a> to a newer version.
For Windows users, a <ahref="https://documentation.meraki.com/MX-Z/Client_VPN/Troubleshooting_Client_VPN#Windows_Error_809"target="_blank">one-time registry change</a> is required for connections to a VPN server behind NAT (e.g. Amazon EC2).
If using Amazon EC2, these ports must be open in the security group of your VPN server: UDP ports 500 & 4500, and TCP port 22 (optional, for SSH).
If your server uses a custom SSH port (not 22), or if you wish to allow other services through IPTables, be sure to edit the IPTables rules in the scripts before using.
The scripts will backup /etc/rc.local, /etc/sysctl.conf, /etc/iptables.rules and /etc/sysconfig/iptables before overwriting them. Backups can be found under the same folder with .old suffix.
Copyright (C) 2014 Lin Song <ahref="https://www.linkedin.com/in/linsongui"target="_blank"><imgsrc="https://static.licdn.com/scds/common/u/img/webpromo/btn_profile_bluetxt_80x15.png"width="80"height="15"border="0"alt="View my profile on LinkedIn"></a>
This work is licensed under the <ahref="http://creativecommons.org/licenses/by-sa/3.0/"target="_blank">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>