Page 1 of 1

Adding routing mark weird behaviour.

Posted: Mon Sep 14, 2020 3:08 pm
by leostereo
Hi guys.
Im would like to add a routing mark to all my default routes. (I have 3 upstream isp providers connected).
This is how my routes look like:
bgp_status.png
As you can see only route to gateway 10.80.25.1 is active but After set a routing mark for gateway 10.32.65.29, this route goes active.
Take a look:
I
bgp_status2.png
I set differents distance so I can control active default route ... but after seting a routing mark have an undesired active route.

btw:
I need to set a routing mark so I can analize all my providers with a ping probe.
for example doing:
ping 8.8.8.8 routing-table=XXX
Question would be:
Why adding a routing mark takes this route active ?
Is it possible to set routing mark without goes active a route ?

Regards.
Leandro.

Re: Adding routing mark weird behaviour.

Posted: Mon Sep 14, 2020 3:45 pm
by WeWiNet
I think you want to achieve the wrong thing with the wrong tool.

What do you want to do in the end? Ping 8.8.8.8 just for the sake of it? Or do you want to see if internet connection is available for instance?
In that case I would suggest check out Chupaka post on failover, using recursive routing etc.

Regarding the routing mark question. Indeed you have a routing mark and you need an active route to route it. If not, where would you route that traffic too??? Nowhere???
The aim of a routing mark is to get routed... you would normally use first routing mark with lower distance, and then a no routing mark route with higher distance.

In your case the solution is simple... just create 3 routes with 3 routing marks at equal distance. They will all be active for those routing marks ONLY.
Then have one route (the one you actually want) with higher distance and no routing mark on it...

Re: Adding routing mark weird behaviour.

Posted: Mon Sep 14, 2020 4:18 pm
by Sob
Do not change original routes you had before. Add copies in different routing tables, i.e. have both:
/ip route
add dst-address=0.0.0.0/0 gateway=10.32.65.29 distance=20
add dst-address=0.0.0.0/0 gateway=10.32.65.29 routing-mark=bgp_xxx

Re: Adding routing mark weird behaviour.

Posted: Mon Sep 14, 2020 4:49 pm
by leostereo
I think you want to achieve the wrong thing with the wrong tool.

What do you want to do in the end? Ping 8.8.8.8 just for the sake of it? Or do you want to see if internet connection is available for instance?
In that case I would suggest check out Chupaka post on failover, using recursive routing etc.

I have 1 active and 2 backup routes.
I have a bunch of internet services list (dns,games,cdns, et).
I want to ping those host (every 10 mins) through my active route and also my backup routes.
Then I can plot (using smokeping) latency to those hosts.
Then , I can compare latency for me interest tarjets and decide to route according to this metric.

Regarding the routing mark question. Indeed you have a routing mark and you need an active route to route it. If not, where would you route that traffic too??? Nowhere???
The aim of a routing mark is to get routed... you would normally use first routing mark with lower distance, and then a no routing mark route with higher distance.

In your case the solution is simple... just create 3 routes with 3 routing marks at equal distance. They will all be active for those routing marks ONLY.
Then have one route (the one you actually want) with higher distance and no routing mark on it...

Re: Adding routing mark weird behaviour.

Posted: Mon Sep 14, 2020 6:58 pm
by xvo
Then have one route (the one you actually want) with higher distance and no routing mark on it...
Distance is irrelevant in this case.
For packets using the named table, route selection falls back to main table (if it is allowed) only after it failed to find a route in the named one.
And if named table contains an active default route, it can't fail.

Re: Adding routing mark weird behaviour.

Posted: Mon Sep 14, 2020 7:44 pm
by WeWiNet
Distance is irrelevant in this case.
For packets using the named table, route selection falls back to main table (if it is allowed) only after it failed to find a route in the named one.
And if named table contains an active default route, it can't fail.
Indeed distance of routing marked route and main route can be same. But there is also some reason for keeping distance different:
  • I prefer to put the distance higher for the non marked route as this allow to sort per distance and makes complex routing table more readable
  • I was thinking/anticipating Leandro want to do some automatic failover or load balancing with 3 WAN access. I have such a case with 3 WAN i/f, 2 being higher speed (LTE) and 3rd one slow but low latency (DSL). In this situation I want my LTE routing marked connection go over LTE , if one fails , I still want to go that traffic over the LTE connection. And only if that also fails I want to go it over the DSL one. In this situation you want the main route being higher than the routed one, as else it fails over directly to the main one before trying 2nd LTE route.

Re: Adding routing mark weird behaviour.

Posted: Mon Sep 14, 2020 8:27 pm
by xvo
I prefer to put the distance higher for the non marked route as this allow to sort per distance and makes complex routing table more readable
Yeah, I kind of also sometimes use distance to sort the routes, for which the exact order has no difference.