How to configure Mikrotik sms notification for WAN link failure

The job of a network engineer becomes easier when he puts in so much efforts aimed at automating work processes. As a network engineer, you want to be aware of network failures even when you are out of the office. You want to be the first to know when your WAN link goes down. In this article, I will be sharing with us on how to configure Mikrotik sms notification to notify you of WAN link failure.

One of the ways that this can be achieved is through the use of email notification. As good as this method is, it is not designed for a network with a single WAN link. This is because when the primary link fails, there will be no internet for the router to send out email notifications. The solution to this is sms notification. Mikrotik sms notification can be configured on any Mikrotik router with a usb port on which a usb modem can be connected.

Requires for Mikrotik sms notification configuration

  • A Mikrotik router with a usb port
  • A universal Usb modem
  • A working sim card with airtime credit

Configuring Mikrotik sms notification

The configuration for Mikrotik sms notification is can be easy and straight forward, if you understand what you are doing. Even if you don’t, just follow the steps in this article.

First of all, make sure you have a sim inserted into a universal usb modem and the usb modem in turn, inserted into the usb port on the Mikrotik router. After this, confirm that the router can actually detect the presence of the usb modem. To do this, click on system >> port. Note the name of the usb port. By default, it is usually “usb1”.

The next step is the configuration of netwatch to monitor WAN link status. To do this, we set up the system to ping a reliable internet IP, preferrably the google dns address of 8.8.8.8.

tool netwatch add host=8.8.8.8 interval=00:02:00 up-script=”/sys script run up_script” down-script =”/sys script run down_script”

The WAN link will be considered down after 2 minutes of the router not being able to ping 8.8.8.8. if the ping is successful, the script named “up_script” will execute, else, “down_script” will execute. In the next step, we will create the scripts.

The final step is the creation of the scripts referenced in step two above. We will create two scripts name up_script and down_script respectively. Lets see below.

The message included in the source field of a script will be executed when the script is called upon. Ensure that the phone number included can receive sms as it will receive the message “WAN_UP” or “WAN_DOWN” depending the status of the link and which of the scripts is called upon. Also make sure that the correct usb port is referenced. In this case, it is usb1.

Spread the love

2 thoughts on “How to configure Mikrotik sms notification for WAN link failure”

  1. Are you sure the netwatch settings are correct?

    (“tool netwatch add host=8.8.8.8 interval=00:02:00 up-script=”/sys script run up_script” down-script =”/sys script run down_script”)
    (“The WAN link will be considered down after 2 minutes of the router not being able to ping 8.8.8.8.)

    According to the settings above netwatch will ping Google once each two minutes and start down/up procedure after failing (after single ping failure) – what is quite often, so you are risking here a few text messages each day.

    IMHO you cannot use netwatch to proper WAN monitoring, it is necessary to use a bit more sophisticated script, which would send warning aftera a few missing pings.

    Bests,
    M.

    Reply

Leave a Comment