in RouterOS 6 I have a running script that checks the status of the main and backup links. It works as follows (the script is quite complex, but it comes down to executing the command):
Code: Select all
ping 8.8.8.8 interval=300ms routing-table=internet1
ping 8.8.8.8 interval=300ms routing-table=internet2
For proper operation, the following entries are necessary:
Code: Select all
/ip route
add distance=1 gateway=172.16.0.1 routing-mark=internet1
add distance=2 routing-mark=internet1 type=blackhole
add distance=1 gateway=172.16.100.1 routing-mark=internet2
add distance=2 routing-mark=internet2 type=blackhole
add distance=1 gateway=172.16.0.1 comment="wan_monitoring: internet1" disabled=no
add distance=2 gateway=172.16.100.1 comment="wan_monitoring: internet2" disabled=yes
# the script switches the last two commands depending on which link is active
/ip firewall mangle
add action=mark-connection chain=input comment=WAN1_main in-interface=\
WAN1_main new-connection-mark=MWAN1 passthrough=yes
add action=mark-routing chain=output connection-mark=MWAN1 new-routing-mark=\
internet1 passthrough=no
add action=mark-connection chain=forward comment=WAN1PF connection-state=new \
in-interface=WAN1_main new-connection-mark=PFMWAN1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=PFMWAN1 \
in-interface=bridge1 new-routing-mark=internet1 passthrough=yes
add action=mark-connection chain=input comment=WAN2_T-Mobile in-interface=\
WAN2_T-Mobile new-connection-mark=MWAN2 passthrough=yes
add action=mark-routing chain=output connection-mark=MWAN2 new-routing-mark=\
internet2 passthrough=no
add action=mark-connection chain=forward comment=WAN2PF connection-state=new \
in-interface=WAN2_T-Mobile new-connection-mark=PFMWAN2 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=PFMWAN2 \
in-interface=bridge1 new-routing-mark=internet2 passthrough=yes
After upgrading to RouterOS 7, this method no longer works because the ping command no longer has the: routing-table parameter. How in RouterOS 7 can I ping with two different internet connections - use the first one once, and then the second when the first or the second is active?