If I understand correctly, when you create a new route, “distance” makes priority.
Eg. if you have two same route to different interface, route with smaller priority will have advantage and will be “active” route.
Example:
add comment=“Route 1” distance=5 dst-address=10.10.10.0/24 gateway=Kon1
add comment=“Route 2” distance=2 dst-address=10.10.10.0/24 gateway=Kon2
So, all packet to any address 10.10.10.0/24 will go on gateway Kon2 (distance 2)
BUT
But, if you have to different subnet mask / bits, but same ip range - proprity in distance is ignored!
Example:
add comment=“Route 1” distance=5 dst-address=10.10.10.0/24 gateway=Kon1
add comment=“Route 2” distance=2 dst-address=10.10.10.0/24 gateway=Kon2
add comment=“Route 3” distance=1 dst-address=10.10.0.0/16 gateway=Kon3
All route to 10.10.10.0/24 will go on Kon2 anyway, but distance on Kon3 is “1” but subnet is 16bit and distance is igonred!
Is that standard behaviour in Mikrotik routers?
Nick is correct. Also, if multiple routes have the same identical distance then the choice of order becomes: 1st - Connected Route, 2nd - Static Route, 3rd - Dynamic route (usually from a dynamic routing protocol)
So, only if I have same subnet size distance makes priority… OK, I understand…
Here is my problem…
I have 25 sites (locations) with Mikrotik routers connected to central Mikrotik router.
So, I’m connected to that central router as well.
But only one of this 25 sites (locaton 5) is special case and has two connection. One to central Mikrotik router and one to my router directly.
Direct connection between “site 5” and my router should be used only if central router is down.
So, I create route something like this:
add comment=“Route ALL” distance=1 dst-address=10.0.0.0/8 gateway=Central
add comment=“Site 5” distance=2 dst-address=10.0.5.0/24 gateway=Location5
Idea is that route 10.0.5.0/24 work only if route 10.0.0.0/8 is down.
But this not work from obvious reason as you are mention before.
I figure out…
I need to create another route for site 5 to central router:
add comment=“Route ALL” distance=1 dst-address=10.0.0.0/8 gateway=Central
add comment=“Site 5” distance=2 dst-address=10.0.5.0/24 gateway=Location5
add comment=“Central 5” distance=1 dst-address=10.0.5.0/24 gateway=Central