iOS 10 Public beta version does not support PPTP anymore for security consideration. In a previous blog, I’ve shown how to setup PP2P VPN server on Ubuntu 14.04. Now, let’s setup L2TP/IPSec VPN.
Step 1: Install requirements
First change to sudo mode, because we’ll have to use sudo many more times.
1
sudo-s
then,
1
apt-get install openswan xl2tpd ppp lsof
Step 2: Configure firewall
1
iptables -t nat -A POSTROUTING -j SNAT --to-source %YOUR-SERVER-IP% -o eth
Here, please replace %YOUR-SERVER-IP% (remove % of course) do the following to modify /etc/sysctl.conf:
1
2
3
4
5
6
7
8
9
echo"net.ipv4.ip_forward = 1" | tee -a /etc/sysctl.conf
echo"net.ipv4.conf.all.accept_redirects = 0" | tee -a /etc/sysctl.conf
echo"net.ipv4.conf.all.send_redirects = 0" | tee -a /etc/sysctl.conf
echo"net.ipv4.conf.default.rp_filter = 0" | tee -a /etc/sysctl.conf
echo"net.ipv4.conf.default.accept_source_route = 0" | tee -a /etc/sysctl.conf
echo"net.ipv4.conf.default.send_redirects = 0" | tee -a /etc/sysctl.conf
echo"net.ipv4.icmp_ignore_bogus_error_responses = 1" | tee -a /etc/sysctl.conf
for vpn in /proc/sys/net/ipv4/conf/*; doecho0 > $vpn/accept_redirects; echo0 > $vpn/send_redirects; done
Apply the above change with
1
sysctl -p
Step 3: Change /etc/rc.local
1
vim /etc/rc.local
Before the line exit 0, add the following line (remember to replace %YOUR-SERVER-IP%), to make sure the modifications still work after reboot:
1
2
for vpn in /proc/sys/net/ipv4/conf/*; do echo 0 > $vpn/accept_redirects; echo 0 > $vpn/send_redirects; done