7 Replies Latest reply: May 9, 2017 3:08 AM by Ram RSS

    BGP - Routing loops with MED!

    Ram

      Hi,

       

      I've read below statement in one of online e-book.  Can you let me know, how does routing loop happen, if you don't disable this option on entire AS? I couldn't understand what's the relation.

       

      1. If ""bgp always-compare-med"" is enabled, MEDs are compared for all paths. You must disable this option over the entire AS. Otherwise, routing loops can occur.

      -ram

        • 1. Re: BGP - Routing loops with MED!
          Daniel Dib CCIE #37149 CCDE #20160011

          This is a very good summary of how BGP MED works:

           

          Understanding BGP MED and BGP Deterministic MED

          • 2. Re: BGP - Routing loops with MED!
            Ram

            But the article doesn't talk about how routing loops can happen. Infact, I see below quote from the URL you shared and didn't find next article on this topic.

             

            <<<<’ll do a follow up article on how BGP MED can possibly cause an endless convergence loop in certain topologies.>>>>

            • 3. Re: BGP - Routing loops with MED!
              Daniel Dib CCIE #37149 CCDE #20160011

              One problem could be if some routers have "always-compare-med" and others don't so that different best paths are selected. Another issue is that by default the best path selection algorithm is not deterministic in which route gets selected which the best. It depends on the age of routes. So if different routers have different age of routes then once again selection can be different for different routers.

              • 4. Re: BGP - Routing loops with MED!
                Anthony

                It's definitely not a trivial thing to build a topology wherein a routing loop occurs due to a mismatch in the "bgp always-compare-med" command.  As Daniel stated, problems can arise when one router's view of the "best path" is different than another router's view of the best path within the same autonomous system.  Getting a topology into just the right set of circumstances is the trick.  It has been my experience that creating a routing loop without leaning on static routing, filtering routes or messing around with default administrative distances is not the easiest thing in the world and usually requires a set of circumstances to arise (such as timings, order-of-operation, age of routes, etc).  There are enough people on this forum who would have gleefully mashed away at this to have already produced a demonstration if this were super easy to achieve given that you posted it over 36 hours ago.  The fact that the ine.com blog didn't follow up on the promise to explore it further (or at least it appears that way) then that's probably another clue that it's one of those things that just not super simple to reproduce at will.  I have this feeling that it's going to come down to a scenario where there's a partial iBGP mesh in the AS along with mismatched "alway-compare-med" settings.

                • 5. Re: BGP - Routing loops with MED!
                  Ram

                  Thanks Daniel. I understand the routes chosen will be different if we don't have similar configuration of MED on all routers. But my confusion is, how would it create routing loops?

                   

                  Or as Anthony mentioned, is it really tough to image a topology with different MED configuration, causing routing loops? That's why everyone says (probably they saw) but not able to explain how it causes?

                  • 6. Re: BGP - Routing loops with MED!
                    Daniel Dib CCIE #37149 CCDE #20160011

                    I've discussed the topic with very knowledgable people and we can't think of a simple scenario where things would loop. It would probably involve routers having different configurations, several exits out from the AS and a certain timing of events. So I'm not sure where this idea came from that it does cause loops. Another interesting concept is BGP wedgies which might have some things in common.

                    • 7. Re: BGP - Routing loops with MED!
                      Ram

                      Ok Thanks Daniel for discussing with others and commenting.