We are working for a new VRRP project and found a “inexplicable” error
I have 2 CCR1009-8G-1S-1S+ configured with VRRP, two WAN’s, all ok. On a second router we configured a “netwatch” to enable or disable a “PPPoE” interface and this is the problem. The “netwach” works correctly but on different interface.
If i open “new terminal”/ interface / print, the “PPPoE” interface is number 12 but when “netwatch” works (disable/enable) on another interface
If i disable or enable interface from “New terminal” works fine, the problem is only with “netwatch”.
I would not dare to modify an object by number because the number can change at any time.
Apparently it bites you. Why don’t you use the proper solution shown in many scripting examples?
Usually commands does not know id if print function is not executed.
You should try to edit your script like this:
/interface print
/interface and_the_rest_of_your_command
Ok but does it matter?
Why would you ever want to use /interface set 0 xxxx?
Isn’t it much better and safer to use /interface set [find name=“interfacename”] xxxx ?
When I look in my /interface print output the interface numbers change e.g. when an L2TP user logs in.
I would never ever want to run a background script on a fixed item number…
Maybe one can say that the real bug is that fixed item numbers are allowed from script context…
it’s not a bug because the index depends on previous ‘print’ command. for example:
[admin@TestPlace] /interface> print where name="ether6"
Flags: D - dynamic, X - disabled, R - running, S - slave
# NAME
0 RS ether6
[admin@TestPlace] /interface> disable 0
[admin@TestPlace] /interface> print where name="ether7"
Flags: D - dynamic, X - disabled, R - running, S - slave
# NAME
0 RS ether7
[admin@TestPlace] /interface> disable 0
in those cases “disable 0” will disable two different interfaces
so just use “/interface disable pppoe-out1” and “interface enable pppoe-out1” commands in NetWatch scripts
p.s. if you’re afraid that someone will rename the interface, you may use this dirty hack: