# Discover Unknown DHCP Server On The Network (Telegram) - MikroTik Script RouterOS

    Configuring discovered of an unknown DHCP server on the network and sending a notification to Telegram or email. The name of the DHCP interface on which the server is found, the IP and MAC addresses of the unauthorized device are sent.

    Sometimes it happens when an employee connects the situation to the local network of the enterprise, a personal router, with the DHCP server enabled, which can cause problems with connecting new IP addresses of devices on the local network. Problems may not be detected immediately, but when the lease of IP addresses expires.

    For quick notification of the appearance of an unauthorized DHCP server in the local network, use the Alerts setting in the DHCP server settings.

    # Find DHCP Alert
    :local CurrentTime [/system clock get time];
    :local MsgID [/log find where message ~"dhcp alert" time =$CurrentTime];
    :local MsgText [/log get number=$MsgID message];

    # Send Telegram Message
    :local DeviceName [/system identity get name];
    :local MessageText "\F0\9F\94\B4 $DeviceName: UNKNOWN DHCP SERVER FOUND!  Info: $CurrentTime $MsgText";
    :local SendTelegramMessage [:parse [/system script  get MyTGBotSendMessage source]];
    $SendTelegramMessage MessageText=$MessageText;
    Credit: https://mhelp.pro/mikrotik-scripts-discover-unknown-dhcp-server-on-the-network/