Мовлянов Олег Николаевич
This article is devoted to setting up a backup Internet channel on the Mikrotik RB2011 series router
After a long search and consideration of the options presented on the Internet, we decided on the following logic of the reservation:
- We check the presence of the Internet via netwatch on 8.8.8.8.
- In the absence of communication, we accept that the Internet is gone and turn off the current interface.
- We pause for 1 minute to drop all sessions and turn on the interface of another provider.
- For correct application of the routing settings, restart the router after 15 seconds.
How to configure the router:
- Change the name of the 1st interface to Eth-1-ISP
- For ourselves, we determined that we will "hang" the backup channel on the 10th interface. Therefore, we rename the 10th interface to the Eth-10-ISP, turn off the POE and Master Port = none.
- In IP - Addrresses we prescribe the settings of our channels and check the routes.
- In the IP - Firewall - NAT - masquerade we specify Out. Interface List = WAN
- In the Interface-Interface List, add Eth-10-ISP to the WAN list or create a new one if it does not exist.
- Check manually the operation of each channel disabling and enabling interfaces.
- NAT configuration is not described. This moment is individual for everyone.
- In System - Scripts we add the switchISP script
Script Listing:
/ interface ethernet monitor Eth-1-ISP once do = {
: if ($ status = "link-ok") do = {
/ tool e-mail send to = "xxx@scud.com.ua" subject = ("No internet on Eth-1-ISP") body = ("No internet on Eth-1-ISP. Try use reserv chanell. Ex .: xxx2.scud.com.ua ")
/ interface ethernet disable Eth-1-ISP
: delay 60s
/ interface ethernet enable Eth-10-ISP
: delay 15s
/ system reboot
/ system script job remove [find script = switchISP]
}
}
/ interface ethernet monitor Eth-10-ISP once do = {
: if ($ status = "link-ok") do = {
/ tool e-mail send to = "xxx@scud.com.ua" subject = ("No internet on Eth-10-ISP") body = ("No internet on Eth-10-ISP. Try use main chanell. Ex .: xxx.scud.com.ua ")
/ interface ethernet disable Eth-10-ISP
: delay 60s
/ interface ethernet enable Eth-1-ISP
: delay 15s
/ system reboot
/ system script job remove [find script = switchISP]
}
}
- In Tools - Netwatch we add the entry Host = 8.8.8.8, On Down = switchISP
This completes the configuration.
Comments to the script:
Depending on the settings of the Internet channels, you may not need to reboot the router. Those. The / system reboot line can be deleted or commented out.
To send an e-mail notification, you must configure the Mikrotik Sender in the Tools - Email section
That's all. Good luck.