jacksonzhang 发表于 2011-4-20 01:31:48

我使用的8线切换脚本

下面是我使用的8线切换脚本。很不错。可惜是2.927下能用的。哪个高人能帮我改成3.30的NTH能用就好了。
:local newad
:local line [:len ]
:local pt
:local pf
:local nt1 [:pick nth] 2 3]
:for i from=1 to=8 do={
:if ( run] = yes) do={
:set newad add]
   :set newad [:pick $newad 0 [:find $newad "/"]]
   :set oldad addr]
   :set oldad [:pick $oldad 0 [:find $oldad "/"]]
   :if ($oldad != $newad) do={
   /ip ad set addr=$newad netw=$newad broa=$newad
   /ip route set gateway=$newad
    /ip fire nat set to-address=$newad }}}
:if (($line=8) && ($nt1 != 8)) do={
   /ip fir nat set disable=yes
   /ip fir mangle set nth=7,8,0
   /ip fir mangle set nth=7,8,1
   /ip fir mangle set nth=7,8,2
   /ip fir mangle set nth=7,8,3
   /ip fir mangle set nth=7,8,4
   /ip fir mangle set nth=7,8,5
   /ip fir mangle set nth=7,8,6
   /ip fir mangle set nth=7,8,7
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no}
:if (($line=7) && ($nt1 != 7)) do={
   /ip fir nat set disable=yes
   /ip fir mangle set nth=6,7,0
   /ip fir mangle set nth=6,7,1
   /ip fir mangle set nth=6,7,2
   /ip fir mangle set nth=6,7,3
   /ip fir mangle set nth=6,7,4
   /ip fir mangle set nth=6,7,5
   /ip fir mangle set nth=6,7,6
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes}
:if (($line=6) && ($nt1 != 6)) do={
   /ip fir nat set disable=yes
   /ip fir mangle set nth=5,6,0
   /ip fir mangle set nth=5,6,1
   /ip fir mangle set nth=5,6,2
   /ip fir mangle set nth=5,6,3
   /ip fir mangle set nth=5,6,4
   /ip fir mangle set nth=5,6,5
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes}
:if (($line=5) && ($nt1 != 5)) do={
   /ip fir nat set disable=yes
   /ip fir mangle set nth=4,5,0
   /ip fir mangle set nth=4,5,1
   /ip fir mangle set nth=4,5,2
   /ip fir mangle set nth=4,5,3
   /ip fir mangle set nth=4,5,4
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes}
:if (($line=4) && ($nt1 != 4)) do={
   /ip fir nat set disable=yes
   /ip fir mangle set nth=3,4,0
   /ip fir mangle set nth=3,4,1
   /ip fir mangle set nth=3,4,2
   /ip fir mangle set nth=3,4,3
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes}
:if (($line=3) && ($nt1 != 3)) do={
   /ip fir nat set disable=yes
   /ip fir mangle set nth=2,3,0
   /ip fir mangle set nth=2,3,1
   /ip fir mangle set nth=2,3,2
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes}
:if ($line=2) do={
   /ip fir nat set disable=yes
   :if ($nt1 != 2) do={
   /ip fir mangle set nth="1,2,0"
   /ip fir mangle set nth="1,2,1"
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=no
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes
   /ip fir mangle set disable=yes}}
:if ($line=1) do={
   /ip firewall nat set disable=no
   :for i from=1 to=8 do={
   /ip fir nat set disable=yes
   /ip rou set disable=yes
   /ip rou unset routing-mark    }}
:local disx [:len ]
:local aa routing-m]
:local bb routing-m]
:local cc routing-m]
:local dd routing-m]
:local ee routing-m]
:local ff routing-m]
:local gg routing-m]
:local hh routing-m]
:set aa [:len ($aa . $bb . $cc . $dd . $ee . $ff . $gg . $hh)]
:if (($line>=2)&&(($disx !=(8-$line)||($aa != ($line*2))))) do={
:for i from=1 to=$line do={
    /ip fir nat set comment]] disable=no
    /ip fir nat set comment]] connection-mark=("c" . $i)
    /ip rou set comment]] disable=no
    /ip rou set comme]] routing-mark=("r" . $i)}}


:if ($line>=2) do={
:for i from=1 to=(8-$line) do={
   /ip fir nat set comment]] disable=yes
   /ip fir nat unset comment]] connection-mark
   /ip rou set comment]] disable=yes
   /ip rou unset comment]] routing-mark   }}

:delay 2s
:if ( active] != true) do={
    :set newad comm] netw]
    /ip route set gateway=$newad}

47771885 发表于 2011-4-20 01:53:39

呵呵这脚本够强的

jacksonzhang 发表于 2011-4-20 02:13:25

怎么改能改成3.3可以用啊。

tonykong 发表于 2011-4-20 09:41:32

看起来怎么这么复杂,不过还是顶你。3。30可以用么?

brqtpt007 发表于 2011-4-20 09:41:59

够强都没看到给加分

jiangyufu 发表于 2011-4-20 12:24:14

好长啊,哈哈,强悍

mxso 发表于 2011-4-20 12:42:43

最笨的写法

zooyo 发表于 2011-4-20 20:52:19

这不叫脚本吧?

9939781 发表于 2011-4-21 12:32:56

本帖最后由 9939781 于 2011-4-21 12:33 编辑

我靠,这么长,看都把人看死了。
http://www.cat-home.org/?action=show&id=26
你直接去下我的免费版生成器得了。

jt00278 发表于 2011-4-25 01:14:54

好长的脚本……

index 发表于 2011-4-25 09:04:30

:lol很好。可惜没真实环境调试。呵呵

WGHBOY 发表于 2011-4-26 10:22:47

这脚本没什么用处,只耗cpu
页: [1]
查看完整版本: 我使用的8线切换脚本