Let’s say I have two default routes in MikroTik. In the documentation, this is stated:
Candidate route with the lowest distance becomes an active route. If there is more than one candidate route with the same distance, selection of active route is arbitrary
Alright, but what happens if those routes are these:
However playing a theortical game is fun but may be a waste of your time.
Much better to describe your scenario and what you want users on your network to be able to do etc..
YOu may not need any mangling for example.
I believe one has to have a main table entry that is plain jane, but cannot remember why, like most things MT.
I could be wrong.
However that doesnt answer the questions regarding your scenario and actual situation.
Do you have an entire subnet that should go out gateway Y, some users, etc…
What are the actual requirements without talking about the config?
In this case, can I expect these:
A packet without routing mark will go towards “x” each and every time unconditionally?
A packet with routing mark “some_mark” will go towards “y” each and every time unconditionally?
yes
depends, if for example “y” is unreachable it will go through your Main Routing Table “x”
In your example everything will go to X
Not true…
The connection marked with a Routing Mark will follow the Routing Table with that Mark…
There is no order in the Routing Table…
The distance parameter is only used to set mutual priority of routes with identical dst-address and identical routing-mark values. If several such routes exist, and their gateway interfaces are up, only the one with lowest value of distance is made active.
I believe one has to have a main table entry that is plain jane, but cannot remember why, like most things MT.
I could be wrong.
The Main routing Table must exist for traffic initiated from the Router itself… If no Main Routing Table exists the connection is considered as non Routable..
You can create a default Route, just to exist, with gateway an empty Bridge for example…
During the Routing process the connection will be considered as Routable ( Because a default Main Routing Table exists ), after that Routing adjustment will take Place and the connection will be Routed according to the correct Routing Mark in the Routing Table…
So finally it will be Routed as was initially intended according to the Routing Mark …
The same does not apply in the Forward Chain… You can mark traffic in Mangles facility for example, and it will be routed according to the Routing Mark in the Routing Table even if you don’t have a Default Main Routing Table …
You can put it this way - it is not exactly “priority” in this case but yes, if a packet has routing-mark X and a route with routing-mark X exists and its dst-address matches that packet’s destination address, it will be used even if a route with the same dst-address exists in routing table main, no matter what the distance values are.
Well, to be precise, its not priority between the default Route and a Route with a Routing Mark,
But instead its how the Routing decisions are made in the Routing Table ( FIB ), if there is Policy Routing configured from the User, that will be routed accordingly to those Rules, otherwise there is an implicit catch all rule for the Main Routing Table…