Recursive routing with marking

Found on this page: https://help.mikrotik.com/docs/pages/viewpage.action?pageId=26476608
reroute.png
Why do we specify routing-table in the second part, but not in the first ?

Hi,

it’s a bit out of context but…
Basically recursive routing is done because:

  • MikroTik is able to check if a GATEWAY is alive and can handle routing based on the result (let’s say: PING OK / PING NOT OK)

This does not necessarlily mean that the INTERNET is alive on that gateway.

So what these entries are doing is set up a route to 8.8.8.8 and 8.8.8.4 in the ISP-Outbreak-Interfaces.
The second part - as you might have seen - is missing “dst-address”, which means it will be the DEFAULT route.
As a gateway they setup 8.8.8.8 and / or 8.8.8.4 recursively, so that only when those hosts are pingeble the route becomes active.
Primary and Secondary ISP is then managed by the “distance” - the lower the higher the priority.

This is done mainly because it is not possible to check the route depending on hosts AFTER the gateway.

Falling back to your question: We need to define the routing table to make sure we can create a corresponding MANGLE-Roule (“mark routing”) in the firewall. This is the only way to make traffic to be sent over a specific route then - all has to correspond.


Hope this helped.

If you are as confused about this and rather like to check a host BEHIND a specific gateway - why not try this method instead, I recently discovered:

http://forum.mikrotik.com/t/simpler-failover-for-two-gateways-i-found-working/169108/1

Best regards,
Martin!

The quick answer is that there is a routing-table specified in the first one, its just not shown, routing-table=main.
Every IP route needs a routing table, the default one is MAIN.
The router normally looks at the main table to find where to route traffic.
If you want the router to pick something different one must use routing rules or mangle traffic to different tables.

Nexthop lookup is done only in the main routing table, > even for routes with different value of routing-mark> . It is necessary to restrict set of routes that can be used to look up immediate nexthops.

Quite surprising :slight_smile: and absolutely unclear why would they do that
If I understand correctly, routing-mark used only for the first entry selection, and does not matter for the following recursive search