本文共 1575 字,大约阅读时间需要 5 分钟。
在CentOS上快速部署l2tp服务
a. 先修改PSK,将PSK后面的字符替换掉
vim /etc/ipsec.secrets
b. 修改用户名和密码 ,将用户名和密码修改为自已想要的字符
vim /etc/ppp/chap-secrets
c. 重启IPsec和xl2tpd服务
systemctl restart ipsec xl2tpd
d. 将客户端的PSK、用户名、密码换成新的再连,应该就能上了。
注意如果开启了防火墙,需要在防火墙里面放行l2tp端口。
iptables -I INPUT -p tcp --dport 500 -j ACCEPT
iptables -I INPUT -p tcp --dport 4500 -j ACCEPTiptables -I INPUT -p tcp --dport 1701 -j ACCEPT/etc/init.d/iptables save/etc/init.d/iptables restart如若脚本地址有变化,可以编辑如下脚本运行即可
部署脚本#!/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=setupapt-get -y updateapt-get -y install wgetelif [ -f /etc/yum.conf ]; thenurl=setup-centosyum -y install wgetelseecho "Your distribution is not supported by this StackScript"exit 1fiwget "" -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转载于:https://blog.51cto.com/907832555/2320503