在CentOS上快速部署l2tp服务node
a. 先修改PSK,将PSK后面的字符替换掉git
vim /etc/ipsec.secretsvim
b. 修改用户名和密码 ,将用户名和密码修改成自已想要的字符centos
vim /etc/ppp/chap-secretsbash
c. 重启IPsec和xl2tpd服务服务器
systemctl restart ipsec xl2tpdtcp
d. 将客户端的PSK、用户名、密码换成新的再连,应该就能上了。ide
注意若是开启了防火墙,须要在防火墙里面放行l2tp端口。工具
iptables -I INPUT -p tcp --dport 500 -j ACCEPT
iptables -I INPUT -p tcp --dport 4500 -j ACCEPT
iptables -I INPUT -p tcp --dport 1701 -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restartthis
如若脚本地址有变化,能够编辑以下脚本运行便可
部署脚本
#!/bin/bash
#<UDF name="×××_IPSEC_PSK" Label="IPsec Pre-Shared Key" />
#<UDF name="×××_USER" Label="××× Username" />
#<UDF name="×××_PASSWORD" Label="××× Password" />
if [ -f /etc/apt/sources.list ]; then
url=setup
apt-get -y update
apt-get -y install wget
elif [ -f /etc/yum.conf ]; then
url=setup-centos
yum -y install wget
else
echo "Your distribution is not supported by this StackScript"
exit 1
fi
wget "https://git.io/$url" -O /tmp/.sh && sh /tmp/.sh && rm -f /tmp/***.sh
#Fix xl2tpd on CentOS 7 for Linode VMs, because kernel module#l2tp_ppp is not available in the default Linode kernelif grep -qs "release 7" /etc/redhat-release; thenif [ -f /usr/lib/systemd/system/xl2tpd.service ]; thensed -i '/ExecStartPre/s/^/#/' /usr/lib/systemd/system/xl2tpd.servicesystemctl daemon-reloadsystemctl restart xl2tpdfifi