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: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 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?
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
Code:
$"lease-hostname"
Anyway, hope this helps someone else and maybe someone can update the documentation?
Statistics: Posted by robbiereindeer — Sat Mar 02, 2024 2:42 pm