WWW.YOUINFO.SITE
标签聚合 MikroTik

/tag/MikroTik

v2ex · 2026-06-11 19:01:19+08:00 · tech

/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];};"