1.最近因为工作需要,想在内网搭建一个l2tp服务器方便拨入使用,找了各种方式,踩了不少坑,才测试成功,我系统版本如下:
[root@isa3 ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
2.由于我的服务器能连网,可以直接在线安装需要使用的三个软件包,会自动解决相关的依赖性问题;
yum -y install epel-release libreswan xl2tpd
3.网上有大神已经写好了Cent OS7版本直接安装l2tp的脚本,可以直接调用,由于脚本较早,里面有些配置需要修改,大部分配置可以参考使用
4.软件安装完成后需要设置的地方主要有几个方面,如果您是用上述的脚本执行的,下面的操作都已经自动执行,下面的步骤主要是检查一下相关配置。
修改/etc/ipsec.conf文件,将其中的nat_traversal修改成yes,或将下述的内容直接复制到该文件中替换
[root@l2tp~]# more /etc/ipsec.conf
# /etc/ipsec.conf - Libreswan IPsec configuration file
# This file: /etc/ipsec.conf
#
# Enable when using this configuration file with openswan instead of libreswan
#version 2
#
# Manual: ipsec.conf.5
# basic configuration
config setup
# NAT-TRAVERSAL support, see README.NAT-Traversal
nat