Despite the transit on PR2 having a lower med, when all things are equal (Path length, local pref etc) routes are continually preferred toward PR1 - seemingly because it has a lower routerID or the BGP session has been up longer. I'd be expecting routes toward PR2 to be taking preference, when everything else is equal and the MED becomes the tie breaker.
As you can see here. Below is the output from my route collector (Sorry, but ROS7 is almost unusable for any type of bgp troubleshooting) which shows PR1 (.1) PR2 (.2) and the view of the CR1 (.3) at the end. You can clearly see PR2 there has a med of 0, and PR1 has a med of 10. The CR1 router is seeing the best path as the route with a med of 10.
Code: Select all
6939 6939 13414 13414
184.105.X.X from 194.X.X.1 (194.X.X.1)
Origin IGP, metric 10, localpref 90, invalid, internal, atomic-aggregate
Last update: Tue Feb 21 20:11:05 2023
47787 1299 13414 13414
193.109.X.X from 194.X.X.2 (194.X.X.2)
Origin IGP, metric 0, localpref 90, invalid, internal, atomic-aggregate
Last update: Tue Feb 21 20:17:18 2023
6939 6939 13414 13414
194.X.X.17 from 194.X.X.3 (194.X.X.3)
Origin IGP, metric 10, localpref 90, invalid, internal, atomic-aggregate
Last update: Tue Feb 21 20:08:59 2023
On the CR1 box directly you can see both routes, with the one to PR2 being inactive (.21 as the next hop).
Code: Select all
[user@cr1] /ip/route> print detail where dst-address=104.244.42.0/24
Flags: D - dynamic; X - disabled, I - inactive, A - active; c - connect, s - static, r - rip, b - bgp, o - ospf, d - dhcp, v - vpn, m - modem, y - copy; H - hw-offloaded; + - ecmp
DAb dst-address=104.244.42.0/24 routing-table=main gateway=194.X.X.17 immediate-gw=194.X.X.17%sfp-sfpplus1 distance=200 scope=40 target-scope=30 suppress-hw-offload=no
D b dst-address=104.244.42.0/24 routing-table=main gateway=194X.X.21 immediate-gw=194.X.X.21%sfp-sfpplus2 distance=200 scope=40 target-scope=30 suppress-hw-offload=no
This seems to be the behavior for prefixes with multiple ASNs in the path at least.
However, if I pick a route i'm learning from a peer (With a single ASN in the path e.g. originated by the ASN I'm peering with), I can successfully move the active route between the two PR routers on the CR by modifying the MED. The specific context here is where I have the same external network connected via two Internet Exchanges, one into PR1 and one into PR2.
Worth noting that between the PR1, PR2 and CR1 this is iBGP route reflection (CR1 is the RR)
I noted in the route selection algo that MED is only considered for the left most ASN in the path - which confirms what I'm seeing above. Different to other router vendors which is a shame (Cisco and Juniper both compare MED for iBGP peers regardless of AS_PATH).
Is there a recommended way to overcome this? Allowing me to select the transit on the second router, when everything else is equal (e.g. use transit 1 when the AS_PATH is shorter - so simply changing LOCAL_PREF isn't a solution here since that'd ignore AS_PATH etc). Or do I really have to break the network, and make the connections between the PR and CR devices eBGP so MED is taken into consideration regardless of path - or be really crazy, and physically move the preferred transit to the lower routerID device