Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 21643

Scripting • Re: Script to find IPv6 address dynamically assigned to known MAC address on LAN?

$
0
0
[..] DHCPv6 script section the global variable is not created nor set [..]
If you read changelogs, help and forum, you learn that actually, on actual stable version, netwatch dhcp, ppp, etc.
sciripts are runned on different user that can't interac with global variables, and other restricted permissions.


Code:
[...] numbers=1 [...]
Second rule:
Never use numbers and similar on script.
(The first is never use variables name like parameters name, not this case.)
The correct form is something like do={/ip dns static set [:find where <<something that matches the correct DNS record>>] address=$i3}

Code:
[...]; :toarray $i2;[...]
What is it for? It's like writing uselessly anywhere in the script (1+1).
Is useless, $i2 is already one array, but the correct form, if of any utility is [...]; :set i2 [:toarray $i2];[...]


Code:
[...]:foreach i in=[find where mac-address="AA:BB:CC:DD:EE:FF"] do={:local i2 [get $i]; :toarray $i2; :local i3 [:pick $i2 1]; :if ($i3 ~"^fe80") do={ [...] }}
All this just for [...]:foreach i in=[find where mac-address="AA:BB:CC:DD:EE:FF" and address~"^fe80"] do={ [...] } ?
(however, not the correct way)

The forum is full of correct examples.

Statistics: Posted by rextended — Mon Dec 30, 2024 10:13 am



Viewing all articles
Browse latest Browse all 21643

Trending Articles