← Back to Part 1 Modules
PART 1 · BASIC BGP THEORY · MODULE H

Module H – BGP Best Path Selection

Lesson content presented from the approved Part 1 master documentation.

Module H – BGP Best Path Selection

A BGP router may receive multiple paths for the same destination prefix. Best-path selection evaluates candidate paths according to an ordered decision process. The exact sequence and tie-breakers can vary by vendor, platform, software release and configuration.

Common Cisco IOS/IOS-XE decision sequence

  • Highest Weight (Cisco-specific and local to the router).
  • Highest LOCAL_PREF.
  • Locally originated route, under the applicable comparison rules.
  • Shortest AS_PATH.
  • Lowest ORIGIN code: IGP, then EGP, then INCOMPLETE.
  • Lowest MED, when the applicable comparison rules permit comparison.
  • eBGP-learned path over iBGP-learned path, when earlier criteria tie.
  • Lowest IGP metric to reach the NEXT_HOP (hot-potato routing).
  • Additional platform/configuration-dependent tie-breakers, which can include path age, router ID, cluster-list length and neighbour address.
  • Implementation note This is a common Cisco teaching sequence, not a universal exhaustive algorithm. Validate the target device's documentation and configuration before treating a tie-breaker as a test oracle.

    Weight

    Weight is Cisco-specific, local to the router and not advertised to BGP peers. Higher Weight is preferred.

    router bgp 65001
     neighbor 11.1.1.2 weight 300
    !
    ! Alternative using a route map
    route-map SET-WEIGHT permit 10
     set weight 300

    Worked comparison

    PathLOCAL_PREFAS_PATHMEDResult
    A20065002 65003 65004100Wins over B if earlier criteria tie because LOCAL_PREF is higher.
    B1006500550Shorter AS_PATH and lower MED do not override Path A's higher LOCAL_PREF.

    Multipath

    BGP normally selects one best path, but configured multipath can install multiple eligible paths for forwarding. Eligibility and equivalence requirements depend on the platform and feature configuration.

    router bgp 65001
     maximum-paths 2
    !
    show ip bgp <prefix>
    show ip route <prefix>
    show ip cef <destination>

    BGP table, RIB and forwarding plane

    ComponentMeaning
    BGP tableContains BGP paths received and evaluated, including non-best paths where retained.
    RIB / IP routing tableContains routes selected for installation by the routing system.
    CEF / forwarding tableContains forwarding information used by the data plane.

    Troubleshooting workflow

  • Confirm neighbour state with show ip bgp summary.
  • Inspect all paths for the prefix with show ip bgp <prefix>.
  • Check validity and next-hop reachability.
  • Compare attributes in the correct platform-specific order.
  • Inspect route maps, filters, MED comparison and multipath settings.
  • Check the IP routing table and forwarding table.
  • Validate actual traffic forwarding and record evidence.
  • Useful commands

    show ip bgp
    show ip bgp <prefix>
    show ip bgp summary
    show ip route <prefix>
    show ip cef <destination>
    show running-config | section router bgp

    Senior QA test ideas

  • Change Weight and verify Cisco local best-path change.
  • Compare different LOCAL_PREF values.
  • Compare different AS_PATH lengths with earlier attributes equal.
  • Compare ORIGIN and MED where their comparisons are reached.
  • Compare eBGP and iBGP paths when earlier criteria tie.
  • Change IGP cost to next hop and observe hot-potato path selection.
  • Enable multipath and verify multiple eligible next hops in the RIB/forwarding table.
  • Withdraw the selected best path and verify reevaluation and failover.
  • Verify a BGP route that is not installed in the RIB and determine why.
  • Student Knowledge Assessment – Module H

    Q1. What is the primary purpose of BGP best-path selection?

    A. Establish TCP sessions

    B. Select a preferred route among candidate paths

    C. Assign IP addresses

    D. Discover neighbours

    Correct answer: B. Select a preferred route among candidate paths Explanation: BGP evaluates candidate paths and selects a preferred path.

    Q2. Which attribute is Cisco-specific and locally significant?

    A. AS_PATH

    B. MED

    C. Weight

    D. ORIGIN

    Correct answer: C. Weight Explanation: Weight is Cisco-specific and is not advertised to BGP neighbours.

    Q3. Which Weight value is preferred?

    A. 100

    B. 200

    C. 50

    D. Higher value

    Correct answer: D. Higher value Explanation: The highest Weight is preferred.

    Q4. Which LOCAL_PREF value is preferred?

    A. 50

    B. 100

    C. 200

    D. Lowest value

    Correct answer: C. 200 Explanation: Higher LOCAL_PREF is preferred.

    Q5. Path A has LOCAL_PREF 200 and AS_PATH length 3. Path B has LOCAL_PREF 100 and AS_PATH length 1. Which wins?

    A. Path A

    B. Path B

    C. Both always win

    D. Neither

    Correct answer: A. Path A Explanation: LOCAL_PREF is evaluated before AS_PATH; Path A wins.

    Q6. If earlier attributes tie, which AS_PATH is generally preferred?

    A. Longer

    B. Shorter

    C. More communities

    D. Higher MED

    Correct answer: B. Shorter Explanation: A shorter AS_PATH is generally preferred.

    Q7. Which ORIGIN type is preferred?

    A. INCOMPLETE

    B. EGP

    C. IGP

    D. All equal

    Correct answer: C. IGP Explanation: IGP has the lowest ORIGIN code and is preferred.

    Q8. Which MED value is normally preferred when compared?

    A. 200

    B. 150

    C. 100

    D. 50

    Correct answer: D. 50 Explanation: Lower MED is preferred when MED comparison applies.

    Q9. When earlier criteria tie, which route type is generally preferred by Cisco?

    A. iBGP

    B. eBGP

    C. Static

    D. OSPF

    Correct answer: B. eBGP Explanation: Cisco generally prefers eBGP over iBGP at this stage.

    Q10. What is hot-potato routing?

    A. Highest AS_PATH

    B. Lowest IGP cost to next hop

    C. Highest MED

    D. Highest Weight

    Correct answer: B. Lowest IGP cost to next hop Explanation: Hot-potato routing prefers the closest exit based on internal IGP cost.

    Q11. What is BGP Multipath?

    A. Multiple TCP sessions to one peer

    B. Installing multiple eligible paths for a prefix

    C. Increasing AS_PATH

    D. Disabling best-path

    Correct answer: B. Installing multiple eligible paths for a prefix Explanation: Multipath can install multiple eligible paths for forwarding.

    Q12. Which command displays BGP candidate paths and best-path indicators?

    A. show ip interface brief

    B. show ip bgp

    C. show version

    D. show arp

    Correct answer: B. show ip bgp
    Explanation: show ip bgp displays BGP routes and best-path indicators.

    Q13. A route is in BGP table but absent from RIB. What should you check?

    A. Hostname

    B. Next-hop reachability, best path and RIB installation conditions

    C. NTP

    D. Interface description

    Correct answer: B. Next-hop reachability, best path and RIB installation conditions Explanation: Check validity, best-path status, next-hop reachability and RIB selection.

    Q14. What normally happens if the selected best path is withdrawn?

    A. BGP always restarts

    B. Another eligible path may become best

    C. All peers are removed

    D. It becomes static

    Correct answer: B. Another eligible path may become best Explanation: BGP reevaluates remaining eligible paths.

    Q15. Which statement about Weight is correct?

    A. Standard attribute advertised to all peers

    B. Lower is preferred

    C. Cisco-specific and local to router

    D. Replaces AS_PATH

    Correct answer: C. Cisco-specific and local to router Explanation: Weight is local to a Cisco router and is not propagated to peers.

    Appendix 1 – Core CLI Quick Reference

    CommandUse
    show ip bgp summaryPeer state and prefix count summary.
    show ip bgpBGP table, candidate paths and best-path indicators.
    show ip bgp <prefix>Inspect attributes and candidate paths for a prefix.
    show ip bgp neighborsNeighbour details, capabilities, timers and counters.
    show ip route bgpRoutes learned through BGP and installed in the RIB.
    show ip route <prefix>Selected route and route source.
    show ip cef <destination>Forwarding lookup.
    show running-config | section router bgpBGP configuration section.
    show tcp briefTCP connection information, useful for port 179 checks.
    show loggingReview BGP state changes and error messages.

    Appendix 2 – QA Evidence Record Template

    FieldRecord
    Test ID
    Module / feature
    Device / software version
    Topology / peer details
    Preconditions
    Configuration applied
    Test steps
    Expected result
    Actual result
    CLI / packet capture evidence
    Pass / Fail
    Defect / observation
    Tester / date

    Appendix 3 – Technical Accuracy Notes

  • BGP Established confirms the peer session, not that all expected routes are received, selected, installed or forwarding.
  • show ip bgp summary commonly displays a numeric prefix count in the State/PfxRcd column when the peer is Established; textual state values indicate a non-established state.
  • The TCP server listens on port 179; the client side commonly uses an ephemeral source port. Simultaneous connection attempts and collision handling can affect which TCP connection is retained.
  • The negotiated Hold Time is based on the lower non-zero advertised value; zero disables the hold timer. Confirm implementation behaviour and configured timers on the device.
  • LOCAL_PREF is normally propagated within an AS via iBGP and is not normally sent to eBGP peers. Weight is Cisco-specific and local.
  • MED comparison across different neighbouring ASes may be disabled by default; check platform configuration such as Cisco bgp always-compare-med.
  • Route-selection tie-breakers and multipath eligibility vary by implementation and configuration. Use vendor documentation for strict QA expected results.
  • Private ASN ranges and special-use assignments should be checked against current IANA/RIR registries for production use.
  • Illustrative lab addressing and configuration must be checked against the live EVE-NG topology before use. Capture actual lab outputs separately.
  • Part 1 Completion Record

    Modules A–H form the complete Basic BGP Theory learning sequence for SP Networking Academy. The next learning track can extend into Advanced BGP Theory, followed by interview preparation and practical lab exercises.

    ModuleTopicStatus
    ABGP FundamentalsApproved
    BAutonomous Systems and ASN ArchitectureApproved
    CeBGP and iBGPApproved
    DBGP Neighbour RelationshipsApproved
    EBGP Message TypesApproved
    FBGP Finite State MachineApproved
    GBGP Path AttributesApproved
    HBGP Best Path SelectionApproved
    Source and assessment note

    Technical explanations, tables, examples, QA scenarios and assessments are presented from the approved Part 1 master documentation. Verify illustrative CLI syntax against the target router platform and software release before lab or production use.