centos 快速部署L2TP服务
时间: 2023-07-18 14:14:58 浏览: 183
可以按照以下步骤在 CentOS 上快速部署 L2TP 服务:
1. 安装 L2TP 和 PPTP 服务
```
yum install xl2tpd ppp pptpd
```
2. 配置 xl2tpd
编辑 `/etc/xl2tpd/xl2tpd.conf` 文件,将以下内容添加到文件末尾:
```
[global]
ipsec saref = no
[lns default]
ip range = 192.168.42.10-192.168.42.20
local ip = 192.168.42.1
require chap = yes
refuse pap = yes
require authentication = yes
name = l2tpd
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes
```
3. 配置 ppp
创建 `/etc/ppp/options.xl2tpd` 文件,并将以下内容添加到文件中:
```
require-mschap-v2
ms-dns 8.8.8.8
ms-dns 8.8.4.4
proxyarp
mtu 1400
mru 1400
auth
name l2tpd
password l2tpdpassword
```
注意将 `l2tpdpassword` 改为你自己的密码。
4. 配置 pptpd
编辑 `/etc/pptpd.conf` 文件,将以下内容添加到文件末尾:
```
localip 192.168.42.1
remoteip 192.168.42.100-200
```
5. 配置 chap-secrets
编辑 `/etc/ppp/chap-secrets` 文件,将以下内容添加到文件末尾:
```
username l2tpd password *
```
注意将 `l2tpd` 和 `password` 改为你自己的用户名和密码。
6. 启动服务
```
systemctl start pptpd
systemctl start xl2tpd
```
7. 配置防火墙规则
```
iptables -A INPUT -p udp --dport 1701 -j ACCEPT
iptables -A INPUT -p udp --dport 500 -j ACCEPT
iptables -A INPUT -p udp --dport 4500 -j ACCEPT
iptables -A INPUT -p gre -j ACCEPT
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
```
完成以上步骤后,即可在 CentOS 上快速部署 L2TP 服务。
阅读全文
相关推荐









