在Ubuntu 14.04 上追加L2TP VPN服务器

在前文的IPSec VPN服务的基础上开启L2TP需要:

1、安装L2TP服务:
apt-get install xl2tpd

2、修改 /etc/xl2tpd/xl2tpd.conf 文件,内容为:

[global]
ipsec saref = yes

[lns default]
ip range = 192.168.1.200-192.168.1.235
local ip = 192.168.1.1
refuse chap = yes
refuse pap = yes
require authentication = yes
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes

3、编辑 /etc/ppp/options.xl2tpd 文件,内容为:
require-mschap-v2
ms-dns 8.8.8.8
ms-dns 8.8.4.4
asyncmap 0
auth
crtscts
lock
hide-password
modem
debug
name l2tpd
proxyarp
lcp-echo-interval 30
lcp-echo-failure 4

4、在 /etc/ppp/chap-secrets 中添加密码:
# user server password ip
test l2tpd testpassword *

5、重启L2TP:
/etc/init.d/xl2tpd restart

6、开启iptables转发:
iptables –table nat –append POSTROUTING –jump MASQUERADE

7、可以在 /etc/rc.local 中添加以下内容用来开机启动服务:
iptables –table nat –append POSTROUTING –jump MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
for each in /proc/sys/net/ipv4/conf/*
do
echo 0 > $each/accept_redirects
echo 0 > $each/send_redirects
done
/etc/init.d/ipsec restart

发表评论

电子邮件地址不会被公开。 必填项已用*标注