Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

BGP AS_PATH & Community Field Reference

Direct answer

AS_PATH is encoded as segments (AS_SEQUENCE or AS_SET) of AS numbers. Communities are 32-bit tags written as AS:value, and large communities are 96-bit tags written as AS:value:value so they fit 4-byte AS numbers.

When to use this

Use it when reading or filtering BGP routes by AS path or community, or when prepending and tagging do not take effect.

First 30 seconds

1. AS_PATH (well-known mandatory) lists ASes the route crossed; shorter wins in best path.

2. Loop prevention: own AS in path → reject.

3. Prepending lengthens paths for inbound TE.

4. Communities (optional transitive) tag routes for policy; well-known: no-export, no-advertise, local-AS.

5. send-community must be configured to pass them.

Operational verification

UPDATE → AS_PATH/COMMUNITY attributes → policy match → best path

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Protocol standard + deployed implementation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformProtocol standard
Key commandshow ip bgp 203.0.113.0/24
Scope / prerequisiteUse it when reading or filtering BGP routes by AS path or community, or when prepending and tagging do not take effect.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Packet capture verification and known-good sequence Verify boundary
show ip bgp 203.0.113.0/24
show ip bgp regexp _65010$
show ip bgp community 65000:100
show ip bgp neighbors 192.0.2.2 advertised-routes

The prefix detail shows the AS path on the first line of each path and a Community: line when the route carries any. The regular expression _65010$ lists routes originated by AS 65010; ^65010_ lists routes received directly from it. The community form lists routes with a given tag.

Known-good: the path begins with the neighbour's AS and ends with the expected origin AS, and the communities set by policy are present.

Step 2 Failure signatures and packet-level troubleshooting Narrow the fault
  • A route from a neighbour is rejected. Its AS path contains the local AS — expected loop prevention, or two sites using the same AS number.
  • Prepending shows on the wrong routes. The route map is applied to the wrong neighbour or in the wrong direction; prepending belongs outbound.
  • A longer path is preferred. LOCAL_PREF or weight is compared before path length.
  • A path with a set in braces counts shorter than it looks. A set counts as one.
  • Communities are missing at the neighbour. send-community is not configured towards it.
  • Communities appear as large decimal numbers. ip bgp-community new-format is not configured.
  • A route is not advertised onwards. It carries no-export or no-advertise.
Step 3 When the problem is really fixed Narrow the fault
  • The AS path of the route is the intended one, including any prepending, as seen on the receiving router.
  • The intended communities are present where they are matched.
  • The path chosen as best is the intended one.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Command lookup Jump straight to Cisco syntax
Key checks
  • show bgp ipv4 unicast <prefix> — AS path and communities
  • show ip bgp regexp <regex> — match AS paths
  • show bgp ipv4 unicast community <comm> — match community
ReferenceWhat it is1 section · depth on demand

Mechanics & mental model

Two BGP attributes that policy relies on most. AS_PATH lists the autonomous systems a route has passed through. COMMUNITIES is a list of tags attached to the route. This topic describes how each is stored in the UPDATE and how to read it.

ReferenceWhy it matters1 section · depth on demand

Why it matters operationally

The AS path is used three ways — to prevent loops, to compare routes by length, and as something to filter on — and the direction it is read in matters for all three. Communities look like arbitrary numbers until the encoding is known.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

AS_PATH and COMMUNITIES as policy tools

AS_PATH records where a route has been, and communities record what should be done with it. RFC 4271 builds AS_PATH from segments, either ordered AS_SEQUENCE or unordered AS_SET. It is used for loop prevention, because a router rejects routes containing its own AS, and in best-path selection. RFC 1997 defines COMMUNITIES (type 8, optional transitive) as a list of 4-byte values. These are written AS:value by convention, with the ranges 0x00000000–0x0000FFFF and 0xFFFF0000–0xFFFFFFFF reserved.

Well-known communities (RFC 1997)

CommunityValueMeaning
NO_EXPORT0xFFFFFF01Don't advertise outside the AS (or the confederation)
NO_ADVERTISE0xFFFFFF02Don't advertise to any BGP peer
NO_EXPORT_SUBCONFED0xFFFFFF03Don't advertise to eBGP peers, including confederation members

Typical community schemes

PurposeExample
Tag where a route was learned65010:100 = customer, 65010:200 = peer, 65010:300 = transit
Ask the provider to prepend64500:1003 = prepend three times towards a given peer
Ask the provider to lower preference64500:80 = LOCAL_PREF 80
Blackhole65535:666 (BLACKHOLE, RFC 7999)

AS_PATH manipulation and matching

ToolUse
PrependingMake a path longer to discourage inbound traffic
ip as-path access-list with regular expressionsMatch paths, for example ^64500_ = learned from 64500 directly
bgp maxas-limitDrop unreasonably long paths
AS_SET in aggregatesKeep loop prevention for summarised routes
R1(config)# ip as-path access-list 10 permit ^64500_[0-9]+$
R1(config)# ip community-list standard CUSTOMER permit 65010:100
R1(config)# route-map TO-TRANSIT permit 10
R1(config-route-map)# match community CUSTOMER
R1(config-route-map)# set as-path prepend 65010 65010
R1(config)# router bgp 65010
R1(config-router-af)# neighbor 203.0.113.2 send-community both
R1# show bgp ipv4 unicast community 65010:100 | include Total|Network
R1# show bgp ipv4 unicast regexp ^64500_
R1# show bgp ipv4 unicast 192.0.2.0/24 | include Community|64500

Aggregation and communities (RFC 1997)

An aggregate that doesn't carry ATOMIC_AGGREGATE should carry the communities of all the routes it summarises, so that policy tags aren't lost.

Cisco IOS doesn't send communities to neighbours by default. Without send-community, a well-planned community scheme silently does nothing.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Wire format, fields and state ownership

AS_PATH (type code 2, well-known mandatory). The value is one or more segments. Each segment has a type, a count and that many AS numbers.

Segment typeMeaningCounts as
AS_SEQUENCE (2)An ordered list of ASesOne per AS
AS_SET (1)An unordered set, produced by aggregation with as-setOne in total

In show ip bgp the path reads from left to right as nearest to farthest: the leftmost AS is the neighbour the route came from, the rightmost is the AS that originated it. A set is shown in braces.

A router adds its own AS at the left when it sends the route to an eBGP neighbour, and not when it sends to an iBGP neighbour. A route originated inside the AS therefore has an empty path until it leaves. Prepending adds the own AS several times to make the path longer. A router that finds its own AS anywhere in a received path rejects the route.

AS numbers are four bytes each between routers that both support four-byte AS numbers.

COMMUNITIES (type code 8, optional transitive). The value is simply a list of four-byte numbers. By convention the first two bytes are an AS number and the last two a value, written 65000:100. Three reserved values have fixed meanings:

ValueNameEffect
0xFFFFFF01no-exportDo not advertise to eBGP neighbours
0xFFFFFF02no-advertiseDo not advertise to any neighbour
0xFFFFFF03local-ASDo not advertise outside the local sub-AS

Extended communities (type 16, eight bytes each) and large communities (type 32, twelve bytes each) are separate attributes.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docProtocol standard + deployed implementation RFC 4271

Authoritative/upstream documentation reviewed for bounded claims in Network & Protocols → BGP AS_PATH & Community Field Reference. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.rfc-editor.org/rfc/rfc4271.html · confidence 94%
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
as_path segmentbgp community decoderlarge community
Embedded reference data

Quick lookup tables

BGP AS_PATH & Community Field Reference packet-level operational reference

Direction-aware field interpretation, suspicious signatures and the next protocol/forwarding proof boundary.

Wire boundaryKnown-good for BGP AS_PATH & Community Field ReferenceSuspicious signatureNext proof
Message identityCorrect peer/direction/type and coherent lengthsWrong sender, type, length or packet phasePacket sequence + peer state
Field semanticspath-attribute flags/type/length; AS_PATH segment type/count/ASN sequence; standard Community values; Large Community Global Administrator/Local Data parts where present match intended protocol stateAS_PATH prepends appear on the wrong neighbor or direction, four-octet ASN display/encoding is misread, community propagation is absent because send-community behavior is missing, a route-map matches the wrong community set, Large Community and standard-community namespaces are confused, or attributes arrive correctly but higher-priority best-path inputs dominateDecode exact fields on both sides
State consequencePacket produces expected protocol/route transitionWire looks healthy but local state disagreesFSM/LSDB/BGP table → RIB/FIB
ClosureOriginal workload succeeds for the explained reasonSession/adjacency recovered only transientlyRepeat capture + regression/failover test
Embedded quick reference

Operational notes

Former standalone Cheat Sheet content now lives directly inside the Topic where it belongs.

BGP AS_PATH & Communities

Segment/community decode.

30-second lookup

  • Open Packet Field Explorer for field-level metadata.
  • Use Packet Decoders for bit/flag values where relevant.
  • Use Paste Output / Structured Parser for CLI evidence.
  • Use Packet Filters to prove the wire boundary.

Evidence rule

A decoded field proves what is present in that packet/output at that moment. Continue through the verification chain before concluding end-to-end behavior.

Confirmation

Confirm action

Continue?