Community discussions

 
iranet
just joined
Topic Author
Posts: 12
Joined: Tue Sep 01, 2009 4:11 am

Routing distance and subnets priority

Thu Feb 12, 2015 3:08 pm

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?
 
User avatar
nickshore
Member
Member
Posts: 472
Joined: Thu Mar 03, 2005 4:14 pm
Location: Suffolk, UK.
Contact:

Re: Routing distance and subnets priority

Thu Feb 12, 2015 3:19 pm

The most specific route is used first, so a /24 will always be used in preference to a /16
Nick Shore MTCNA MTCWE MTCRE MTCINE MTCTCE
LinITX.com - MultiThread Consultants
Get your MikroTik RBs and Training: http://linitx.com/brand/mikrotik
Official UK MikroTik Distributor
IRC chan: #routerboard on irc.z.je (IPv4 and IPv6)
 
iranet
just joined
Topic Author
Posts: 12
Joined: Tue Sep 01, 2009 4:11 am

Re: Routing distance and subnets priority

Thu Feb 12, 2015 3:27 pm

I understand that, but distance is different
Shouldn't distance change priority of route?
 
User avatar
nickshore
Member
Member
Posts: 472
Joined: Thu Mar 03, 2005 4:14 pm
Location: Suffolk, UK.
Contact:

Re: Routing distance and subnets priority

Thu Feb 12, 2015 3:35 pm

Distance is only considered after subnet size.
Nick Shore MTCNA MTCWE MTCRE MTCINE MTCTCE
LinITX.com - MultiThread Consultants
Get your MikroTik RBs and Training: http://linitx.com/brand/mikrotik
Official UK MikroTik Distributor
IRC chan: #routerboard on irc.z.je (IPv4 and IPv6)
 
User avatar
nest
Forum Veteran
Forum Veteran
Posts: 811
Joined: Tue Feb 27, 2007 1:52 am
Location: UK
Contact:

Re: Routing distance and subnets priority

Thu Feb 12, 2015 3:43 pm

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)
Ron Touw - Mikrotik Certified Trainer
LinITX.com - MultiThread Consultants
Get your MikroTik RBs and Training: http://linitx.com/category/166
Largest Official UK MikroTik Distributor
IRC channel: #routerboard on irc.z.je (IPv4), 6.irc.z.je (IPv6)
 
iranet
just joined
Topic Author
Posts: 12
Joined: Tue Sep 01, 2009 4:11 am

Re: Routing distance and subnets priority

Thu Feb 12, 2015 4:12 pm

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.

So, any ideas, how I can make this to work?
 
iranet
just joined
Topic Author
Posts: 12
Joined: Tue Sep 01, 2009 4:11 am

Re: Routing distance and subnets priority

Thu Feb 12, 2015 4:21 pm

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

So this work..

Who is online

Users browsing this forum: No registered users and 12 guests