使用 RouterOS 建立基于 L2TP over IPsec 的 VPN 服务
前言自从苹果于今年 6 月 15 日发布了最新的 IOS 10 以及 macOS Sierra 10.12 操作系统,于第一时间尝鲜,经过一段时间试用,新系统表现良好,但是其中一个小细节让人无法忍受。那就是取消了对 PPTP 的支持!不过想想也是,PPTP 在功能,加密等方面均已被时代淘汰,停止支持也在情理之中。尤其在我朝 伟大的墙 的围追堵截下,PPTP 这等协议已经形同虚设。好在苹果在新系统中保留了 L2TP 协议支持,好吧,请出我牛逼的 RouterOS !整 …关于 L2TPL2TP ,全称 Layer 2 Tunneling Protocol ,从字面上看,这玩意工作在 2 层。通过封装和扩展 PPP 协议实现 VPN 隧道的功能。但是 L2TP 不会对隧道内的数据进行加密,所以 L2TP 一般和 IPsec 共同使用,先由 L2TP 封装 2 层数据,再由 IPsec 封装 IP 数据包共同提供服务。开整这里是图,请脑补,另外这里的环境如果没说都是 RouterOS v6.12启动 L2TP 服务因为会和 IPsec 共同使用,所以此处默认配置文件不需要选择加密
1
2
/interface l2tp-server server \
set enabled=yes default-profile=default
配置 IPsecsecret 参数是您的预共享秘钥,enc-algorithm 参数请选择您设备支持的加密方式,不知道就别改,可选参数为 3des,aes-128,aes-192,aes-256
1
2
3
4
5
6
7
8
9
/ip ipsec peer \
add address=0.0.0.0/0 auth-method=pre-shared-key dh-group=modp1024 \
disabled=no dpd-interval=2 dpd-maximum-failures=5 enc-algorithm=3des \
exchange-mode=main-l2tp generate-policy=port-override hash-algorithm=sha1 \
lifetime=1d nat-traversal=yes port=500 secret=123 send-initial-contact=yes
/ip ipsec proposal \
set default enc-algorithms=3des auth-algorithms=sha1 disabled=no \
lifetime=30m pfs-group=modp1024
创建地址池和账号
1
2
3
4
5
6
7
8
/ip pool add \
name=vpn-pool range=192.168.99.2-192.168.99.100
/ppp profile \
set default local-address=192.168.99.1 remote-address=vpn-pool
/ppp secret \
add name=xiaobao password=12354
防火墙规则
1
2
3
/ip firewall filter \
add chain=input protocol=udp port=1701,500,4500
add chain=input protocol=ipsec-esp
连接在您的 IOS/Mac/Win 设备上创建 L2TP over IPsec VPN 并填入账号密码和预共享秘钥即可。https://www.ichegg.org/2016/08/12/%E4%BD%BF%E7%94%A8-RouterOS-%E5%BB%BA%E7%AB%8B%E5%9F%BA%E4%BA%8E-L2TP-over-IPsec-%E7%9A%84-VPN-%E6%9C%8D%E5%8A%A1/1.png
https://www.ichegg.org/2016/08/12/%E4%BD%BF%E7%94%A8-RouterOS-%E5%BB%BA%E7%AB%8B%E5%9F%BA%E4%BA%8E-L2TP-over-IPsec-%E7%9A%84-VPN-%E6%9C%8D%E5%8A%A1/2.png
https://www.ichegg.org/2016/08/12/%E4%BD%BF%E7%94%A8-RouterOS-%E5%BB%BA%E7%AB%8B%E5%9F%BA%E4%BA%8E-L2TP-over-IPsec-%E7%9A%84-VPN-%E6%9C%8D%E5%8A%A1/3.png
https://www.ichegg.org/2016/08/12/%E4%BD%BF%E7%94%A8-RouterOS-%E5%BB%BA%E7%AB%8B%E5%9F%BA%E4%BA%8E-L2TP-over-IPsec-%E7%9A%84-VPN-%E6%9C%8D%E5%8A%A1/
原帖子位置 多线L2TP不走默认由,不知道还要加什么设置?想让L2TP走在一条固定IP上。 我爱肉饼 发表于 2018-1-7 00:02
多线L2TP不走默认由,不知道还要加什么设置?想让L2TP走在一条固定IP上。
在路由表對l2tp-client指定pppoe-out:)
我爱肉饼 发表于 2018-1-7 00:02
多线L2TP不走默认由,不知道还要加什么设置?想让L2TP走在一条固定IP上。
很多种办法
cspm333 发表于 2018-1-7 23:16
在路由表對l2tp-client指定pppoe-out
我没表达清楚,是说远程这端拨入想通过固定IP过去,不想用服务端动态IP还要解析,服务端有条固定IP
sihanlin 发表于 2018-1-8 22:11
很多种办法
我没表达清楚,是说远程这端拨入想通过固定IP过去,不想用服务端动态IP还要解析,服务端有条固定IP
我爱肉饼 发表于 2018-1-9 21:09
我没表达清楚,是说远程这端拨入想通过固定IP过去,不想用服务端动态IP还要解析,服务端有条固定IP
vpn-server的地址想走固定IP出去
sihanlin 发表于 2018-1-6 02:43
https://www.ichegg.org/2016/08/12/%E4%BD%BF%E7%94%A8-RouterOS-%E5%BB%BA%E7%AB%8B%E5%9F%BA%E4%BA%8E-L ...
vpn-server的地址想走固定IP出去
页:
[1]