|
楼主 |
发表于 2013-11-19 09:44:23
|
显示全部楼层
换个角度问问题,谁能把以下脚本优化下,如果用以下脚本,线路多的情况下,写起来太麻烦了,
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out1"] running];
:if ($status=true) do={
:set ether "pppoe-out1"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out2"] running];
:if ($status=true) do={
:set ether "pppoe-out2"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out3"] running];
:if ($status=true) do={
:set ether "pppoe-out3"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out4"] running];
:if ($status=true) do={
:set ether "pppoe-out4"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out5"] running];
:if ($status=true) do={
:set ether "pppoe-out5"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out6"] running];
:if ($status=true) do={
:set ether "pppoe-out6"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out7"] running];
:if ($status=true) do={
:set ether "pppoe-out7"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out8"] running];
:if ($status=true) do={
:set ether "pppoe-out8"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out9"] running];
:if ($status=true) do={
:set ether "pppoe-out9"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out10"] running];
:if ($status=true) do={
:set ether "pppoe-out10"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out11"] running];
:if ($status=true) do={
:set ether "pppoe-out11"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out12"] running];
:if ($status=true) do={
:set ether "pppoe-out12"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out13"] running];
:if ($status=true) do={
:set ether "pppoe-out13"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out14"] running];
:if ($status=true) do={
:set ether "pppoe-out14"};
:if ($status=false) do={
:local status [/interface pppoe-client get [/interface pppoe-client find name="pppoe-out15"] running];
:if ($status=true) do={
:set ether "pppoe-out15"};
:if ($status=false) do={
:set ether "pppoe-out1"}}}}}}}}}}}}}}}
我的思路是,既然不能提取默认网关的IP,那么就取其它已连接出口的IP, |
|