Page 1 of 1

bgp prefered route

Posted: Tue Mar 19, 2019 8:30 pm
by tgrand
I have 2 bgp peers which advertise the same ASN.
Peer 1 advertises a single /20
Peer 2 advertises a /20 and several /24s

I have set the distance of the peer 1 routes to a lower value, yet the routes still prefer peer 2.
It seems to prefer the smaller subnet first.

I would like to prefer the peer 1 routes.

Any suggestions?

Re: bgp prefered route

Posted: Tue Mar 19, 2019 9:07 pm
by bbs2web
Longer prefix match (/24) will always beat /20. Filter x.x.x.x/20 prefix length 21-24 from peer 2...

Re: bgp prefered route

Posted: Tue Mar 19, 2019 9:08 pm
by tgrand
I have figured it out.
turns out the more specific route (ie. largest netmask or smallest subnet) is chosen over the larger subnet.
I have to filter the routes to discard smaller subnets from the prefix.

Re: bgp prefered route

Posted: Tue Mar 19, 2019 9:39 pm
by Vooray
So, what is an idea behind setting two bgp peers with views?
Prefix length is not something about bgp route selection process.
If you keep ISP2 for failover purposes keep default route only and filter out all other prefixes, or ask peer to announce default only.