BGP Route Selection Question

hitmenhitmen Banned Posts: 133
How BGP selects the best route to put in the routing table

Step 1: Lowest Weight
Step 2: Lowest Local Preference
Step 3: Local Router ???
Step 4: Shortest ASN Path
Step 5: Origin (IGP < EGP < incomplete) ???
Step 6: Highest MED
Step 7: Prefer Ebgp over Ibgp learned path ???
Step 8: IGP Shortest Route
Step 9: Oldest route in routing table
Step 10: Lowest neighbor rid
Step 11: Lowest neighbor ip address

My question is about step 3, 5 and 7.

Q1) Step 3 states that preference comes from local routers. However, I thought that all routers in the same AS are local routers? I dont understand.

Q2) Step 5 states that IGP paths are preferred over EGP paths. However, step 7 states that EBGP is preferred over IBGP path. Dont they contradict each other?

Comments

  • fredrikjjfredrikjj Member Posts: 879
    Step 3: Locally Injected

    The router prefers a prefix that the router itself has originated into BGP via the network command, redistribution (network command is preferred if you do both that and redistribution) or aggregate-address (least preferred). If you look at the BGP table these prefixes will get the "sourced" tag. The idea is probably that if you receive a prefix that you have injected, it's from another BGP speaker that also injects it, and you probably want the one you are injecting yourself locally to be preferred.

    Another reason why a router may receive a prefix it has injected is if there's a routing information loop. In that case, step 3 should prevent the router from preferring that prefix and propagating it to neighbors, unless the local preference or weight overrides it. Because local preference overrides locally injected (step 2 vs. step 3), you could get routing loops (or more likely suboptimal routing) if a prefix is looped and you set the local preference on incoming prefixes. To prevent this, weight is set to 32,768 on locally injected. Because weight is automatically set to 32,768, step 3 in the best path selection process will never come into play unless you manually reset the weight in order to make a step 3 comparison between the locally injected prefix and the same one learned from a peer.

    Step 5: Origin

    This one makes more sense if you stop reading anything into the attribute values (igp,incomplete,egp) and simple think of them as 1,2,3 with 1 being preferred over 2 and 2 being preferred over 3. If the best path selection gets to this step (i.e. all other steps have been draws) the prefixes are ranked according to the value of their origin attribute. It really has little to do with how they are actually originated into BGP since this attribute can be changed at will. However, methods used to inject prefixes into BGP have different default origin values. The network command defaults to IGP, but it will be IGP even if it's installed as a static route in the routing table when you inject it. Redistribution defaults to incomplete. EGP isn't used anymore (it was the protocol BGP replaced) so it isn't set as an origin value by any method, but it can be set manually by a hidden command. Say that you're in the ccie lab or something and there are 3 paths to a prefix and they want you to make them preferred in a certain order, but a ton of restrictions are introduced that forces you to set the origin attribute. In that case, you could use the egp value.

    Step 7: eBGP > iBGP

    If you are learning something through eBGP you have a relationship with another AS. By default, it's likely that it's better to leave your own AS right at that edge router rather than using an iBGP path to get to another edge router that has also learned it via eBGP.
  • MrBrianMrBrian Member Posts: 520
    By the way for your #1 and #2 it's Highest weight and Highest local pref.
    Currently reading: Internet Routing Architectures by Halabi
  • bharvey92bharvey92 Member Posts: 420 ■■■□□□□□□□
    The way I found it easy to remember was;

    Step 3: Locally Originated

    Step 5: I, E and ?

    Step 7: EBGP over IBGP

    I also think that you find your own best technique to remember this order depending on your study materials. For example I used Chris Bryant Kindle book + Video series and the way he explained it made it easier for that list to sink in!
    2018 Goal: CCIE Written [ ]
Sign In or Register to comment.