I'm on a BGP kick because someone was asking me questions about BGP last week and I felt like an idiot when I couldn't remember more than two of the criteria BGP uses to make its routing decisions.
So, here's how BGP makes its routing decisions (and the order in which it evaluates criteria):
- Pick the route with the highest "weight" (bgp "weight" is a cisco-specifc thing specified on the local router)
- Pick the route with the highest "local pref"
- Prefer a route that is locally originated vs remote.
- Pick the route with the shortest AS path (You can avoid this by using the "bgp bestpath as-path ignore" command.)
- Pick the route with the lowest origin type. (Interior routing protocols such as OSPF are preferred over routes that originate via EBGP)
- Pick the route with the lowest "MED", Multi Exit Discriminator.
- Prefer EBGP over IBGP.
- Prefer the path with the closest (determined by interior routing protocols) next hop.
- The router determines if anything MultiPath-related needs to happen.
- If we've gotten to this point and still have multiple choices, prefer the oldest route. This helps prevent route flapping.
- Prefer the route from the peer with the lowest Router ID. This is sort of like how ospf picks a designated router by "router ID". For BGP, the router ID is the highest IP address on the router, preferably loopback addresses. You can avoid IP address tweaking by manually setting the router ID with the command "bgp router-is".
- If you're running an environment with route reflector(s), prefer the shortest cluster list among multiple paths that go to the same originator/router-id.
- If not, just pick the path with the lowest neighbor IP address.
Then, RELEASE THE PACKET! (It helps to imagine the TUBEZ of the internet being full of tiny little kraken. Or maybe that's just me.)
Meanwhile, over on the unsurprising gender side of things:
On the Internet, no one knows you're a dog. But if you're a woman, what you wear can change people's perception of your skills, at least for musicians.