📜 ⬆️ ⬇️

Mikrotik - Advanced settings for Yota

Not so long ago, they connected an additional provider in the form of a wireless iota, a simple “whistle”. We have Mikrotik CCR1009-8G-1S-1S +, which has usb. But there was a problem, iota periodically freezes and until you reboot - nothing works. I applied to Iota's technical support, offered to buy a Zyxel router, or put a device between it and microtic that will turn off and turn on the power supply once a day. Nobody wanted to buy an additional router that will be used for the iota, and setting the switch is also not an option — suddenly the iota hangs during the day, and the switch is set at 23:00. I did not find the final solutions for this problem in the network resources (and maybe I looked badly). Therefore, it was decided to configure the automatic reset yota.
Previously, in the iota itself, we set up an address from a different local network. For example, I use the network 192.168.32.0/24, so the address of the iota chose 172.16.0.1.

On the router's lte interface:

/ip address
add address=172.16.0.10/24 interface=lte1 network=172.16.0.0

')
Script for switching iota and sending a notification by mail. It is necessary in the winbox menu to go to the / system script, click "add", give the name - reboot_yota.

Below is the script itself, everything is clear.

/system routerboard usb power-reset duration=3 - resets the power supplied to the "whistle"
/tool e-mail send server=work.ru port=25 user=router@work.ru password=password to=admin@work.ru from="router1" \
subject="MikroTik: $[/system clock get date], $[/system clock get time]" \

body="Yota reboot: $[/system clock get date]\nDate: $[/system clock get time]\nMyName: $[/system identity get name]:"; - sends a notification to the address admin@work.ru about what time and which router has dropped the power to iota.

Next, go to Netwatch, this feature from microtic allows you to monitor the status of the channel at certain intervals:

/tool netwatch
add down-script=reboot_yota host=172.16.0.1 interval=30s


It can be seen from the rule that in the absence of availability 172.16.0.1- a script is executed. We do not indicate anything to Up. in this situation, we monitor only the fall of the channel.

And in addition, if all of you decided to buy a white address from an iota, then for this you need to correctly set up the rules of marking and make routes:

 / ip firewall mangle
 add action = mark-connection chain = input in-interface = lte1 new-connection-mark = conn_yota_in
 add action = mark-routing chain = output connection-mark = conn_yota_in new-routing-mark = out_yota passthrough = no
 add action = mark-connection chain = prerouting connection-state = new in-interface = lte1 new-connection-mark = conn-yota-fw
 add action = mark-routing chain = prerouting connection-mark = conn-yota-fw in-interface = bridge-local new-routing-mark = route-yota-fw passthrough = no
 / ip route
 add distance = 1 gateway = 172.16.0.1 routing-mark = out_yota
 add distance = 1 gateway = 172.16.0.1 routing-mark = inet_for_yota
 add distance = 1 gateway = 172.16.0.1 routing-mark = route-yota-fw


Ports are forwarded correctly, remote access to the router via an external address is available. In the event of a hangup, Yota reboots and notifies the administrator. If there are comments, additions and criticism - write.

Source: https://habr.com/ru/post/277435/


All Articles