`
haoningabc
  • 浏览: 1466154 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

xl2tp 备份

阅读更多
2019年9月24日更新:


注意,需要开启firewalld防火墙和NetworkManager
systemctl enable firewalld
systemctl enable NetworkManager

systemctl start firewalld
systemctl start NetworkManager
否则会有“ state change: unmanaged -> unavailable (reason 'connection-assumed')”
等错误

aws的ip为13.231.152.* 
如果内网是 172.31.39.*

#!/bin/sh
iptables -t nat -A POSTROUTING -s 172.31.39.0/24  -o eth0  -j MASQUERADE
systemctl restart ipsec
systemctl restart xl2tpd

#cat /proc/sys/net/ipv4/ip_forward
#firewall-cmd --permanent --add-service=ipsec
#firewall-cmd --permanent --add-port=1701/udp
#firewall-cmd --permanent --add-port=4500/udp
#firewall-cmd --permanent --add-masquerade
#firewall-cmd --reload

#firewall-cmd --permanent --add-port=5060/tcp



ios按照如下

如果是mac:
就不用xl2tp了
直接ssh
ssh -o TCPKeepAlive=yes -qTfnN -D 0.0.0.0:7070 root@13.231.152.*
chrome 用 SwitchyOmega 用本地 7070端口即可


然后按照
http://blog.csdn.net/kitvv/article/details/50696585 这个不存在了,如下
操作


密码为:
/etc/ppp/chap-secrets
配置的
root * pass *
不是真实root密码!!!
秘钥为:
/etc/ipsec.d/default.secrets
配置的
: PSK "密码要有复杂度"

检查udp端口不能用telnet,
需要用
nc -vuz   13.231.152.* 1701


l2tp原理 http://www.h3c.com/cn/d_200805/605932_30003_0.htm




############################################################
CentOS7架设L2TP实现VPN

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

modprobe ppp-compress-18 && echo yes

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

cat /dev/net/tun
虚拟机和aws 上可能没有,可以忽略

3.更新一下再安装

yum install update
yum update -y

4.安装EPEL源(CentOS7官方源中已经去掉了xl2tpd)

yum install -y epel-release

5.安装xl2tpd和libreswan(openswan已经停止维护)

yum install -y xl2tpd libreswan lsof

6.编辑xl2tpd配置文件

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


7.编辑pppoptfile文件

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-chap
refuse-mschap
require-mschap-v2
persist
#logfile /var/log/xl2tpd.log

8.编辑ipsec配置文件(默认就好)

vim /etc/ipsec.conf
config setup
        protostack=netkey
        dumpdir=/var/run/pluto/
        virtual_private=%v4:10.0.0.0/8,%v4:172.100.0.0/12,%v4:25.0.0.0/8,%v4:100.64.0.0/10,%v6:fd00::/8,%v6:fe80::/10
        include /etc/ipsec.d/*.conf

9.编辑include的conn文件

vim /etc/ipsec.d/l2tp-ipsec.conf

修改内容如下:
conn L2TP-PSK-NAT
    rightsubnet=0.0.0.0/0
    dpddelay=10
    dpdtimeout=20
    dpdaction=clear
    forceencaps=yes
    also=L2TP-PSK-noNAT
conn L2TP-PSK-noNAT
    authby=secret
    pfs=no
    auto=add
    keyingtries=3
    rekey=no
    ikelifetime=8h
    keylife=1h
    type=transport
    left=172.31.39.212
    leftprotoport=17/1701
    right=%any
    rightprotoport=17/%any

注意
    left=172.31.39.212   #service/VPS的外网地址,某些vps只有eth0一块网卡的,
                        #就填内网地址,内核开启nat转发就可以了,
                        #CentOS7以下的用iptables定义转发规则
    leftprotoport=17/1701
    right=%any
    rightprotoport=17/%any
10.设置用户名密码

vim /etc/ppp/chap-secrets

修改内容:
root * pass *

不是用户密码哟。。
说明:用户名[空格]service[空格]密码[空格]指定IP

11.设置PSK秘钥

vim /etc/ipsec.d/default.secrets

: PSK "testvpn"

12.CentOS7防火墙设置(7以下的用iptables)
firewall-cmd --permanent --add-service=ipsec
firewall-cmd --permanent --add-port=1701/udp
firewall-cmd --permanent --add-port=4500/udp
firewall-cmd --permanent --add-masquerade
firewall-cmd --reload

13. IP_FORWARD 设置

vim /etc/sysctl.d/60-sysctl_ipsec.conf
vim /etc/sysctl.conf

net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.eth0.rp_filter = 0
net.ipv4.conf.eth0.send_redirects = 0
net.ipv4.conf.eth1.accept_redirects = 0
net.ipv4.conf.eth1.rp_filter = 0
net.ipv4.conf.eth1.send_redirects = 0
net.ipv4.conf.eth2.accept_redirects = 0
net.ipv4.conf.eth2.rp_filter = 0
net.ipv4.conf.eth2.send_redirects = 0
net.ipv4.conf.ip_vti0.accept_redirects = 0
net.ipv4.conf.ip_vti0.rp_filter = 0
net.ipv4.conf.ip_vti0.send_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.lo.rp_filter = 0
net.ipv4.conf.lo.send_redirects = 0
net.ipv4.conf.ppp0.accept_redirects = 0
net.ipv4.conf.ppp0.rp_filter = 0
net.ipv4.conf.ppp0.send_redirects = 0

保证net.ipv4.ip_forward = 1 转发生效
重启生效

systemctl restart network
13. ipsec启动&检查

systemctl enable ipsec
systemctl restart ipsec

检查:ipsec verify
正常输出:
Verifying installed system and configuration files

Version check and ipsec on-path                     [OK]
Libreswan 3.25 (netkey) on 3.10.0-957.12.1.el7.x86_64
Checking for IPsec support in kernel                [OK]
 NETKEY: Testing XFRM related proc values
         ICMP default/send_redirects                [OK]
         ICMP default/accept_redirects              [OK]
         XFRM larval drop                           [OK]
Pluto ipsec.conf syntax                             [OK]
Two or more interfaces found, checking IP forwarding    [OK]
Checking rp_filter                                  [OK]
Checking that pluto is running                      [OK]
 Pluto listening for IKE on udp 500                 [OK]
 Pluto listening for IKE/NAT-T on udp 4500          [OK]
 Pluto ipsec.secret syntax                          [OBSOLETE]
  003 WARNING: using a weak secret (PSK)
Checking 'ip' command                               [OK]
Checking 'iptables' command                         [OK]
Checking 'prelink' command does not interfere with FIPS [OK]
Checking for obsolete ipsec.conf options            [OK]

14.xl2tpd启动

systemctl enable xl2tpd
systemctl restart xl2tpd

ios 配置后连接
查看日志
tailf /var/log/messages


  • 大小: 97.8 KB
分享到:
评论

相关推荐

    xl2tpd-1.2.4开源源代码,可用于linux系统

    xl2tpd-1.2.4是l2tp的lns端的开源源代码,可用于linux系统

    ipsec+l2tp安装配置及插件

    linux下ipsec+l2tp安装配置及插件

    CentOS7.2 安装L2TP/IPSec 服务端/客户端 ( libreswan+xl2tpd )

    配套说明: http://blog.csdn.net/gogoytgo/article/details/79420745

    xl2tpd-1.3.0开源源代码

    xl2tpd-1.3.0可用于l2tp的lns或者服务器端,这是个开源的代码库

    centos7搭建基于strongswan ipsec的 l2tp服务器

    centos7下搭建ipsec l2tp服务器,使用strongswan来构建ipsec.

    xl2tpd:L2TPd 的官方 Xelerance 分叉

    xl2tpd xl2tpd 是定义的第 2 层隧道协议的免费实现。 L2TP 允许您在 UDP 上建立 PPP 隧道。 一些 ISP 使用 L2TP 将用户会话从拨入服务器(调制解调器银行、ADSL DSLAM)传输到后端 PPP 服务器。 另一个重要的应用是...

    xl2tpd的makefile文件

    xl2tpd的makefile文件

    美国NITON+XL2+800介绍.pdf

    NITON XL2 800是一款专为金属合金成分分析设计的手持式X射线荧光光谱仪。这款设备结合了快速、准确和可靠的特点,为用户提供量身定制的解决方案,尤其适用于非技术人员操作。它配备了中文彩色显示屏,方便用户理解和...

    NetworkManager-l2tp:对NetworkManager的L2TP和L2TPIPsec支持

    对于L2TP支持,它使用xl2tpd( ) 为了获得IPsec支持,它使用以下任一方法: 利伯斯旺( ) strongSwan( ) 对于用户身份验证,它支持: 用户名/密码凭据。 TLS证书。 对于机器身份验证,它支持: 预共享...

    一个L2TP调试案例

    一个L2TP的调试案例,故障排除 故障分析

    tomato-K26-1.28.0542-MIPSR1-4M-8M

    解决BUG: [L2TP] xl2tpd由1 26升级1 30 试图解决俄罗斯用户无法L2TP拨号的问题 解决BUG: [L2TP] 解决WAN连接类型为L2TP时 L2TP拨上后1分钟左右就断线的BUG 功能加强: [USB] 升级3G上网卡驱动usb modeswitch data ...

    美国尼通XL2-980合金分析仪.pdf

    【Niton XL2-980合金分析仪】是由美国尼通公司制造的一款手持式光谱仪,专门用于合金的快速、准确分析。这款设备在IT行业中的应用主要体现在材料科学和质量控制领域,尤其适合那些需要现场进行金属成分检测的场景。 ...

    EXCEL表格转换成CAD图纸

    花了两天时间,仿照 KozMos XL2CAD 的程序同样写了一个Excel2CAD程序,控制对话框就直接照搬 KozMos XL2CAD的对话框,操作方式完全和他一样! 2013年6月22日公布全部源码 2013.06.11更新程序 : 增加按Excel页面...

    ubuntu_script_l2tp_ipsec.sh

    Ubuntu下使用strongswan和xl2ptd搭建l2pt/ipsec服务,使用预共享密钥和账号密码登录的脚本。

    基于L2TP和IPSec集成的车载无线终端传输网络设计

    在应对突发事件救援行动中,指挥中心能否通过互联网取得第一手资料,必要的条件...为克服以上不足,详细阐述了由L2TP和IPSec集成的一种新颖的隧道网络过程,并介绍了L2TP和IPSec的集成方案,最后完成了对本方案的测试。

    pppd-backend:执行后端程序以检查 pppd 的用户名密码对

    在 /etc/ppp/pptp-options 和 /etc/ppp/options.xl2tp 中,添加: debug plugin backend.so backend_command "/etc/ppp/auth.sh" 将命令替换为您要执行的内容。 可执行文件的第一个参数是用户名。 如果用户有效,...

    Persian xl2tpd-开源

    适用于Linux和其他基于POSIX的操作系统的第2层隧道协议VPN客户端/守护程序。 “注意:Packets Analyzer无法检测到l2tp数据包。”

    ubuntu环境下多种服务器搭建教程

    安装相关软件,配置 `/etc/xl2tpd/xl2tpd.conf` 和 `/etc/ppp/peers/l2tp-server` ,设置认证方式、IP地址池等,启动服务后,用户就能通过L2TP连接到服务器。 4. PPPOE服务器搭建:PPPOE(拨号以太网)用于模拟传统...

    0xl2oot.github.io:我的博客-为了我的爱

    0xl2oot.github.io 是一个个人博客项目,博主选择将自己的博客托管在 GitHub Pages 上,这是一个免费且便捷的静态网站托管服务。"0xl2oot.github.io" 的命名遵循了 GitHub Pages 的命名规则,即用户名.github.io,...

Global site tag (gtag.js) - Google Analytics