Thank you guys!
So that example here
https://awarmanf.wordpress.com/2010/01/ ... cyrouting/ is wrong? There are route rules combined with mangle..
Failover decisions based on pinging gateway does not seems to me like a great idea. There is usualy working gateway and problem is "further down the line" like NetWorker said. That's why I was counting with recoursive routing and pinging something in internet, because I have no experience with scripting on MikroTik. And using IPs like 8.8.8.8... I know it's not ideal, but it usually works
Are there any GOOD examples of failover scripts? I'll learn how to script on ROS and I'll rework this logic later.
NetWorker: Thanks for corrections. I understand that way better now. But I think I have to go with mangle, because I obviously need connection-marks like sindy suggested.
sindy: Thank you for great advices. Yes, I have to configure that device remotely. And yes, I need to access more devices in that area remotely, so I think connection-marking should be my choice. Thanks for that link. It's well explained there. So I have to configure it this way? (Yes, I have failover with recursive routing again, but I'll rework it as soon as I learn something about scripting on ROS
)
/ip route
add dst-address=8.8.8.8 gateway=10.0.1.1 scope=10
add dst-address=8.8.4.4 gateway=10.0.2.1 scope=10
add dst-address=1.1.1.1 gateway=10.0.3.1 scope=10
add distance=1 gateway=8.8.8.8 check-gateway=ping
add distance=2 gateway=8.8.4.4 check-gateway=ping
add distance=3 gateway=1.1.1.1 check-gateway=ping
add distance=1 gateway=8.8.8.8 routing-mark=IPS1 check-gateway=ping
add distance=2 gateway=8.8.4.4 routing-mark=IPS1 check-gateway=ping
add distance=3 gateway=1.1.1.1 routing-mark=IPS1 check-gateway=ping
add distance=1 gateway=8.8.4.4 routing-mark=IPS2 check-gateway=ping
add distance=2 gateway=8.8.8.8 routing-mark=IPS2 check-gateway=ping
add distance=3 gateway=1.1.1.1 routing-mark=IPS2 check-gateway=ping
add distance=1 gateway=1.1.1.1 routing-mark=IPS3 check-gateway=ping
add distance=2 gateway=8.8.8.8 routing-mark=IPS3 check-gateway=ping
add distance=3 gateway=8.8.4.4 routing-mark=IPS3 check-gateway=ping
/ip firewall mangle
add chain=prerouting connection-state=established,related action=accept
add chain=prerouting connection-state=established,related in-interface=WAN1
add chain=prerouting connection-state=established,related in-interface=WAN2
add chain=prerouting connection-state=established,related in-interface=WAN3
add chain=prerouting connection-mark=handling-1 action=mark-routing new-routing-mark=IPS1
add chain=prerouting connection-mark=handling-2 action=mark-routing new-routing-mark=IPS2
add chain=prerouting connection-mark=handling-3 action=mark-routing new-routing-mark=IPS3
add chain=prerouting src-address=192.168.1.0/24 connection-state=new action=mark-connection new-connection-mark=handling-1 passthrough=yes
add chain=prerouting src-address=192.168.2.0/24 connection-mark=no-mark connection-state=new action=mark-connection new-connection-mark=handling-2 passthrough=yes
add chain=prerouting src-address=192.168.3.0/24 connection-mark=no-mark connection-state=new action=mark-connection new-connection-mark=handling-3 passthrough=yes
add chain=prerouting connection-mark=handling-1 action=mark-routing new-routing-mark=IPS1
add chain=prerouting connection-mark=handling-2 action=mark-routing new-routing-mark=IPS2
add chain=prerouting connection-mark=handling-3 action=mark-routing new-routing-mark=IPS3
As soon as I would have this configuration working, I'll have to look at queues, because one of those subnets is guest network and I have to limit users a little bit. But I have to study it a little bit in a first place. I have no experience with queues yet. And thats the same like in the case of potencional load balancing (ISP2 - ISP3) which NetWorker mentioned. But I'll read a little bit about that in the first place... Thank you guys for your help. I really appreciate it!