Community discussions

MikroTik App
 
User avatar
gogotha
newbie
Topic Author
Posts: 30
Joined: Mon May 21, 2018 1:16 am
Location: Tyler

Rouge DHCP Detection and Alert help

Sun Aug 15, 2021 12:18 am

I am building a default import that our technicians can use on new installs and would like to add a rouge DHCP detection and alert when detected. I tried the code below from the website of a guy that trained me but its appears broken when I import via terminal. I tried to leave a post on his site to ask him but posting replies fail. With the terminal error in image, will this still work?
/ip dhcp-server alert
add disabled=no interface=bridge on-alert=":local sysname [/system identity get name];\r\
    \n/tool e-mail send to=alerts@mydomain.com subject=\"Rouge DHCP Server Detected\" body=\"An unknown DHCP server was\
    \_detected on \$interface of \$sysname with a ip address of \$address\""

Terminal showing error-
Image

Script gets imported-
Image
 
pe1chl
Forum Guru
Forum Guru
Posts: 10183
Joined: Mon Jun 08, 2015 12:09 pm

Re: Rouge DHCP Detection and Alert help

Sun Aug 15, 2021 12:00 pm

There can be problems like this when pasting /export'ed config in a winbox terminal.
Use an external telnet/ssh client instead.
It looks like your script was correctly imported but it is difficult to be sure unless you widen the window so there is no more automatic line wrapping.

And of course: you always should test such things. Connect a second device with DHCP server on the same network and see if it is being detected and your mail is sent correctly.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Rouge DHCP Detection and Alert help

Sun Aug 15, 2021 5:39 pm

Except than Rouge on english have another mean (lipstick / from Française rouge for Red), and the right word is "Rogue" (also change on title please)

this is a "fixed" script for do not make appear the "cosmetic" :mrgreen: error on winbox.
/ip dhcp-server alert
add disabled=no interface=bridge on-alert=\
    ":local sysname [/system identity get name];\r\
    \n/tool e-mail send to=alerts@mydomain.com subject=\"Rogue DHCP Server Detected\" body=\"An unknown DHCP server was detected \
    on \$interface of \$sysname with a ip address of \$address\""

Who is online

Users browsing this forum: No registered users and 46 guests