1.下载xl2tpd.tar.gz源码包
```
wget http://pkgs.fedoraproject.org/repo/pkgs/xl2tpd/xl2tpd-1.3.8.tar.gz/d244fdcd88f64601b64b7302870afca8/xl2tpd-1.3.8.tar.gz
```
## 2.安装xl2tpd和libreswan
```
tar -zxvf xl2tpd-1.3.8.tar.gz
cd xl2tpd-1.3.8
make && make install
如果make过程中出现"contrib/pfc.c:14:23: 致命错误:pcap-bpf.h:没有那个文件或目录"则安装libpcap
yum -y install libpcap-devel
```
## 3.配置xl2tpd.conf配置文件
`vim /etc/xl2tpd/xl2tpd.conf`
修改内容如下:
```
[global]
[lns default]
ip range = 172.100.1.100-172.100.1.150
local ip = 172.100.1.1
require chap = yes
refuse pap = yes
require authentication = yes
name = LinuxVPNserver
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes
```
## 4.配置pppd选项参数
`vim /etc/ppp/options.xl2tpd`
修改内容如下:
```
ipcp-accept-local
ipcp-accept-remote
ms-dns 8.8.8.8
ms-dns 209.244.0.3
ms-dns 208.67.222.222
name xl2tpd
#noccp
auth
crtscts
idle 1800
mtu 1410 #第一次配置不建议设置mtu,mru,否则可能789错误(贴配置时去掉注释信息)
mru 1410
nodefaultroute
debug
lock
proxyarp
connect-delay 5000
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
persist
logfile /var/log/xl2tpd.log
```
## 5.设置l2tp拨号用户名密码
```
vim /etc/ppp/chap-secrets`
修改内容:
vpnuser * pass *
说明:用户名[空格]service[空格]密码[空格]指定IP
```
## 6.启动xl2tpd
```
/sbin/chkconfig xl2tpd on
systemctl enable xl2tpd
systemctl restart xl2tpd
```
## 7.使用win7客户端进行拨号
[Win7拨号报错] (https://shipengliang.com/software-exp/win7-l2tpipsec-%E8%AE%BF%E9%97%AE%E7%BD%91%E7%AB%99%E8%BF%9E%E6%8E%A5%E8%A2%AB%E9%87%8D%E7%BD%AE%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95.html)
(责任编辑:IT) |