Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. # This can be added as a script to a mikrotik router's DHCP server config
  2. # to create easier to read informational messages.
  3. # Sample output:
  4. # DHCP server defconf assigned 192.168.0.11 to D4:FD:CE:BA:88:0F corresponding to hostname "Demo-PC"
  5.  
  6. # Variables
  7. :local dhcpServerOperation
  8. :local dhcpServerPreposition
  9.  
  10. # Set default values
  11. :set dhcpServerOperation " deassigned "
  12. :set dhcpServerPreposition " from "
  13.  
  14. # Change value if an address was assigned instead of deassigned
  15. :if ($leaseBound = 1) do={
  16. :set dhcpServerOperation " assigned "
  17. :set dhcpServerPreposition " to "
  18. }
  19.  
  20. # Print log message
  21. :log info ("DHCP server " . $leaseServerName . $dhcpServerOperation . \
  22. $leaseActIP . $dhcpServerPreposition . $leaseActMAC . " corresponding to hostname \"" . \
  23. ([/ip dhcp-server lease get [find active-address=$leaseActIP] host-name]) . "\"")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement