Esc
Type to search posts, tags, and more...
Skip to content

BGP path attributes

The path attributes carried in BGP UPDATE messages — classification, encoding, and per-attribute semantics.

Contents

Attribute classification

Path attributes fall into four categories based on two flag bits:

CategoryRecognitionPropagationExample
Well-known mandatoryAll implementationsAlways forwardedORIGIN, AS_PATH, NEXT_HOP
Well-known discretionaryAll implementationsForwarded if presentLOCAL_PREF, ATOMIC_AGGREGATE
Optional transitiveMay not be recognizedForwarded with Partial bit setAGGREGATOR, COMMUNITIES
Optional non-transitiveMay not be recognizedSilently droppedMULTI_EXIT_DISC

Attribute encoding

Each attribute is a TLV triplet: Attribute Flags (1 octet) + Type Code (1 octet) + Length (1 or 2 octets) + Value.

Flag bitPositionMeaning when set
Optionalbit 0Attribute is optional (not well-known)
Transitivebit 1Optional attribute is passed to peers
Partialbit 2Attribute was not recognized by some AS in the path
Extended Lengthbit 3Length field is 2 octets instead of 1

Attributes within an UPDATE are ordered by Type Code (ascending). A receiver handles out-of-order attributes. Duplicate Type Codes in the same UPDATE are an error.

ORIGIN (Type 1)

Well-known mandatory. Indicates how the route was injected into BGP.

ValueMeaningPreference
0IGP — originated from an interior protocol (network statement)Highest
1EGP — learned via the legacy Exterior Gateway ProtocolMiddle
2INCOMPLETE — redistributed from another sourceLowest

The Decision Process prefers lower ORIGIN values. A route redistributed from OSPF gets INCOMPLETE; a route originated via network or aggregate-address gets IGP.

AS_PATH (Type 2)

Well-known mandatory. Records the sequence of ASes the route has traversed. Provides loop detection — a router rejects routes containing its own ASN.

Segment types

TypeNameMeaning
1AS_SETUnordered set (result of aggregation)
2AS_SEQUENCEOrdered list of ASes traversed

Each segment is encoded as: segment type (1 octet) + count (1 octet, number of AS numbers) + AS numbers (2 octets each, or 4 octets with RFC 6793).

Prepending rules

When originating a route to EBGP: single-element AS_SEQUENCE with own ASN. To IBGP: empty AS_PATH.

An AS_SET counts as path length 1 regardless of how many ASes it contains. RFC 9774 deprecates AS_SET and AS_CONFED_SET — new implementations reject routes containing them.

NEXT_HOP (Type 3)

Well-known mandatory. The IPv4 address of the router to use as next hop toward the advertised destinations.

NEXT_HOP rules

ScenarioNEXT_HOP value
EBGP, directly connectedSender’s interface address facing the peer
EBGP, multihopSender’s session source address (default)
IBGP, externally learnedPreserved from EBGP peer (default)
IBGP, locally originatedInterface through which the network is reachable
next-hop-self configuredSender’s own address regardless of source

The receiving router resolves NEXT_HOP recursively through the routing table to determine the actual forwarding interface. If unresolvable, the route is ineligible for selection.

MULTI_EXIT_DISC (Type 4)

Optional non-transitive. A 4-octet metric used to influence inbound traffic when multiple links connect to the same neighbor AS. Lower is preferred.

Key constraints:

  • Comparable only between routes from the same neighbor AS
  • Received over EBGP, may be propagated over IBGP within the same AS
  • Never propagated to other external ASes
  • Must be removed or evaluated before the Decision Process

LOCAL_PREF (Type 5)

Well-known discretionary. A 4-octet unsigned integer expressing the local AS’s degree of preference for a route. Higher is preferred.

ContextBehavior
Sent to IBGP peerRequired in all UPDATEs
Sent to EBGP peerNever included (except confederations)
Received from EBGPIgnored (except confederations)

LOCAL_PREF is the first discriminator in the Decision Process after policy filtering.

ATOMIC_AGGREGATE (Type 6)

Well-known discretionary. Zero-length attribute. Signals that the originator selected a less-specific route and dropped some AS_PATH information (AS_SET) during aggregation.

A receiver of ATOMIC_AGGREGATE must not deaggregate the prefix into more-specifics. The actual forwarding path may differ from what AS_PATH shows.

AGGREGATOR (Type 7)

Optional transitive. Carries the AS number (2 octets) and BGP Identifier (4 octets) of the router that formed the aggregate. Added during aggregation to preserve attribution.

Attribute summary table

TypeNameCategoryLengthDecision Process role
1ORIGINWK mandatory1 octetTie-break step 2
2AS_PATHWK mandatoryvariableTie-break step 1 (shortest path)
3NEXT_HOPWK mandatory4 octetsResolvability check, IGP cost
4MULTI_EXIT_DISCOpt non-transitive4 octetsTie-break step 3 (same neighbor AS)
5LOCAL_PREFWK discretionary4 octetsPrimary selection (highest wins)
6ATOMIC_AGGREGATEWK discretionary0Informational
7AGGREGATOROpt transitive6 octetsInformational

Sources

Last synthesized: 2026-05-07

AI-assisted synthesis from the RFCs and sources linked above.