## 1.下載xl2tpd.tar.gz源碼包 ```wget http://pkgs.fedoraproject.org/repo/pkgs/xl2tpd/xl2tpd-1.3.8.tar.gz/d244fdcd88f64601b64b7302870afca8/xl2tpd-1.3.8.tar.g ...
## 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)
##