Hello, I want a script that warned me by email that a user has been added to my DHCP server. Not as a wireless user but as an intruder on my network.
I have a fixed number of devices on the router board.
If there is still a device, I want this script to warn me.
Does anyone have experience with that?
thanks in advance
Hi plisken,
This shoud get you started, just insert it in your DHCP server script window.
Make sure you have the email configured in Tools->Email first.
:local recipient "you@mail.com"
/ip dhcp-server lease
:if ($leaseBound = 1) do={
:do {
:tool e-mail send to=$recipient subject="DHCP Address Alert [MAC: $leaseActMAC]" body="The following MAC address [$leaseActMAC] received an IP address [$leaseActIP] from the DHCP Server [$leaseServerName]"
:log info "Sent DHCP alert for MAC $leaseActMAC"
} on-error={:log error "Failed to send alert email to $recipient"}
}
Icosa.
Hello,
sorry for me English. This script working fine, but is possible edit for this function? All my devices in lan working with DHCP server. All devices is address reservation. Can script edit for send email, when is new devices in lan?
Thank you,
Pavel
Do your own devices have static leases? If no…
/ ip dhcp-server lease make-static [ find where dynamic ]
Then replace
:if ($leaseBound = 1) do={
with
:if ($leaseBound = 1 && [ get [ find where mac-address=$leaseActMAC ] dynamic ] = true) do={
Hello,
super, thank you very much.
Does someone know how to add active host name to that script?