Community discussions

MikroTik App
 
ros44
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 74
Joined: Sun Feb 25, 2018 2:05 am
Location: Sofia, Bulgaria

Notification for new DHCP leases

Thu Jul 25, 2019 12:53 pm

Hello guys, I found only one similar question in the forum, but without any replies of it.

All my devices in the network have statically assigned DHCP leases. Still, there is a pool of 5 addresses available if new devices connect to the network accidentally.

Is there any mechanism I can configure so that when a DHCP lease from that 5-address pool is given to e new device I will get a notification? May be an email or something similar?

Thank you!
Last edited by ros44 on Thu Jul 25, 2019 10:54 pm, edited 2 times in total.
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Posts: 997
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Re: Notification for new DHCP leases  [SOLVED]

Thu Jul 25, 2019 12:58 pm

Sure.
Take a look at "lease-script" in the dhcp-server manual.
Add your matchers against the leaseActIP variable and then trigger an email.

-Chris
 
ros44
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 74
Joined: Sun Feb 25, 2018 2:05 am
Location: Sofia, Bulgaria

Re: Notification for new DHCP leases

Thu Jul 25, 2019 1:05 pm

Thank you! It seems so clear and obvious.
Best of luck!

Edit: a simple script for anyone reading this post.

:if ($leaseActIP = "192.168.1.130") do={
:log info "IP: $leaseActIP, MAC: $leaseActMAC, Host: $"lease-hostname""
:tool e-mail send to=email@example.com subject="Violation alert!!! New DHCP client in the network" body="MAC: $leaseActMAC,
IP: $leaseActIP,
Host: $"lease-hostname",
$leaseBound"
}

Who is online

Users browsing this forum: No registered users and 22 guests