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

Scripting • Re: Script DHCP Lease to Simple Queues don't work since update to 7.13

$
0
0
This is my first MikroTik router, but after faffing about with the DHCP scripts for a day, here's what I found out:

First off, dhcp scripts *do* run under 7.13 and 7.14 at least, but if there is the tiniest syntax error in your script anywhere, then it will not run - no log messages, no error messages. Nothing. So do test by running them on the console first (you may have to supply fake values for the DHCP variables of course)

Secondly, and this was a big gotcha, the variable names mentioned in the help documentation at https://help.mikrotik.com/docs/display/ ... Properties are wrong, those values are not present when the script is run.

I found that the values mentioned in the 3rd post in this topic DO work: viewtopic.php?t=174626

Here they are:
Code:
leaseBound - set to "1" if bound, otherwise set to "0"leaseServerName - dhcp server nameleaseActMAC - active mac addressleaseActIP - active IP addresslease-hostname - client hostnamelease-options - array of received options
For some reason, these also contain names with a "-" in them, which is a problematic character for variable names in scripts, so you have to use
Code:
$"lease-hostname"
to work around that (I just copied their value into a local variable with a normal name, instead of trying to figure out how to use quotes within a quoted string :-(

Anyway, hope this helps someone else and maybe someone can update the documentation?

Statistics: Posted by robbiereindeer — Sat Mar 02, 2024 2:42 pm



Viewing all articles
Browse latest Browse all 15394

Trending Articles