Path preference (attributes and best-path)

1.11 Troubleshoot BGP (Internal and External; unicast and VRF-Lite)

📘CCNP Enterprise – ENARSI (300-410)


What is Path Preference in BGP?

In BGP, a router often learns multiple paths to reach the same destination network from different neighbors.

👉 Path preference means how BGP decides which one of those paths is the best and should be used.

Only one best path is selected and installed into:

  • The routing table
  • And then used for packet forwarding

This decision is based on BGP attributes and the BGP best-path selection algorithm.


Why Path Preference is Important

In enterprise and service-provider networks:

  • Multiple links exist for redundancy
  • Traffic must follow specific policies
  • Some links are preferred, others are backup

BGP path preference allows administrators to:

  • Control outbound traffic
  • Influence inbound traffic
  • Ensure stable and predictable routing

What are BGP Attributes?

BGP attributes are values attached to routes that describe:

  • Where the route came from
  • How good or bad the route is
  • Which path should be preferred

BGP uses these attributes to compare paths and choose the best one.


Categories of BGP Attributes (Exam-Relevant)

CategoryDescription
Well-known mandatoryMust exist in every BGP route
Well-known discretionaryRecognized by all BGP routers but optional
Optional transitivePassed to other routers even if not recognized
Optional non-transitiveNot passed to other routers

⚠️ For ENARSI, focus on behavior, not memorization of categories


Key BGP Attributes Used for Path Preference

These are the most important attributes for the exam.


1. Weight (Cisco-Specific)

  • Highest priority attribute
  • Only local to the router
  • Not advertised to neighbors
  • Higher weight = better path

Default values:

  • Locally originated routes → 32768
  • All other routes → 0

Use case:

  • Prefer one ISP link over another on a single router

⚠️ Weight is checked first


2. Local Preference (LOCAL_PREF)

  • Used inside one AS
  • Advertised to iBGP neighbors
  • Higher value is preferred
  • Default value → 100

Use case:

  • Control outbound traffic from the AS
  • Decide which exit point the AS should use

Example IT concept:

  • Enterprise prefers its primary internet gateway over backup gateway

3. Locally Originated Routes

BGP prefers routes that were:

  • Created using network command
  • Redistributed from IGP
  • Generated using aggregate-address

Reason:

  • Routes created locally are more trusted

4. AS Path Length

  • Shows how many Autonomous Systems the route passed through
  • Shorter AS path = better path

Use case:

  • Avoid unnecessary transit through many networks
  • Helps prevent routing loops

5. Origin Attribute

Indicates how the route entered BGP.

Origin TypePreference
IGPBest
EGPMedium
IncompleteWorst

Notes:

  • IGP does not mean OSPF or EIGRP
  • It means “originated via network command”

6. MED (Multi-Exit Discriminator)

  • Used between different ASs
  • Lower MED = better path
  • Optional and non-transitive
  • Default is 0

Use case:

  • Tell a neighboring AS which entry point they should use

Important rules:

  • MED is compared only if paths come from the same AS
  • Can be overridden using configuration

7. eBGP vs iBGP

  • eBGP paths are preferred over iBGP paths

Reason:

  • External paths usually represent better reachability to outside networks

8. IGP Metric to Next Hop

  • BGP checks how far the next-hop IP is
  • Lower IGP cost is preferred

Important:

  • BGP relies on IGP to reach next-hop
  • Poor IGP design can affect BGP decisions

9. Oldest Path

  • BGP prefers the oldest stable path
  • Helps prevent route flapping

10. Router ID

  • Used as a tie-breaker
  • Lower router ID wins

11. Neighbor IP Address

  • Final tie-breaker
  • Lower neighbor IP is selected

BGP Best-Path Selection Order (EXAM CRITICAL)

BGP compares paths in this exact order:

  1. Highest Weight
  2. Highest Local Preference
  3. Locally Originated
  4. Shortest AS Path
  5. Lowest Origin Type
  6. Lowest MED
  7. eBGP over iBGP
  8. Lowest IGP Metric to Next Hop
  9. Oldest Path
  10. Lowest Router ID
  11. Lowest Neighbor IP Address

⚠️ The router stops at the first difference it finds


Path Preference in iBGP vs eBGP

FeatureiBGPeBGP
Local PreferenceUsedNot exchanged
WeightLocal onlyLocal only
MEDLess commonCommon
Next-hop behaviorUsually unchangedUpdated by default

Path Preference in VRF-Lite

  • Each VRF has:
    • Its own BGP table
    • Its own best-path calculation
  • Attributes do not cross VRFs
  • Path preference is calculated per VRF

Important for ENARSI:

  • Same prefix in two VRFs can have different best paths

Common Troubleshooting Points (Exam Scenarios)

Issue: Unexpected path selected

Check:

  • Weight and Local Preference
  • AS Path manipulation
  • MED comparison rules
  • IGP reachability of next-hop

Issue: Path not installed in routing table

Possible causes:

  • Next-hop unreachable
  • Path lost best-path selection
  • VRF mismatch

Issue: Load sharing not happening

Reason:

  • BGP installs only one best path by default
  • Multipath must be explicitly enabled

Important Exam Notes

✔ Weight beats everything
✔ Local Preference controls outbound traffic
✔ MED is lower is better
✔ AS Path is shorter is better
✔ BGP always selects one best path unless multipath is configured
✔ Best-path selection is deterministic and ordered


Summary

  • BGP path preference is how BGP chooses the best route
  • It is based on attributes, not bandwidth
  • The best-path algorithm order is critical for ENARSI
  • Understanding why a path wins is more important than memorization
  • Path preference works the same in IPv4, IPv6, iBGP, eBGP, and VRF-Lite, with scope differences
Buy Me a Coffee