What are BGP path attributes, and how are they classified?
Show the answer
Say this first
Attributes are the properties carried with every route; BGP uses them for loop prevention and best path selection. There are four classes. Well-known mandatory: ORIGIN, AS_PATH and NEXT_HOP, present in every UPDATE. Well-known discretionary: LOCAL_PREF and ATOMIC_AGGREGATE. Optional transitive: COMMUNITY and AGGREGATOR, passed on even by routers that do not understand them. Optional non-transitive: MED, ORIGINATOR_ID and CLUSTER_LIST, dropped if not understood. Cisco's weight is not an attribute at all: it never leaves the router.
Go deeper
| Attribute | Type code | Class | What it does |
|---|---|---|---|
| ORIGIN | 1 | Well-known mandatory | How the route entered BGP: IGP (i), EGP (e), incomplete (?) |
| AS_PATH | 2 | Well-known mandatory | ASes crossed; loop prevention and path length |
| NEXT_HOP | 3 | Well-known mandatory | Address to forward to |
| MULTI_EXIT_DISC (MED) | 4 | Optional non-transitive | Hint to a neighbor AS about which entry link to use |
| LOCAL_PREF | 5 | Well-known discretionary | Exit preference shared inside the AS |
| ATOMIC_AGGREGATE | 6 | Well-known discretionary | Flags that aggregation lost path detail |
| AGGREGATOR | 7 | Optional transitive | AS and router ID that built the aggregate |
| COMMUNITY | 8 | Optional transitive | Tags for policy (RFC 1997) |
| ORIGINATOR_ID | 9 | Optional non-transitive | Set by route reflectors |
| CLUSTER_LIST | 10 | Optional non-transitive | Set by route reflectors |
| MP_REACH_NLRI, MP_UNREACH_NLRI | 14, 15 | Optional non-transitive | Carry IPv6, VPNv4, EVPN and other families |
| EXTENDED COMMUNITIES | 16 | Optional transitive | Route targets, site of origin |
| LARGE_COMMUNITY | 32 | Optional transitive | 12-byte communities for 4-byte ASNs (RFC 8092) |
What the classes mean in practice
- Well-known: every BGP implementation must recognise them.
- Mandatory: every UPDATE that advertises a prefix must carry them. LOCAL_PREF is sent on iBGP only.
- Transitive: an optional attribute the router does not understand is still passed along, with the Partial bit set. That is how communities spread before every router supported them.
- Non-transitive: an unknown optional non-transitive attribute is dropped.
They will ask next
What does ATOMIC_AGGREGATE tell you?
That a router aggregated routes and did not keep the full AS path information (no
as-set). Downstream routers know the path shown is not the complete list of ASes behind the prefix.Is LOCAL_PREF ever sent to an eBGP peer?
No, except between sub-ASes of a confederation. It is how one AS agrees on its own exits.
Traps
- Listing weight as a BGP attribute. It is a Cisco-local value that is never advertised.
- Calling MED transitive. It crosses one AS boundary and stops.