BGP Path Attributes
BGP uses path attributes to choose the best route, express routing policy, influence inbound and outbound traffic, and carry routing information between autonomous systems.
Common Path Attributes
- AS_PATH: List of AS numbers through which the route has passed. Shorter AS_PATH is preferred.
- NEXT_HOP: IP address of the next-hop router to reach the destination.
- LOCAL_PREF: Indicates the preferred exit point from the local AS. Higher LOCAL_PREF is preferred.
- MED (Multi-Exit Discriminator): Suggests to external AS how to enter the local AS. Lower MED is preferred.
- ORIGIN: Indicates how the route was learned (IGP, EGP, Incomplete).
Path Attribute Categories
BGP attributes are grouped by whether every BGP router must understand them and whether they can be passed between autonomous systems. Well-known mandatory attributes, such as AS_PATH, NEXT_HOP, and ORIGIN, must exist in every BGP update. Well-known discretionary attributes are recognized by all BGP routers but may not appear in every update. Optional transitive attributes can be passed along even if a router does not fully understand them, while optional nontransitive attributes are not advertised beyond the local AS boundary.
Understanding these categories matters during troubleshooting. If a mandatory attribute is missing, the route is invalid. If an optional policy attribute is missing, the route may still be accepted, but traffic engineering may not work as expected.
How Attributes Influence Best Path
The exact best-path order can vary by platform and configuration, but common Cisco logic starts with locally significant preferences such as weight, then LOCAL_PREF, locally originated routes, AS_PATH length, ORIGIN type, MED, eBGP over iBGP, IGP metric to the next hop, and later tie-breakers. This order explains why changing one attribute may appear to have no effect if a higher-priority attribute already decided the route.
For outbound traffic from your AS, LOCAL_PREF is usually the cleanest policy tool because it is distributed inside your AS and tells internal routers which exit should be preferred. For inbound traffic from another AS, AS_PATH prepending, MED, and provider communities are more common, though the remote AS ultimately decides how to treat your advertisements.
Key Attributes in Real Designs
- Weight: Cisco-local and not advertised. It is useful for a single router preference but not for AS-wide policy.
- LOCAL_PREF: Advertised within the local AS. Higher values are preferred and are commonly used to choose the outbound exit.
- AS_PATH: Prevents loops and influences route selection. Shorter paths are usually preferred, and prepending can make a path less attractive.
- NEXT_HOP: Must be reachable. Many BGP routes fail to install because the next hop is unresolved in the routing table.
- MED: Suggests an inbound entry point to a neighboring AS. Lower MED is preferred, but comparison rules depend on configuration and neighboring AS behavior.
- Communities: Tags that make policy scalable. Providers often use communities to let customers request prepending, local preference changes, or selective advertisement.
Policy Example
If a company has two ISP links and wants outbound traffic to prefer ISP-A, set a higher LOCAL_PREF on routes learned from ISP-A. If the company wants inbound traffic to prefer ISP-A, it may advertise the prefix normally to ISP-A and prepend its AS number when advertising the same prefix to ISP-B. The first policy affects local outbound choice; the second only suggests a choice to external networks.
route-map PREFER-ISP-A permit 10
set local-preference 200
router bgp 65010
neighbor 203.0.113.1 route-map PREFER-ISP-A in
Troubleshooting Checklist
- Confirm the route exists in the BGP table with
show ip bgp. - Check the selected best path and compare attributes against alternate paths.
- Verify NEXT_HOP reachability in the routing table.
- Review route-maps, prefix-lists, AS-path access lists, and community filters.
- Remember that inbound traffic engineering depends on how upstream networks interpret your advertisements.
Related BGP Resources
Change Attributes at the Correct Scope
Attributes influence different parts of the routing domain. Cisco weight is local to one router. Local preference is shared inside the autonomous system and is commonly used to select the preferred outbound exit. AS-path prepending influences how some external networks view a route, while MED suggests an inbound entry point to a neighboring autonomous system but is not guaranteed to override that neighbor’s policy.
Change one attribute at a time and record every available path before applying policy. Then verify the route-map match, attribute value, selected best path, next-hop reachability and actual forwarding path. Remember that a shorter AS path cannot help if the next hop is unreachable, and an advertised attribute does not guarantee the remote network will honor it.
Use show ip bgp and neighbor-specific advertised-route output to confirm results. Continue with routing policy design, BGP configuration, and troubleshooting.