Best practice for route preference

Ondrej Zajicek santiago at crfreenet.org
Tue Aug 6 14:41:49 CEST 2024


On Tue, Aug 06, 2024 at 12:58:53PM +0200, Nico Schottelius via Bird-users wrote:
> 
> Good morning,
> 
> you might remember my confusion about non-exported routes some threads
> away [0] and while not completely bird specific, I think it might be a
> good topic to discuss for most bird users as well:
> 
>      How to deal with route preference when one has multiple sources?

> 
> Problem statement:
> 
> - Your ASN receives the same route multiple times from different upstreams
> - What is the best way of handling multiple routes in regards to
>   a) best practice ("the next engineer understands the solution")
>   b) efficiency ("how fast to failover")
>   c) robustness ("simplicity" and "default behaviour")
> 
> The setup will for almost anybody look something like that:
> 
>  --------
> |Your ASN |
>  --------
> 
> router1----------------- ASN A: sends route X
>   |
>  iBGP+IGP (babel, OSPF, etc.) - other-routers-of-the-asn
>   |
> router2
>   |--------------------- ASN B: sends route X
> 
> And let's assume that by default ASN A is the preferred path for route
> X.

Hi

I think that the solution 1 (lower bgp_local_pref in EBGP import) is
generally safer and simpler way, while the solution 2 can have nicer
failover if done properly.

First, note that for solution 2 the ASBRs should not participate in
internal routing (i.e. should be end-node in IGP topology), that allows
them to be configured in strict EBGP-before-IBGP way, so they would use
EBGP routes both for forwarding and announce them to IBGP, regardless of
other IBGP routes.

The end-node condition is that you should avoid this setup:

 router1----------------- ASN A: sends route X
   |
 router2----------------- ASN B: sends route X
   |
 router3

(in which router3 receives both route to through ASN A and ASN B, prefer
to use ASN A through router1, but because there is router2 on the path
from router3 to router1, the traffic ends in ASN B anyway.)

The second issue is that communication with router2 itself and outer
world would use ASN B even if link to ASN A is available, unless you do
some tricks with VRFs / multiple tables.


I think the configuration for solution 2 can be done easily, you can just
set high local_pref on import from EBGP and then decrease it by fixed
amount when exported to IBGP.

E.g. if you local pref values are (0, 1000), you can use (1000, 2000) on
EBGP import, then decrease by 1000 when export to IBGP, so EBGP is always
higher than any IBGP.

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
"To err is human -- to blame it on a computer is even more so."


More information about the Bird-users mailing list