Hello!, I’m trying to get the DHCP assigned IP from my script on bound event, the script get triggered but $leaseActIP is empty, not shure if is a ros version problem (actually running 6.49.9), of course the script get triggered when $bound=1 and dhcp is assigned correctly as I can see in terminal.
:if ($bound=1) do={
:log info “DHCP lease ready: $leaseActIP”
}
You do only confusion
dhcp-server is not dhcp-client
leaseBound is not bound
leaseActIP is not lease-address
Larsa
May 28, 2024, 7:48am
4
Available DHCP variables Mikrotik help - These are available variables that are accessible for the event script: .
bound : “1” = lease is added or changed; “0” = lease is removed
server-address : DHCP server address
lease-address : lease address provided by a server
interface : name of the interface on which the client is configured
gateway-address : gateway address provided by a server
vendor-specific : stores value of option 43 received from DHCP server
lease-options : an array of received options
:if ($bound=1) do={
:log info "DHCP lease ready: $"lease-address" "
}
Sample DHCP scripts: Mikrotik help - Lease script example
in the dhcp-client script section you really have to address/read the variable with the "
cost me about 30min before i realized that
$"lease-address"
The user didn’t specify where, so your suggestions might be wrong…
:if ($leaseBound=1) do={
:log info “DHCP lease ready: $leaseActIP”
}
:if ($bound=1) do={
:log info “DHCP lease ready: $“lease-address””
}