寻找默认网关接口IP
ROS版本5.22,用了网上搜的脚本:global adgw gateway]
:global ip address]
:global newip [:pick $ip 0 [:find $ip "/"]]
提示错误,没有这个变量,如图,请高手请教. 换个角度问问题,谁能把以下脚本优化下,如果用以下脚本,线路多的情况下,写起来太麻烦了,
:local status running];
:if ($status=true) do={
:set ether "pppoe-out1"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out2"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out3"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out4"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out5"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out6"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out7"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out8"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out9"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out10"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out11"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out12"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out13"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out14"};
:if ($status=false) do={
:local status running];
:if ($status=true) do={
:set ether "pppoe-out15"};
:if ($status=false) do={
:set ether "pppoe-out1"}}}}}}}}}}}}}}}
我的思路是,既然不能提取默认网关的IP,那么就取其它已连接出口的IP, 试下这个
:local newip [ /ip route get pref-src ]
页:
[1]