Community discussions

MikroTik App
 
tucker
newbie
Topic Author
Posts: 49
Joined: Sat Mar 10, 2007 2:42 pm

change order of routes

Sun Oct 19, 2008 3:09 pm

Is there any way to change the order of routes in the routing table? Method for either CLI or GUI would be appreciated. I have read documentation numerous times but see no reference to route order or selection method or how to change the route order.

I had wanted to create more selective rules before less selective rules and use the default gateway as a catch-all route. However when I add routes they get added after the default gateway rather than before it.

I am assuming that routes are read in the order they appear based on index and that the first match is used to route packets. Thus if the default route is first then it will get selected before other routes.

Also there does not seem to be a direct correlation between the terminal and GUI for route order.
 
ayufan
Member
Member
Posts: 334
Joined: Sun Jun 03, 2007 9:35 pm
Contact:

Re: change order of routes

Sun Oct 19, 2008 7:08 pm

routes are automatically chosen by shortest mask (from 32 (255.255.255.255) to 0 (0.0.0.0))
 
tucker
newbie
Topic Author
Posts: 49
Joined: Sat Mar 10, 2007 2:42 pm

Re: change order of routes

Sun Oct 19, 2008 7:20 pm

Thanks for the reply.

So more specific routes are selected over less specific routes by default.

If two routes have same mask and one has route mark how is the order selected? I assume since the route mark is a more specific route it would be selected in preference to the less specific route.

I have a situation now where the route mark is clearly on the packet but the route marked route is not being selected and the non-marked route is. This despite a route table entry and a route rule entry. This is for packets leaving the router rather than routing through the router.
 
ayufan
Member
Member
Posts: 334
Joined: Sun Jun 03, 2007 9:35 pm
Contact:

Re: change order of routes

Mon Oct 20, 2008 2:27 am

if you have route mark, routes are selected from that mark table
if you have to routes with the same distance value (for example: default gw taken from ospf from two different gateways) they are selected randomly ;)