Answer the question
In order to leave comments, you need to log in
How does mikrotik netwatch work?
Всем доброго!
Как то в гугле не нашел :(
Мне интересно как работает утилита netwatch в mikrotik? У меня на ее основе стоит переключения между провайдерами, но что то часто она у меня срабатывает... Сколько пакетов должно реджектнутся чтобы состояния переключилось на "down" или оно срабатывает даже если пропал один пакет? И если ето так (статус "down" после одного утраченого пакета), то что будет лучше по производительности (что меньше грузит систему) , написать собственный скрипт (аля netwatch, но с переключениям после заданого количества потерь) или все же стандартная netwatch ?
Answer the question
In order to leave comments, you need to log in
Здравствуйте. Нетвоч срабатывает при потере одного пакета. Переключение провайдеров делается средствами маршрутизации, без скриптов и нетвотчей. А последний правильно использовать исключительно для оповещения.
You can write a separate script, but it's easier to set up an additional check in netwatch. To improve the accuracy of the Internet availability check, to avoid false switches, for example, in case of possible problems on the polled side or short-term network failures, lost packets, etc. - 2 independent test addresses are used (you can use addresses of various public dns, for example Google and Yandex) - xxxx and yyyy Address xxxx - specified in the Netwatch host settings, if there is no ping - “down” starts to work, which makes 5 attempts to ping to yyyy and if all 5 attempts are also unsuccessful, the script continues to work and activates / deactivates routes in accordance with the comments in the routing tables. The first successful attempt interrupts further script execution, no changes to routes or other actions occur. Static routes have been assigned to these test IP addresses through the gateways of the respective providers, and rules have been added to the firewall that prohibit outgoing pings to these addresses through other interfaces.
The script added the output of messages to the log, as well as sending SMS with information about which provider and at what time the problem arose. Sending SMS is implemented using the site sms.ru.
api_id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - unique id - issued during registration on sms.ru
to=79********* - phone number to which SMS is sent. If the number is the same as when registering on the site - 5 SMS per day for free.
Here is my config option:
"down":
/log warning "server x.x.x.x fail…"
:local time [/sys clock get time]
:local checkip [/ping y.y.y.y count=5]
:if (checkip = 0) do={
/log error «ISP1 IS DOWN»
/ip route set [find comment="main"] disabled=yes
/ip route set [find comment="reserve"] disabled=no
:delay 1
/tool fetch url="http://sms.ru/sms/send?api_id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&to=79*********&text=ISP1_IS_DOWN_$time" keep-result=no
}
/log warning «ISP1 IS UP»
/ip route set [find comment="main"] disabled=no
/ip route set [find comment="reserve"] disabled=yes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question