Alibaba Cloud Linux 上安装 L2TP

Alibaba Cloud Linux 上安装 L2TP

安装L2TP

sudo yum install -y xl2tpd ppp

配置 xl2tpd.conf

sudo vi /etc/xl2tpd/xl2tpd.conf

添加以下内容:

[global]
listen-addr = 0.0.0.0

[lns default]
ip range = 192.168.42.100-192.168.42.200
local ip = 192.168.42.1
require chap = yes
refuse pap = yes
require authentication = yes
name = LinuxVPNserver
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes

配置options.xl2tpd

sudo vi /etc/ppp/options.xl2tpd

添加以下内容:

require-mschap-v2
ipcp-accept-local
ipcp-accept-remote
ms-dns 8.8.8.8
ms-dns 8.8.4.4
noccp
auth
#crtscts # 客户端连接不上可注销 或 modem 替代    
idle 1800
mtu 1410
mru 1410
nodefaultroute
debug
lock
proxyarp
connect-delay 5000

如果以上还不能连接 请配置下面

require-mschap-v2    # 强制MSCHAPv2认证
refuse-eap
noccp
noauth
mtu 1410
mru 1410

添加用户认证

sudo vi /etc/ppp/chap-secrets

添加用户格式如下:

# Secrets for authentication using CHAP
# client        server  secret                  IP addresses
username        *       password                *

添加IP转发

sudo vi /etc/sysctl.conf

添加以下内容

net.ipv4.ip_forward = 1

生效

sudo sysctl -p

启动服务并设置开机自启

sudo systemctl start xl2tpd  #启动
sudo systemctl enable xl2tpd #设置开机启动
sudo systemctl restart xl2tpd # 重启

查看日志

journalctl -u xl2tpd -f
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

安颜丶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值