xiaoxiannv
V2EX  ›  路由器

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

  •  
  •   xiaoxiannv · 2 days ago · 396 views
    /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];};"
    1 replies    2026-06-12 10:24:11 +08:00
    Debug1998
        1
    Debug1998  
       2 days ago
    硬件是哪款呀?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2858 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 08:14 · PVG 16:14 · LAX 01:14 · JFK 04:14
    ♥ Do have faith in what you're doing.