ROS多线ADSL动态映射脚本

ROS多线ADSL动态映射脚本,本脚本为三线ADSL脚本,如果你的不是三线,请将脚本中的数字3改为你的线路条数,脚本在2.9.27版本ROS下测试通过,2.9.27以上版本我相信也是可以的.

脚本代码:

1
2
3
4
5
6
7
8
9
10
11
12
:global new
:global status
:global x
:set x 3
:for i from=1 to=$x do={
:set status [/interface get [/interface find name=("pppoe-out" . $i)] running]
:if ($status=true) do={
:set new [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address]
:set new [:pick $new 0 ([:len $new] -3)]
/ip firewall nat set [/ip firewall nat find comment=("SSH_" . $i)] dst-address=$new
}
}