翻阅了N个一键包教程了,终于找到可以互相兼容的PPTP + L2TP/IPSec 一键包了。
一、安装 PPTP 一键包
首先,安装 PPTP 一键包
1 2 3 |
wget http://www.hi-vps.com/shell/vpn_centos6.sh chmod a+x vpn_centos6.sh bash vpn_centos6.sh |
会有三个选择:
1 2 3 |
1. 安装VPN服务 2. 修复VPN 3. 添加VPN用户 |
输入1,全自动安装
二、安装 L2TP/IPSec 一键包
然后,安装 L2TP/IPSec 一键包
1 2 3 |
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/across/master/l2tp.sh chmod +x l2tp.sh ./l2tp.sh |
全默认回车就行,全自动安装
安装完以后应该有错误如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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] |
很明显的错误
1 |
Hardware RNG detected, testing if used properly [FAILED] |
然后谷歌一下解决办法:
1 2 3 4 5 6 |
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)
1 |
ipsec verify |
三、设置 PPTP + L2TP/IPSec 通用帐号
然后就是修改:/etc/ppp/chap-secrets里面的账号密码
结构为:
1 |
username * password * |
这样,不管是L2TP还是PPTP都可以通用上面的帐号密码
但是注意的是L2TP要多填一个密钥就是了(默认密钥是vpn)