Wednesday, December 19, 2018

BGP and routing decisions with multiple routers and ECMP

This is a somewhat abstract scenario, so please excuse the lots of words:

Let's say that I am a service provider with two routers (effectively the reverse view of the common "I have two connections to an ISP that I want to load balance outbound traffic on") connecting back to a neighbor AS with an iBGP link between my pair. ECMP is configured and functions normally and there are no issues I can see with the links. My two routers have multiple uplinks, so traffic can come in to either router (but mostly to, for the sake of example, Router 1 at a 2:1 ratio) but the two links to the "downstream" AS are still relatively equally balanced.

So everything is working fine, and there's no issues. What's bugging me is this - BGP decides what routes to install and installs all relevant routes. The router decides to load balance traffic such that each path is equally saturated (perhaps not perfectly efficiently, but well enough), but how does each router know that a round-robin decision has already been made for a particular packet and that it should forward it to its eBGP neighbor rather than performing the round robin itself and potentially sending a packet back to the router it just came from?

In this simple example, of course it possibly received it directly from a fully resolved possible next hop for the packet's destination (so it COULD assume the decision had already been made), but for a larger network with other routers in between that are not members of the iBGP network (for example, an internal OSPF or IS-IS network connecting the iBGP peers to each other), this isn't guaranteed, and the packet doesn't contain any extra information that I know of that can communicate this. Does load balancing over the two eBGP links still work in this case? Do the iBGP peers know enough about the topology to know when they've received a packet that another iBGP peer already handled? If the path from an upstream iBGP peer HAS to pass through router 1 before getting to router 2, does the upstream router make the decision or Router 1? If it's the upstream router, how does Router 1 know to forward to Router 2 if that was the chosen destination? What about traffic originating from within my AS?

I realize this is a really, REALLY specific set of questions that is a much deeper look into BGP and the actual routing decisions made by a router than nearly anyone would ever get into, but it's bugging me. If anyone has an idea, please help me out here as it's driving me crazy not knowing how it works.



No comments:

Post a Comment