centos7搭建xl2tpd

it2022-05-09  21

准备工作,检查环境

1、先看看你的主机是否支持pptp,返回结果为yes就表示通过。

modprobe ppp-compress-18 && echo yes

2、检查是否开启了TUN,有的虚拟机主机需要开启,返回结果为cat: /dev/net/tun: File descriptor in bad state。就表示通过。

cat /dev/net/tun

 

 

正式开始安装配置

1、安装yum源,centos官方源已经去除xl2tpd,如果使用的官方镜像安装的服务器,则需要自己安装yum源。但是使用的阿里云或者腾讯云公共镜像安装的服务器可以不用。

yum install -y epel-release

2、安装xl2tpd

yum install -y xl2tpd libreswan lsof

3、配置xl2tpd

vim /etc/xl2tpd/xl2tpd.conf

[global]

[lns default]

ip range = 192.168.1.128-192.168.1.254

local ip = 192.168.1.99

require chap = yes

refuse pap = yes

require authentication = yes

name = LinuxVPNserver

ppp debug = yes

pppoptfile = /etc/ppp/options.xl2tpd

length bit = yes

4、配置ppp文件,注意其中被注释的选项,没有被注释的话,启动会报错,或者会导致连不上

vim /etc/ppp/options.xl2tpd

ipcp-accept-local

ipcp-accept-remote

ms-dns  8.8.8.8

name xl2tpd

#noccp

auth

#crtscts

idle 1800

mtu 1410

mru 1410

nodefaultroute

debug

#lock

proxyarp

connect-delay 5000

refuse-pap

refuse-mschap

require-mschap-v2

persist

logfile /var/log/xl2tpd.log

5、配置ipsec文件

1) vim /etc/ipsec.conf

config setup

    protostack=netkey

    nat_traversal=yes

    interfaces="

转载请注明原文地址: https://win8.8miu.com/read-1479767.html

最新回复(0)