Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This can be added as a script to a mikrotik router's DHCP server config
- # to create easier to read informational messages.
- # Sample output:
- # DHCP server defconf assigned 192.168.0.11 to D4:FD:CE:BA:88:0F corresponding to hostname "Demo-PC"
- # Variables
- :local dhcpServerOperation
- :local dhcpServerPreposition
- # Set default values
- :set dhcpServerOperation " deassigned "
- :set dhcpServerPreposition " from "
- # Change value if an address was assigned instead of deassigned
- :if ($leaseBound = 1) do={
- :set dhcpServerOperation " assigned "
- :set dhcpServerPreposition " to "
- }
- # Print log message
- :log info ("DHCP server " . $leaseServerName . $dhcpServerOperation . \
- $leaseActIP . $dhcpServerPreposition . $leaseActMAC . " corresponding to hostname \"" . \
- ([/ip dhcp-server lease get [find active-address=$leaseActIP] host-name]) . "\"")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement