翻阅了N个一键包教程了,终于找到可以互相兼容的PPTP + L2TP/IPSec 一键包了。
本教程在 Vultr 测试成功。
一、安装 PPTP 一键包
首先,安装 PPTP 一键包
wget http://www.hi-vps.com/shell/vpn_centos6.sh
chmod a+x vpn_centos6.sh
bash vpn_centos6.sh
会有三个选择:
1. 安装VPN服务 2. 修复VPN 3. 添加VPN用户
输入1,全自动安装
二、安装 L2TP/IPSec 一键包
然后,安装 L2TP/IPSec 一键包
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/across/master/l2tp.sh
chmod +x l2tp.sh
./l2tp.sh
全默认回车就行,全自动安装
安装完以后应该有错误如下
Checking your system to see if IPsec got installed and started correctly:
Version check and ipsec on-path [OK]
Linux Openswan U2.6.38/K2.6.32-504.23.4.el6.x86_64 (netkey)
Checking for IPsec support in kernel [OK]
SAref kernel support [N/A]
NETKEY: Testing XFRM related proc values [OK]
[OK]
[OK]
Hardware RNG detected, testing if used properly [FAILED]
Hardware RNG is present but ‘rngd’ or ‘clrngd’ is not running.
No harware random used!
Checking that pluto is running [OK]
Pluto listening for IKE on udp 500 [OK]
Pluto listening for NAT-T on udp 4500 [OK]
Checking for ‘ip’ command [OK]
Checking /bin/sh is not /bin/dash [OK]
Checking for ‘iptables’ command [OK]
Opportunistic Encryption Support [DISABLED]
很明显的错误
Hardware RNG detected, testing if used properly [FAILED]
然后谷歌一下解决办法:
1.安装rng-tools
yum install rng-tools
2.修改 /etc/sysconfig/rngd
EXTRAOPTIONS=”-r /dev/urandom”
3.chkconfig rngd on
4.service rngd restart
紧接着再次验证ipsec(L2TP)并重启相关服务,否则提示服务器无相应
ipsec setup restart
xl2tpd -D
ipsec verify
另外,纯净下安装以上功能以后的iptables的配置应该是类似这样的
# Generated by iptables-save v1.4.7 on Sat Nov 21 01:25:13 2015
*filter
:INPUT ACCEPT [1:40]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1:140]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A FORWARD -s 172.16.36.0/24 -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j TCPMSS --set-mss 1356
COMMIT
# Completed on Sat Nov 21 01:25:13 2015
# Generated by iptables-save v1.4.7 on Sat Nov 21 01:25:13 2015
*nat
:PREROUTING ACCEPT [1178:51788]
:POSTROUTING ACCEPT [91:8584]
:OUTPUT ACCEPT [91:8584]
-A POSTROUTING -s 172.16.36.0/24 -j SNAT --to-source 你.的.I.P
-A POSTROUTING -j MASQUERADE
COMMIT
# Completed on Sat Nov 21 01:25:13 2015
三、设置 PPTP + L2TP/IPSec 通用帐号
然后就是修改:/etc/ppp/chap-secrets里面的账号密码
结构为:
username * password *
这样,不管是L2TP还是PPTP都可以通用上面的帐号密码
但是注意的是L2TP要多填一个密钥就是了(默认密钥是vpn)
搞完手工,有问题请留言
实在搞不定,可以联系我有偿安装,详细看这里介绍~
发表回复