I'm trying to setup an "advenced" hotspot on the RouterOS. Basic configuration covered by official documentation works
like a charm but the goal is to create the hotspot for a dormitory with additional rules:
1. After first login, the Mac Address should be bound to the user
2. The static lease should be created on the DHCP to bind Mac Address to the IP - we want the user to use "static" address assigned from dhcp and
we don't want this address to be changed during the accommodation.
I came out with hotspot user profile on login script:
Code: Select all
:local u [/ip hotspot user find name=$username ];
:if ([:len $u] > 0) do {
:if ([:len [/ip hotspot user get $u "mac-address"]] < 1) do {
# bind mac address to the user
/ip hotspot user set $u mac-address=$"mac-address";
# convert the dynamic lease into the static lease
:local lea [/ip dhcp-server lease find mac-address=$"mac-address"];
log info message=$lea;
/ip dhcp-server lease make-static $lea;
}
}
all the leases are coverted to the static leases. Following line:
Code: Select all
/ip dhcp-server lease find mac-address=$"mac-address"
I can see it in the log: "*2;*3;*4"
funny thing is, when I try to execute command like:
Code: Select all
:put [/ip dhcp-server lease find mac-address=08:00:27:8B:C4:CD]
What am'i missing? Is it bug or my mistake?
Best regards,
Alek.