smx_jinxin 发表于 7 天前

请大神们帮忙修改一下脚本。谢谢!

以下ROSv7版本 这个脚本多线路,只有路由表 打开或者关闭 出现不可用。没有反应。其他功能都正常。

请大神们帮忙修改一下。谢谢!

:local pccstatus
:local status
:local pccold
:local pccnew
:local link
:local ncm
:local nrm
:local y
:local z
:local x
:set x 4
#这里是adsl的数量
:set link 0
:for i from=1 to="$x" do={
    :set status running]
    :if ("$status" = true) do={
    :set link ($link + 1)
}
}
:if ("$link" > 0) do={
    :set z "$link"
    :set y 0
    :for i from=1 to="$x" do={
         :set status running]
         :set ncm ("PCC_" . "$i")
#这里是连接标记
         :set nrm ("PCC_ROUT-" . "$i")
#这里是路由标记
         :if ("$status" = true) do={
                  :set pccnew ("both-addresses-and-ports" . ":" . "$z" . "/" . "$y")
                  :set pccold per-connection-classifier]
                  :set pccstatus disable]
                  :if (("$pccnew" != $pccold) || ("$pccstatus" = true)) do={
                        /ip firewall mangle set [ /ip firewall mangle find chain=prerouting new-connection-mark="$ncm"] per-connection-classifier=$pccnew disabled=no
                        /ip firewall mangle set [ /ip firewall mangle find chain=prerouting new-routing-mark="$nrm"] disabled=no
                        /ip firewall mangle set [ /ip firewall mangle find chain=input new-connection-mark="$ncm"] per-connection-classifier=$pccnew disabled=no
                        /ip firewall mangle set [ /ip firewall mangle find chain=output new-routing-mark="$nrm"] disabled=no
                        /ip firewall nat set disabled=no
                        /ip route set disabled=no
                        /ip route set disabled=no
                      }
             :set y ($y + 1)
          } else {
                  :set pccstatus disable]
                  :if ("$pccstatus" = false) do={
                         /ip firewall mangle disable [ /ip firewall mangle find chain=prerouting new-connection-mark="$ncm"]
                         /ip firewall mangle disable
                         /ip firewall mangle disable [ /ip firewall mangle find chain=input new-connection-mark="$ncm"]
                         /ip firewall mangle disable
                         /ip firewall nat disable
                         /ip route disable
                         /ip route disable
             }
      }
    }
}
}

47771885 发表于 5 天前


{
:local pccstatus
:local status
:local pccold
:local pccnew
:local link
:local ncm
:local nrm
:local y
:local z
:local x
:local pppoename "PPPOE-ADSL-"
:set x 4
#这里是adsl的数量
:set link 0
:for i from=1 to="$x" do={
    :set status running]
    :if ("$status" = true) do={
    :set link ($link + 1)
}
}
:if ("$link" > 0) do={
    :set z "$link"
    :set y 0
    :for i from=1 to="$x" do={
         :set status running]
         :set ncm ("PCC_" . "$i")
         :set nrm ("PCC_ROUT-" . "$i")
         #:if ([:len ] = 0) do={
         #/routing table add name=$nrm disabled=no
         #}
         :if ("$status" = true) do={
                  :set pccnew ("both-addresses-and-ports" . ":" . "$z" . "/" . "$y")
                  :set pccold "per-connection-classifier"]
                  :set pccstatus disable]
                  :if (("$pccnew" != $pccold) || ("$pccstatus" = true)) do={
                        /ip firewall mangle set [ /ip firewall mangle find chain=prerouting new-connection-mark="$ncm"] per-connection-classifier=$pccnew disabled=no
                        /ip firewall mangle set [ /ip firewall mangle find chain=prerouting new-routing-mark="$nrm"] disabled=no
                        /ip firewall mangle set [ /ip firewall mangle find chain=input new-connection-mark="$ncm"] per-connection-classifier=$pccnew disabled=no
                        /ip firewall mangle set [ /ip firewall mangle find chain=output new-routing-mark="$nrm"] disabled=no
                        /ip firewall nat set disabled=no
                        /ip route set disabled=no
                        /ip route set disabled=no
                      }
             :set y ($y + 1)
          } else {
                  :set pccstatus disable]
                  :if ("$pccstatus" = false) do={
                         /ip firewall mangle disable [ /ip firewall mangle find chain=prerouting new-connection-mark="$ncm"]
                         /ip firewall mangle disable
                         /ip firewall mangle disable [ /ip firewall mangle find chain=input new-connection-mark="$ncm"]
                         /ip firewall mangle disable
                         /ip firewall nat disable
                         /ip route disable
                         /ip route disable
             }
      }
    }
}
}
页: [1]
查看完整版本: 请大神们帮忙修改一下脚本。谢谢!