当前位置:首页 > 网络 > RouterOS7 L2TP+Openwrt国内外分流

RouterOS7 L2TP+Openwrt国内外分流

网络9个月前 (07-05)

RouterOS7 L2TP+Openwrt国内外分流

为了实现手机和电脑不需要安装第三方软件的情况下,L2TP VPN连接至有公网ip的家用RouterOS路由器,方便回家,方便环游世界

下面示例中10.0.0.30为openwrt地址


新建L2TP地址池

/ip pool
add name=L2TP-Pool ranges=172.20.1.2-172.20.1.10

RouterOS7 L2TP+Openwrt国内外分流


配置ipsec

/ip ipsec proposal
set [ find default=yes ] auth-algorithms=sha256,sha1

RouterOS7 L2TP+Openwrt国内外分流


新建PPP模板和加密

/ppp profile
add dns-server=10.0.0.30 local-address=172.20.1.1 name=l2tp-profile remote-address=L2TP-Pool use-encryption=yes
/ppp secret
add name=L2TP用户名 password=L2TP密码 profile=l2tp-profile service=l2tp

RouterOS7 L2TP+Openwrt国内外分流


开启L2TP服务

/interface l2tp-server server
set default-profile=l2tp-profile enabled=yes use-ipsec=required

RouterOS7 L2TP+Openwrt国内外分流


新建路由表

/routing table
add disabled=no fib name=l2tp

RouterOS7 L2TP+Openwrt国内外分流


下载和导入国内IP段

/tool fetch url=http://www.iwik.org/ipcountry/mikrotik/CN
/import file-name=CN


创建L2TP远端地址和局域网地址

/ip firewall address-list
add address=172.20.1.2-172.20.1.10 list=l2tp-remote
add address=10.0.0.0/27 list=CN

RouterOS7 L2TP+Openwrt国内外分流


防火墙放行L2TP端口

/ip firewall filter
add action=accept chain=input comment="allow L2TP VPN (ipsec-esp)" in-interface-list=WAN protocol=ipsec-esp
add action=accept chain=input comment="allow L2TP VPN (500,4500,1701/udp)" dst-port=500,1701,4500 in-interface-list=WAN protocol=udp

RouterOS7 L2TP+Openwrt国内外分流


防火墙做标记

/ip firewall mangle
add action=mark-routing chain=prerouting dst-address-list=!CN dst-address-type=!local new-routing-mark=l2tp src-address-list=l2tp-remote

RouterOS7 L2TP+Openwrt国内外分流


防火墙做伪装

/ip firewall nat
add action=masquerade chain=srcnat comment=L2TP_NAT dst-address-list=!l2tp-remote src-address-list=l2tp-remote

RouterOS7 L2TP+Openwrt国内外分流


添加路由表

/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=10.0.0.30 pref-src=0.0.0.0 routing-table=l2tp scope=30 suppress-hw-offload=no target-scope=10

RouterOS7 L2TP+Openwrt国内外分流

本站所有文章均可随意转载,转载时请保留原文链接及作者。

本文链接:https://www.vos.cn/net/518.html

相关文章

ProxmoxVE 6.1配置ROS

ProxmoxVE 6.1配置ROS

真机安装ProxmoxVE 6.1,并导入OVA模板和IMG镜像两种方式刻录到U盘使用rufus刻录到u盘以DD镜像模式写入系统配置关闭企业源mv /etc/apt/sources.list...

RB760iGS+PON STICK折腾过程

RB760iGS+PON STICK折腾过程

使用Mikrotik hEX S RB760iGS配合PON STICK猫棒实现PPPoE IPv6 IPTV,如果使用winbox截图太多了,所以就给出参考命令行拓扑如下创建2个桥接地址,LAN-b...