我正在尝试将一个脚本添加到列表中,以便安排它在间隔基础上运行它,但是当我将它放在脚本中时它不起作用并且当我在 Mikrotik 的终端中手动执行脚本时它工作得很好。我已经尝试了这两个版本的脚本:
\n /r/
脚本版本:
{\r\
\n:global NSM2 [/ip neighbor find mac-address="68:72:51:34:AA:03"];/r/
\n:foreach i in=$NSM2 do={/r/
\n:global nsm2tx [/ip neighbor get $i address];/r/
\n}/r/
\n/ip firewall nat set 11 to-address=$nsm2tx/r/
\n:global NSM2 [/ip neighbor find mac-address="68:72:51:32:11:60"];/r/
\n:foreach i in=$NSM2 do={/r/
\n:global nsm2rx [/ip neighbor get $i address];/r/
\n}/r/
\n/ip firewall nat set 10 to-addresses=$nsm2rx/r/
\n}
普通版:
:global NSM2 [/ip neighbor find mac-address="68:72:51:34:AA:03"];
:foreach i in=$NSM2 do={
:global nsm2tx [/ip neighbor get $i address];
}
/ip firewall nat set 11 to-address=$nsm2tx
:global NSM2 [/ip neighbor find mac-address="68:72:51:32:11:60"];
:foreach i in=$NSM2 do={
:global nsm2rx [/ip neighbor get $i address];
}
/ip firewall nat set 10 to-addresses=$nsm2rx
但是,当放置在脚本中然后单击运行按钮或计划运行时,这些都不起作用..!