BGP Always Compare MED Behavior Between IOSs

While doing some of the best path selection labs, I noticed that if the bgp always compare med command is used, MED is always compared regardless of AS_PATH length.

I read elsewhere in the workbook and heard in one of the ATC videos that if bgp always compare med is used, the med is always compared between different ASN's but only if the AS_PATH length was the same.

I.e., if a router learned 119.0.0.0/24 via AS_PATH 111 222 and 333 444 555, even with BGP always compare med, the MED would not be compared between these two paths because their length is different.

If however that AS_PATH was 111 222 and 333 444, then the MEDs would be compared with the bgp always compare med command enabled because their AS_PATH length is the same.

In practice on the rack rentals, this is not the case. When bgp always compare med is enabled, the med is always compared regardless of AS_PATH length.

What has everyone else seen relating to how this command behaves on other IOSs?

Comments

  • I.e., if a router learned 119.0.0.0/24 via AS_PATH 111 222 and 333 444 555, even with BGP always compare med, the MED would not be compared between these two paths because their length is different

    In the BGP best path selection process the prefix with a path 111 222 should win! AS path length comes before MED!

    Can we see the output of show BGP 119.0.0.0/24 to confirm this?

    Alway compare MED changes the default behaviour where MED is only compared between paths learnt from the same upstream AS.

    HTH

  • show us show ip bgp a.x.y.z/c

    Either this command or show bgp w.x.y.z/m will work.  The shortened version assumes AFI/SAFI of IPv4 unicast.

  • I had as-path ignore enabled and it did not click that this was causing it. I thought it was hard coded not to compare MED when the as-path was different anf always compare med was on. I did not realize it was a result of the algorithm itself. Thank you for the help.

Sign In or Register to comment.