mikrotik ros7.x 版本路由多拨配置,自己记录一下

2 天前
 xiaoxiannv
/ip firewall mangle remove [find]
/ip firewall nat remove [find]
/ip route remove [find dst-address=0.0.0.0/0]
/interface pppoe-client remove [find name=pppoe1]
/interface pppoe-client remove [find name=pppoe2]
/routing table remove [find name=to-pppoe1]
/routing table remove [find name=to-pppoe2]
/system scheduler remove [find name=check-pppoe-failover]

/interface bridge port remove [find interface=WAN]
/interface bridge port remove [find interface=LAN1]
/interface bridge port remove [find interface=LAN2]
/interface bridge port add bridge=bridge-lan interface=LAN1
/interface bridge port add bridge=bridge-lan interface=LAN2

/ip dns set allow-remote-requests=yes servers=******,******

/interface pppoe-client
add name=pppoe1 interface=WAN ac-name="****" user="****" password="****" add-default-route=no use-peer-dns=no disabled=no
add name=pppoe2 interface=WAN ac-name="****" user="****" password="****" add-default-route=no use-peer-dns=no disabled=no

/ip firewall nat
add chain=srcnat out-interface=pppoe1 action=masquerade
add chain=srcnat out-interface=pppoe2 action=masquerade

/routing table
add fib name=to-pppoe1
add fib name=to-pppoe2

/ip firewall mangle
add comment=PCC1 chain=prerouting in-interface=bridge-lan connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=conn-pppoe1 passthrough=yes
add comment=PCC2 chain=prerouting in-interface=bridge-lan connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=conn-pppoe2 passthrough=yes
add comment=ROUTE1 chain=prerouting in-interface=bridge-lan connection-mark=conn-pppoe1 action=mark-routing new-routing-mark=to-pppoe1 passthrough=no
add comment=ROUTE2 chain=prerouting in-interface=bridge-lan connection-mark=conn-pppoe2 action=mark-routing new-routing-mark=to-pppoe2 passthrough=no

/ip route
add dst-address=0.0.0.0/0 gateway=pppoe1 routing-table=to-pppoe1 distance=1
add dst-address=0.0.0.0/0 gateway=pppoe2 routing-table=to-pppoe2 distance=1
add dst-address=0.0.0.0/0 gateway=pppoe1 distance=1
add dst-address=0.0.0.0/0 gateway=pppoe2 distance=2

/system scheduler
add name=check-pppoe-failover interval=10s on-event=":local p1 [/interface get pppoe1 running]; :local p2 [/interface get pppoe2 running]; :if (\$p1 && \$p2) do={/ip firewall mangle enable [find comment=PCC1]; /ip firewall mangle enable [find comment=PCC2]; /ip firewall mangle enable [find comment=ROUTE1]; /ip firewall mangle enable [find comment=ROUTE2];}; :if (\$p1 && !\$p2) do={/ip firewall mangle enable [find comment=PCC1]; /ip firewall mangle disable [find comment=PCC2]; /ip firewall mangle enable [find comment=ROUTE1]; /ip firewall mangle disable [find comment=ROUTE2];}; :if (!\$p1 && \$p2) do={/ip firewall mangle disable [find comment=PCC1]; /ip firewall mangle enable [find comment=PCC2]; /ip firewall mangle disable [find comment=ROUTE1]; /ip firewall mangle enable [find comment=ROUTE2];};"
386 次点击
所在节点    路由器
1 条回复
Debug1998
2 天前
硬件是哪款呀?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1219713

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX