The Four Categories of BGP Path Attributes

BGP path attributes explained: well-known mandatory, well-known discretionary, optional transitive and optional non-transitive

At 04:06 UTC this morning we asked the RouteViews collector at the University of Oregon for the route to 1.1.1.0/24. The best path came through AS 57866, and under the usual Origin IGP, metric 0, localpref 100 line the router printed something less usual: unknown transitive attribute: flag 0xE0 type 0x20 length 0x3C. Type 0x20 is 32, the Large Community attribute standardised in 2017. This router does not implement it, yet it still accepted the route and kept the 60 unknown bytes. That works because of one byte that comes before every attribute. BGP path attributes are the data BGP uses to describe a route and to choose between routes, and their four categories decide what a router must do with an attribute it has never seen. This is part 5 of our 26-part BGP Deep Dive and the overview for the ten attribute articles that follow. It covers the four categories, the flags byte bit by bit, the type codes, the error rules of RFC 4271 and RFC 7606, a GoBGP lab in which we sent known, unknown and broken attributes, and real routes from RouteViews.

TL;DR
  • Four categories: well-known mandatory (ORIGIN, AS_PATH, NEXT_HOP), well-known discretionary (LOCAL_PREF, ATOMIC_AGGREGATE), optional transitive (AGGREGATOR, COMMUNITY) and optional non-transitive (MED, ORIGINATOR_ID, CLUSTER_LIST).[1][2]
  • One flags byte in front of each attribute carries the category: bit 0 Optional, bit 1 Transitive, bit 2 Partial, bit 3 Extended Length. 0x40 = well-known, 0xC0 = optional transitive, 0x80 = optional non-transitive.[1]
  • Unknown attributes: an unknown well-known attribute is an error; an unknown optional transitive one is passed on with the Partial bit set; an unknown optional non-transitive one is quietly dropped.[1]
  • Lab (GoBGP 4.11): r1 dropped MED towards eBGP, replaced an illegal eBGP LOCAL_PREF 500 with 100 towards iBGP, dropped our unknown non-transitive attribute and forwarded the unknown transitive one, but without setting the Partial bit. Five broken UPDATEs never took the session down.[19]
  • Real Internet: on RouteViews 12 of 48 paths carried an attribute the router does not know, Large Community (type 32) or OTC (type 35), shown with flag 0xE0.[17]

What BGP path attributes are and where they live

A BGP UPDATE message has three parts: a list of withdrawn prefixes, a list of path attributes and a list of reachable prefixes (the NLRI). All the prefixes in one UPDATE share the same attributes. That is why the field is called path attributes: they describe the path to the prefixes, not the prefixes themselves.[1] Part 3 of this series decoded the UPDATE message byte by byte; here we look only at the attribute list.

Each attribute is a small type-length-value record: a flags byte, a type code byte, a length of one or two bytes and the value. RFC 4271 asks senders to put the attributes in ascending order of type code. Receivers must accept any order, and the same type may not appear twice in one UPDATE.[1] The receiving router stores the attributes with the route in its Adj-RIB-In and runs its import policy, which may change them. The decision process then compares the attributes of all routes to the same prefix (LOCAL_PREF, AS_PATH length, ORIGIN, MED and so on), and the export policy decides which attributes the next neighbour gets.

Attributes are also what makes BGP extensible. When the IETF needed communities, 4-byte AS numbers, IPv6 and VPN routes, route reflection or EVPN, it did not change the message format. It defined new attributes, and old routers could carry them along without understanding them. The four categories below are what makes that safe.

The four categories of BGP path attributes

BGP path attributes tree: well-known mandatory ORIGIN AS_PATH NEXT_HOP, well-known discretionary LOCAL_PREF ATOMIC_AGGREGATE, optional transitive AGGREGATOR COMMUNITY, optional non-transitive MED ORIGINATOR_ID CLUSTER_LIST
Figure 1. The four categories of BGP path attributes as in Pat's notes and in the classic RFC 1771 / Cisco view. The flags value under each group is the normal value on the wire.

RFC 4271 section 5 starts with exactly this list: well-known mandatory, well-known discretionary, optional transitive and optional non-transitive.[1] The first split is about knowledge. Every BGP implementation must recognise every well-known attribute. Optional attributes may be unknown to a given implementation, and the protocol has rules for that case. The second split is about obligation for well-known attributes (must be present, or may be present) and about propagation for optional ones (pass on, or not).

Well-known mandatory: ORIGIN, AS_PATH, NEXT_HOP

These three must be present in every UPDATE that carries NLRI.[1] ORIGIN (type 1) says how the route entered BGP: IGP, EGP or INCOMPLETE. AS_PATH (type 2) lists the autonomous systems the route has crossed; it is the loop-prevention mechanism and a step of best-path selection. NEXT_HOP (type 3) is the IPv4 address that should be used as the next hop to the prefixes. Because every implementation must understand them, they always use flags 0x40: Optional = 0, Transitive = 1. RFC 4271 requires the Transitive bit to be 1 on all well-known attributes.[1]

There is one modern footnote. For IPv6, VPN and EVPN routes the next hop sits inside MP_REACH_NLRI (type 14), and an UPDATE that carries only MP_REACH_NLRI does not need the classic NEXT_HOP. RFC 7606 notes that RFC 4760 has made NEXT_HOP "effectively discretionary".[3][7]

Well-known discretionary: LOCAL_PREF, ATOMIC_AGGREGATE

Every implementation must understand these, but they do not have to be in every UPDATE. LOCAL_PREF (type 5) is a 4-byte number that tells the other routers of the same AS how much this exit is preferred; the higher value wins.[1] ATOMIC_AGGREGATE (type 6) has no value at all. It is a flag that says the route is an aggregate and that some path information (some AS numbers) may have been lost when the aggregate was built.[1]

LOCAL_PREF has a twist worth knowing for exams and interviews. RFC 1771 (1995) calls it a "well-known discretionary attribute", and Pat's notes and most Cisco training material use that classification.[2] RFC 4271 (2006) calls it just "well-known" and makes the rules stricter: it SHALL be included in all UPDATE messages sent to internal peers and MUST NOT be sent to external peers, except between the member ASes of a confederation.[1] So it is mandatory on iBGP and forbidden on eBGP. If a router receives LOCAL_PREF from an external neighbour anyway, RFC 7606 says to discard the attribute and keep the route.[3] Our lab tests exactly that below.

Optional transitive: AGGREGATOR, COMMUNITY

An implementation does not have to support these. If it does not, it must still accept the route and pass the attribute on to its neighbours, setting the Partial bit.[1] AGGREGATOR (type 7) carries the AS number and the router ID of the router that built an aggregate. COMMUNITIES (type 8, RFC 1997) carries 4-byte tags such as 65003:100 that networks use to signal policy to each other.[5] Transitive behaviour is what lets a community set by a customer reach a provider two ASes away, through networks that never look at it.

Optional non-transitive: MED, ORIGINATOR_ID, CLUSTER_LIST

These are also optional, but an implementation that does not recognise them must quietly ignore them and not pass them to anyone.[1] MULTI_EXIT_DISC (MED, type 4) is a hint from a neighbouring AS about which of several links into it you should prefer; RFC 4271 says a MED received from a neighbouring AS must not be passed on to other neighbouring ASes.[1] ORIGINATOR_ID (type 9) and CLUSTER_LIST (type 10) come from route reflection (RFC 4456) and prevent loops inside one AS.[8] Non-transitive does not mean "local to one router": a router that understands MED may still send it to its iBGP peers. It means that a router that does not understand the attribute must not forward it.

Why Weight is not on the list

Cisco's best-path algorithm starts with "prefer the path with the highest WEIGHT", so Weight is often listed with the attributes. It is not one. Cisco itself describes it as "a Cisco-specific parameter" that is "local to the router on which it is configured".[20] It has no type code in the IANA registry, it is never put into an UPDATE, and a neighbour cannot see it.[4]

The attribute flags byte, bit by bit

BGP path attribute flags byte with the Optional, Transitive, Partial and Extended Length bits and decoded flag values from real captures
Figure 2. The flags byte of a BGP path attribute. The real-data column comes from our decoding of public captures, RouteViews output and the GoBGP lab.

RFC 4271 section 4.3 defines four flag bits, counted from the high-order bit:[1]

  • Bit 0, Optional (0x80): 1 = optional, 0 = well-known.
  • Bit 1, Transitive (0x40): for optional attributes, 1 = transitive, 0 = non-transitive. For well-known attributes it MUST be 1.
  • Bit 2, Partial (0x20): only meaningful for optional transitive attributes. It says that the information may be incomplete, because a router on the path did not recognise the attribute or added it in the middle of the path. For well-known and optional non-transitive attributes it MUST be 0.
  • Bit 3, Extended Length (0x10): 0 = the length field is one byte (values up to 255), 1 = it is two bytes.

The four low-order bits are unused: senders must set them to 0 and receivers must ignore them.[1] Here are three attributes exactly as our raw sender put them on the wire in the lab, split into fields:

c0 07 08 0000fe06 0a000063
|  |  |  |        +-- 10.0.0.99      AGGREGATOR: router ID
|  |  |  +----------- 0x0000fe06 =   AS 65030 (4-byte, session has the 4-octet AS capability)
|  |  +-------------- length 8
|  +----------------- type 7 = AGGREGATOR
+-------------------- flags 0xC0 = 1100 0000 = Optional + Transitive

80 04 04 00000032                    MED: flags 0x80 (optional non-transitive), type 4, len 4, value 50

d0 ff 000d 4e462d5452414e534954495645
|  |  |    +-- 'NF-TRANSITIVE' (13 bytes)
|  |  +------- 2-byte length 0x000d = 13, because the E bit is set
|  +---------- type 255 (IANA: reserved for development)
+------------- flags 0xD0 = 1101 0000 = Optional + Transitive + Extended Length

The Extended Length bit is allowed even when the value would fit in one byte. FRR uses it for AS_PATH: in the Wireshark sample capture bgp.pcapng (FRRouting, 2022) all 20 AS_PATH attributes have flags 0x50, while the Cisco captures from packetlife.net use 0x40.[18] Both are correct. A parser that assumes a 1-byte length for AS_PATH would break on the FRR packets.

BGP path attribute type codes

Table of BGP path attribute type codes with category and RFC, from ORIGIN 1 to LARGE_COMMUNITY 32, OTC 35 and ATTR_SET 128
Figure 3. The type codes you are most likely to meet, with category and defining RFC (IANA registry, updated 2026-09-09).

The type code is one byte, so there are 255 usable values. IANA keeps the registry. As of its 2026-09-09 update, codes 1 to 42 and 128 are assigned, 255 is reserved for development, and a number of codes are deprecated: 11, 12, 13, 19, 20, 21, 28, 30, 31, 129 and 241-243.[4] Codes 34 and 42 are temporary early allocations for drafts.[4]

Pat's tree contains the ten classic attributes of RFC 1771 and RFC 4271 plus the two route-reflection attributes. His note under the drawing says it well: "There are a few more attributes, however they are neither specified in RFC 1771 nor supported by Cisco." Some of those newer attributes are now everywhere, so here they are in a separate list, with the category each defining RFC gives them.

Newer attributes beyond RFC 1771

CodeAttributeCategoryDefined inWhat it is for
14 / 15MP_REACH_NLRI / MP_UNREACH_NLRIoptional non-transitiveRFC 4760IPv6, VPN, EVPN and other address families, with their own next hop[7]
16EXTENDED COMMUNITIESoptional transitiveRFC 43608-byte communities: route targets, site of origin, many EVPN signals[5]
17 / 18AS4_PATH / AS4_AGGREGATORoptional transitiveRFC 6793carry 4-byte AS numbers across old 2-byte-only routers[6]
22PMSI_TUNNELoptional transitiveRFC 6514multicast VPN and EVPN BUM tunnels[9]
26AIGPoptional non-transitiveRFC 7311accumulated IGP metric across several ASes of one operator[9]
29BGP-LS Attributeoptional non-transitiveRFC 7752 (now RFC 9552)link-state topology exported to controllers[9]
32LARGE_COMMUNITYoptional transitiveRFC 809212-byte communities that fit a 4-byte ASN[5]
33BGPsec_Pathoptional non-transitiveRFC 8205signed AS path[9]
35Only to Customer (OTC)optional transitiveRFC 9234route-leak prevention with BGP roles[9]
38BFD Discriminatoroptional transitiveRFC 9026multicast VPN upstream failover[9]
40BGP Prefix-SIDoptional transitiveRFC 8669segment routing label index for BGP prefixes[9]
128ATTR_SEToptional transitiveRFC 6368carries a customer's attributes through an L3VPN[9]

Every attribute added after RFC 1771 is optional. That is deliberate: a new well-known attribute would be a protocol error for every router that does not know it, so the IETF uses the optional categories, and the Transitive bit says what an old router should do with the attribute.

What a router does with an unknown attribute

Decision flow for an unknown BGP path attribute: well-known means error, optional transitive is passed on with the Partial bit, optional non-transitive is dropped
Figure 4. The decision RFC 4271 asks for when an attribute type is not implemented. Only the two high bits of the flags byte are needed.

RFC 4271 handles the three cases in sections 5, 6.3 and 9:[1]

  1. Unknown well-known attribute (O = 0). This should never happen, since every implementation must know all well-known attributes. RFC 4271 treats it as an UPDATE Message Error with subcode 2, Unrecognized Well-known Attribute, which means a NOTIFICATION and the end of the session.
  2. Unknown optional transitive attribute (O = 1, T = 1). The route SHOULD be accepted. If it is passed on, the attribute MUST go with it, with the Partial bit set to 1. A Partial bit set by an earlier AS MUST NOT be cleared.
  3. Unknown optional non-transitive attribute (O = 1, T = 0). It MUST be quietly ignored and not passed to other peers.

Optional transitive attributes can also be added in the middle of the path. If a router that did not originate the route attaches a new optional transitive attribute, it sets the Partial bit too.[1] So P = 1 means "a router on the path either did not understand this attribute or added it later"; it does not tell you which router it was.

Lab: known, unknown and broken attributes in GoBGP 4.11

To see the rules on a real implementation, we built a small lab on the loopback interface of our server, with no root access needed. r1 is GoBGP 4.11.0 in AS 65001 (127.0.2.51). It has an iBGP session to a second GoBGP router, r2, and four passive neighbours that are small Python programs speaking raw BGP: S (AS 65003) sends routes, E (AS 65004, eBGP) and I (AS 65001, iBGP) only listen and record every byte r1 sends them, and X (AS 65006) sends broken UPDATEs.[19] All output below is real GoBGP 4.11 lab output from 29 November 2026, 05:03 CET.

S sent one UPDATE for 198.51.100.0/24 (147 bytes) with twelve attributes: ORIGIN IGP, AS_PATH 65003 65030, NEXT_HOP 127.0.2.53, MED 50, a LOCAL_PREF of 500 (which an eBGP neighbour must never send), ATOMIC_AGGREGATE, AGGREGATOR 65030 / 10.0.0.99, two standard communities, one extended and one large community, and two attributes no router knows: type 254 with flags 0x80 (optional non-transitive) and type 255 with flags 0xD0 (optional transitive, extended length). Both codes are outside the assigned range; 255 is IANA's "reserved for development".[4]

What r1 stored from S (Adj-RIB-In):

$ gobgp neighbor 127.0.2.53 adj-in -a ipv4
   ID  Network              Next Hop             AS_PATH              Age        Attrs
   0   198.51.100.0/24      127.0.2.53           65003 65030          00:00:03   [{Origin: i}
      {Med: 50}
      {AtomicAggregate}
      {Aggregate: {AS: 65030, Address: 10.0.0.99}}
      {Communities: 65003:100, 65003:200}
      {Extcomms: [65003:1]}
      {LargeCommunity: [ 65003:1:2]}
      {Flags: OPTIONAL, Type: BGPAttrType(254), Value: [78 70 45 78 79 78 84 82 65 78 83]}
      {Flags: EXTENDED_LENGTH|TRANSITIVE|OPTIONAL, Type: BGPAttrType(255), Value: [78 70 45 84 82 65 78 83 73 84 73 86 69]}]

The LOCAL_PREF of 500 is already gone. r1 removed it on receipt, which is the RFC 7606 "attribute discard" for LOCAL_PREF from an external neighbour.[3] Both unknown attributes are kept, with their original flags. Now the two UPDATEs r1 sent on:

$ gobgp neighbor 127.0.2.54 adj-out -a ipv4      # E, eBGP, AS 65004
   ID  Network              Next Hop             AS_PATH              AttrsFiltered
   1   198.51.100.0/24      127.0.2.51           65001 65003 65030    [{Origin: i}
      {AtomicAggregate}
      {Aggregate: {AS: 65030, Address: 10.0.0.99}}
      {Communities: 65003:100, 65003:200}
      {Extcomms: [65003:1]}
      {LargeCommunity: [ 65003:1:2]}
      {Flags: EXTENDED_LENGTH|TRANSITIVE|OPTIONAL, Type: BGPAttrType(255), Value: [78 70 45 84 82 65 78 83 73 84 73 86 69]}]not filtered

$ gobgp neighbor 127.0.2.55 adj-out -a ipv4      # I, iBGP, AS 65001
   ID  Network              Next Hop             AS_PATH              AttrsFiltered
   1   198.51.100.0/24      127.0.2.53           65003 65030          [{Origin: i}
      {Med: 50}
      {LocalPref: 100}
      {AtomicAggregate}
      {Aggregate: {AS: 65030, Address: 10.0.0.99}}
      {Communities: 65003:100, 65003:200}
      {Extcomms: [65003:1]}
      {LargeCommunity: [ 65003:1:2]}
      {Flags: EXTENDED_LENGTH|TRANSITIVE|OPTIONAL, Type: BGPAttrType(255), Value: [78 70 45 84 82 65 78 83 73 84 73 86 69]}]not filtered
GoBGP lab showing which BGP path attributes were forwarded to an eBGP and an iBGP neighbor, including MED, LOCAL_PREF and unknown attributes
Figure 5. The lab and the result. Every cell was checked against the bytes the raw receivers E and I got from r1 (123 and 133 bytes).

Our receivers decoded the bytes, and they match the CLI. Attribute by attribute:

  • Well-known mandatory: ORIGIN reached both neighbours unchanged. Towards eBGP, r1 prepended its own AS (the AS_PATH became 65001 65003 65030, 14 bytes instead of 10) and set NEXT_HOP to itself, 127.0.2.51. Towards iBGP, both were left as they were. That is standard eBGP/iBGP behaviour from part 2.
  • MED (optional non-transitive, known): sent to I with value 50, not sent to E. This is RFC 4271's rule that a MED learned from one neighbouring AS is not passed to another.[1] GoBGP understands MED, so it can forward it inside its own AS.
  • LOCAL_PREF: I received 40 05 04 00000064, LOCAL_PREF 100, GoBGP's default, not the 500 from S. E received no LOCAL_PREF at all.
  • ATOMIC_AGGREGATE, AGGREGATOR and all three community types reached both neighbours byte for byte. They are well-known discretionary or optional transitive, and r1 has no policy that removes them.
  • Type 254, unknown optional non-transitive: sent to neither E nor I, as RFC 4271 requires. Note that GoBGP still keeps it in the Adj-RIB-In and the Loc-RIB.
  • Type 255, unknown optional transitive: forwarded to both, which is correct, but with flags still 0xD0. RFC 4271 says the Partial bit MUST be set when an unrecognised transitive attribute is passed on, which would make it 0xF0.[1] In our test GoBGP 4.11 did not set it. The second GoBGP router, r2, also stored the attribute with flags 208 (0xD0). This does no harm to the route, but a tool that relies on P = 1 to find routes that crossed an old router would not see this hop. It is a good example of why we test implementations instead of quoting the RFC.

Broken attributes: RFC 4271 vs RFC 7606

RFC 4271 was strict: almost every attribute error meant a NOTIFICATION and a session reset. One bad route from one customer could drop a full table session with hundreds of thousands of good routes, and an attribute that confused one software version could reset sessions in many networks at once. RFC 7606 (2015) changed this. For most attribute errors the receiver now uses treat-as-withdraw (the route in that UPDATE is handled as if it had been withdrawn, and the session stays up) or attribute discard (only the bad attribute is removed).[3] The main rules:

  • Wrong Optional or Transitive bit on a known attribute: treat-as-withdraw, unless the attribute's own specification says otherwise.[3]
  • A missing well-known mandatory attribute: treat-as-withdraw.[3]
  • Errors in ORIGIN, AS_PATH, NEXT_HOP, MED or LOCAL_PREF: treat-as-withdraw. Errors in ATOMIC_AGGREGATE or AGGREGATOR: attribute discard.[3]
  • An attribute that appears twice: keep the first, discard the others, and go on. The exception is MP_REACH_NLRI or MP_UNREACH_NLRI appearing twice, which still resets the session.[3]

We sent five broken UPDATEs from X over one session. GoBGP logged each one (lab output, times in CET):

05:03:53.970  Some attributes were discarded: the path attribute appears twice. Type : 8
05:03:56.518  the received Update message was treated as withdraw: flags are invalid. attribute type: BGP_ATTR_TYPE_ORIGIN, expect: TRANSITIVE, actual: TRANSITIVE|OPTIONAL
05:03:59.062  the received Update message was treated as withdraw: optional non-transitive attribute BGPAttrType(250) must have partial bit 0
05:04:01.608  the received Update message was treated as withdraw: well-known mandatory attributes are not present. type : 3
05:04:04.159  the received Update message was treated as withdraw: unrecognized well-known attribute BGPAttrType(253)
BGP path attribute error handling compared: RFC 4271, RFC 7606 and observed GoBGP 4.11 behaviour for six malformed UPDATE messages
Figure 6. The five broken UPDATEs and the LOCAL_PREF case compared with RFC 4271, RFC 7606 and what GoBGP 4.11 really did.

The session to X stayed Established through all five tests: Notifications 0 sent and 0 received, Updates received 3 and Discarded 2 in gobgp neighbor. The duplicate COMMUNITIES attribute was handled exactly as RFC 7606 says: the route was installed with 65006:1 and the second copy was dropped. The ORIGIN sent with flags 0xC0, the missing NEXT_HOP and the optional non-transitive attribute with its Partial bit set were all treated as withdraw. Only the counters differ: GoBGP counted the two flag errors as Discarded but not the missing NEXT_HOP or the unknown well-known attribute.

The unknown well-known attribute 253 is the interesting one. RFC 7606 does not change this case, so the RFC 4271 rule (NOTIFICATION 3/2, then reset) still applies on paper.[1][3] GoBGP chose treat-as-withdraw instead and kept the session up; its validation code builds the error with subcode 2 (Unrecognized Well-known Attribute) but sets the handling to treat-as-withdraw.[16][19] Other implementations may follow RFC 4271 here, so do not assume your router does what GoBGP does.

When an attribute takes down the Internet

These rules are not just theory. On 2 June 2023, BGP messages carrying attribute 28 caused recurring session resets between networks. Attribute 28 is the BGP Entropy Label Capability attribute of RFC 6790, now deprecated.[14][4] RIPE Labs' first analysis was that particular versions of Juniper routers wrongly flagged these UPDATEs as corrupt and reset their sessions, while other routers had simply passed the optional transitive attribute along.[14] A RIPE Labs follow-up recommends filtering the deprecated codes 28, 30, 31 and 129 at the edge.[12] A similar problem in 2011, routes with attribute 128 that triggered Juniper peering issues, is the reason Junos got knobs to drop or ignore chosen attributes.[15] This is the cost of transitive attributes: a router you do not control can send you bytes that one of your own software versions has never been tested with.

Real routes on RouteViews

Real RouteViews output: BGP Large Community and OTC shown as unknown transitive attributes with flag 0xE0, and AGGREGATOR on paths to 1.1.1.0/24
Figure 7. Three prefixes, 48 paths, read from route-views.routeviews.org on 29 November 2026 at 04:06 UTC. Values in the right-hand column decoded by us.

We read show ip bgp for three well-known prefixes on route-views.routeviews.org: 1.1.1.0/24 (Cloudflare, AS 13335), 8.8.8.0/24 (Google, AS 15169) and 193.0.0.0/21 (RIPE NCC, AS 3333). That gave 48 paths.[17] The best path to 1.1.1.0/24, trimmed:

route-views>show ip bgp 1.1.1.0/24
BGP routing table entry for 1.1.1.0/24, version 1552409178
Paths: (16 available, best #13, table default)
  Not advertised to any peer
  ...
  57866 13335, (aggregated by 13335 10.34.6.80)
    37.139.139.17 from 37.139.139.17 (37.139.139.17)
      Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, best
      Community: 57866:200 65102:56393 65103:1 65104:31
      unknown transitive attribute: flag 0xE0 type 0x20 length 0x3C
        value 0000 3417 0098 9694 0000 0000 0000 E20A
              0000 0065 0000 00C8 0000 E20A 0000 0066
              0000 DC49 0000 E20A 0000 0067 0000 0001
              0000 E20A 0000 0068 0000 001F
      path 7F1693EA1B50 RPKI State valid

Several categories show up in these few lines:

  • Well-known mandatory: Origin IGP, the AS path 57866 13335 and the next hop 37.139.139.17 are present on every path.
  • Well-known discretionary: all 16 paths to 1.1.1.0/24 carry atomic-aggregate. The localpref 100 was not received; it is the value the collector assigns locally, because eBGP peers do not send LOCAL_PREF.
  • Optional transitive: all 16 paths also carry AGGREGATOR (aggregated by 13335 10.34.6.80), with 11 different router IDs in AS 13335. The communities pass through as well.
  • Optional non-transitive: MED appears on only 9 of the 48 paths (metric 0, 3 per prefix). That fits the rule that MED goes only one AS hop.
  • Unknown optional transitive: 12 paths carry an attribute this router does not recognise, all printed with flag 0xE0 (Optional, Transitive, Partial). Ten are type 0x20, LARGE_COMMUNITY. We decoded the 60 bytes above into five large communities: 13335:10000020:0 and 57866:101:200, 57866:102:56393, 57866:103:1, 57866:104:31.[5] Two are type 0x23, the OTC attribute of RFC 9234, with the value 6777, the AS number of the AMS-IX route servers.[9][21]

The router keeps and displays these routes normally. It cannot use the large communities for its own policy, but the attributes are there for anyone downstream that can. This is the "pass it on" rule of the optional transitive category at work. Cisco IOS also has a command that lists such routes: show ip bgp path-attribute unknown.[10]

Seeing and filtering attributes on real routers

All major implementations can show the attributes of a route and drop or reject chosen type codes. The following are configuration examples written from the vendors' documentation, not tested in this lab:[10][11][12][13]

! Cisco IOS / IOS XE: show, then discard or withdraw on input
show ip bgp 198.51.100.0/24
show ip bgp path-attribute unknown
router bgp 65001
 neighbor 192.0.2.2 path-attribute discard 28 in
 neighbor 192.0.2.2 path-attribute treat-as-withdraw 30 in

! Cisco IOS XR: attribute-filter group applied to a neighbor
router bgp 65001
 attribute-filter group BOGON-ATTR
  attribute 28 discard
  attribute 30 discard
 !
 neighbor 192.0.2.2
  remote-as 65002
  update in filtering
   attribute-filter group BOGON-ATTR

# Junos: skip processing of chosen attributes (they are kept and passed on as-is)
set protocols bgp ignore-path-attributes [ 28 30-31 129 ]
show route 198.51.100.0/24 detail

! FRR
router bgp 65001
 neighbor 192.0.2.2 path-attribute discard 28 30 31 129
show bgp ipv4 unicast 198.51.100.0/24

# GoBGP
gobgp global rib -a ipv4 198.51.100.0/24 -j

Two warnings. First, discarding a transitive attribute also removes it for every router behind you, so do not discard attributes your customers or peers use, such as LARGE_COMMUNITY (the RIPE routing working group warned about exactly that when Large Communities were new).[12] Second, check the exact syntax and behaviour for your release. On Junos, ignore-path-attributes keeps the attribute and passes it on unchanged, while the older drop-path-attributes knob and the newer path-attributes drop statement remove it for all peers, which RIPE Labs points out does not match RFC 4271 for transitive attributes.[12]

The attribute articles in this series

Pat's rule for this series is one separate article per attribute, each with a precise description, a usage example and figures, in the order of his tree. The next ten parts are:

  1. ORIGIN: IGP, EGP and INCOMPLETE, where each comes from and its place in best-path selection.
  2. AS_PATH: AS_SEQUENCE and AS_SET, 4-byte ASNs and AS4_PATH, loop prevention, prepending.
  3. NEXT_HOP: eBGP and iBGP rules, third-party next hop, next-hop-self.
  4. LOCAL_PREF: the attribute that controls your outbound traffic.
  5. ATOMIC_AGGREGATE: what it says after route summarisation.
  6. AGGREGATOR: who built the summary, and AS4_AGGREGATOR.
  7. COMMUNITY: standard, well-known, extended and large communities.
  8. MED: influencing inbound traffic from a neighbouring AS.
  9. ORIGINATOR_ID: route-reflector loop prevention.
  10. CLUSTER_LIST: how route-reflector clusters avoid loops.

Each of those articles starts with a small "you are here" copy of Figure 1. After them comes the full best-path selection algorithm. Until then, our older posts cover the basics of ORIGIN, LOCAL_PREF, MED and CLUSTER_LIST, and our 2011 post BGP Path Attributes has the short version of this one.

Common mistakes and troubleshooting

MistakeWhat really happensDo this instead
Listing Weight as a path attributeWeight is Cisco-local and never leaves the routerTreat it as a local policy knob, the first step of Cisco best-path
Setting LOCAL_PREF towards an eBGP neighbour and expecting it to workIt is not sent; if a peer sends it, RFC 7606 tells the receiver to discard itUse MED, AS-path prepending or provider communities for inbound traffic
Expecting MED to reach an AS two hops awayMED is optional non-transitive and does not go past the neighbouring ASUse communities agreed with the transit provider
Writing a parser that assumes a 1-byte lengthFRR sends AS_PATH with the Extended Length bit (0x50); big communities lists need it tooAlways read bit 3 before reading the length
Discarding all unknown transitive attributes at the edgeCustomers lose Large Communities, OTC and future attributesFilter only deprecated or known-bad codes (28, 30, 31, 129)
Trusting the Partial bit as a complete traceIn our test GoBGP 4.11 forwarded an unknown attribute without setting PTreat P = 1 as a hint, not as proof
Assuming every router has RFC 7606 behaviourOlder code and some cases still reset the sessionCheck the release notes and test with a lab peer, as above

When a route is missing or looks wrong, read the attributes before the policy. On Cisco, show ip bgp <prefix> lists them per path, and show ip bgp path-attribute unknown and show ip bgp path-attribute discard show routes affected by unknown or filtered attributes.[10] On Junos use show route <prefix> detail, on FRR show bgp ipv4 unicast <prefix>, and on GoBGP add -j to get every attribute with its type code and flags. If a neighbour keeps resetting with UPDATE errors (code 3) in the NOTIFICATION, look at the data field: it carries the attribute that triggered the error.[1]

FAQ

What are the four types of BGP path attributes?

Well-known mandatory (ORIGIN, AS_PATH, NEXT_HOP), well-known discretionary (LOCAL_PREF, ATOMIC_AGGREGATE), optional transitive (AGGREGATOR, COMMUNITY) and optional non-transitive (MED, ORIGINATOR_ID, CLUSTER_LIST). Every BGP implementation must recognise the well-known ones. Optional ones may be unknown to a router, and the Transitive bit tells it whether to pass them on or drop them.

Is LOCAL_PREF well-known mandatory or discretionary?

The classic answer, from RFC 1771 and most Cisco material, is well-known discretionary. RFC 4271 calls it simply well-known, but says it SHALL be included in every UPDATE sent to internal peers and MUST NOT be sent to external peers, except within a confederation. In practice it is required on iBGP and forbidden on eBGP.

Is Weight a BGP path attribute?

No. Weight is a Cisco-specific value that is local to the router where it is configured. It has no type code, is never carried in an UPDATE message and neighbours never see it. It is still the first step of the Cisco best-path algorithm.

What does the Partial bit mean in a BGP attribute?

The Partial bit (bit 2 of the flags byte) is used only on optional transitive attributes. A router that does not recognise such an attribute but passes it on must set the bit to 1. It can also be set when a router in the middle of the path attached a new transitive attribute. Once it is set, no later AS may clear it.

What happens to an unknown optional non-transitive attribute?

RFC 4271 says it must be quietly ignored and not passed to any other peer. In our GoBGP 4.11 lab an unknown type 254 sent with flags 0x80 was stored in the Adj-RIB-In, but r1 removed it from the UPDATEs it sent to both its eBGP and its iBGP neighbour.

Does a malformed path attribute still reset the BGP session?

Mostly no. RFC 7606 (2015) replaced most session resets with treat-as-withdraw (the route is removed, the session stays up) or attribute discard. A session reset is still required for a few cases, such as a duplicate MP_REACH_NLRI. Older software and some vendors may still reset, so check your release.

Which BGP attribute type codes exist?

IANA keeps the list. Codes 1 to 10 are the classic set (ORIGIN to CLUSTER_LIST). Later ones include 14/15 MP_REACH_NLRI and MP_UNREACH_NLRI, 16 Extended Communities, 17/18 AS4_PATH and AS4_AGGREGATOR, 26 AIGP, 29 BGP-LS, 32 Large Community, 33 BGPsec_Path, 35 OTC, 40 Prefix-SID and 128 ATTR_SET. Several codes, such as 28, 30, 31 and 129, are deprecated.

Part 5 of 26 — BGP Deep Dive
Series hub: BGP in 26 Parts: From EGP to EVPN
Previous: BGP Neighbor States: How the Finite State Machine Works
Next: BGP ORIGIN Attribute Deep Dive: IGP, EGP and Incomplete With Lab Examples (coming soon)

References (all read on 29 November 2026)
[1] Y. Rekhter, T. Li, S. Hares (eds.), RFC 4271: A Border Gateway Protocol 4 (BGP-4), January 2006: s.4.3 (attribute flags and type codes), s.5 (four categories, Partial bit, ordering), s.5.1.4-5.1.7 (MED, LOCAL_PREF, ATOMIC_AGGREGATE, AGGREGATOR), s.6.3 (UPDATE errors), s.9 (UPDATE handling).
[2] Y. Rekhter, T. Li, RFC 1771: A Border Gateway Protocol 4 (BGP-4), March 1995: s.4.3, LOCAL_PREF as a well-known discretionary attribute.
[3] E. Chen, J. Scudder, P. Mohapatra, K. Patel, RFC 7606: Revised Error Handling for BGP UPDATE Messages, August 2015: s.2-3 (treat-as-withdraw, attribute discard, flags, missing and duplicate attributes), s.7 (per-attribute rules).
[4] IANA, Border Gateway Protocol (BGP) Parameters: BGP Path Attributes, registry file updated 2026-09-09.
[5] Communities: RFC 1997 (COMMUNITIES), RFC 4360 (Extended Communities), RFC 8092 (Large Communities).
[6] Q. Vohra, E. Chen, RFC 6793: BGP Support for Four-Octet Autonomous System (AS) Number Space, December 2012 (AS4_PATH, AS4_AGGREGATOR).
[7] T. Bates, R. Chandra, D. Katz, Y. Rekhter, RFC 4760: Multiprotocol Extensions for BGP-4, January 2007.
[8] T. Bates, E. Chen, R. Chandra, RFC 4456: BGP Route Reflection, April 2006 (ORIGINATOR_ID, CLUSTER_LIST).
[9] Newer attributes: RFC 6514 (PMSI_TUNNEL), RFC 7311 (AIGP), RFC 7752 / RFC 9552 (BGP-LS), RFC 8205 (BGPsec_Path), RFC 9234 (OTC and BGP roles), RFC 9026 (BFD Discriminator), RFC 8669 (Prefix-SID), RFC 6368 (ATTR_SET).
[10] Cisco, BGP Attribute Filter and Enhanced Attribute Error Handling, IP Routing Configuration Guide, Cisco IOS XE 17.x.
[11] Cisco, BGP attribute filters, BGP Configuration Guide for Cisco 8000 Series Routers, IOS XR.
[12] Juniper Networks, path-attributes drop (Junos CLI reference); B. Todorovic, BGP Path Attribute Filtering - A Powerful Tool to Mitigate Alien Attributes, RIPE Labs, 11 July 2023; RIPE routing-wg thread Large BGP Communities beacon in the wild, 2016.
[13] FRRouting, BGP documentation: neighbor path-attribute discard.
[14] E. Aben, Unknown Attribute 28 - A Source Of Entropy in Interdomain Routing?, RIPE Labs, June 2023.
[15] SANS Internet Storm Center, diary New feature in JUNOS to drop or ignore path attributes (September 2011, attribute 128).
[16] GoBGP v4.11.0 source: pkg/packet/bgp/validate.go (flag checks, unrecognized well-known attribute) and pkg/packet/bgp/bgp.go (PathAttributeUnknown).
[17] University of Oregon RouteViews, route-views.routeviews.org (telnet, user rviews): show ip bgp for 1.1.1.0/24, 8.8.8.0/24 and 193.0.0.0/21, captured 29 November 2026, 04:05:58-04:06:05 UTC.
[18] Wireshark sample captures bgp.pcap (2000) and bgp.pcapng (FRRouting, 2022); packetlife.net captures by Jeremy Stretch (Cisco IOS, 2008-2013, mirror epiecs/packetlife-backup); decoded with scapy 2.8.0 and our own attribute parser.
[19] Network freak lab: GoBGP 4.11.0 routers r1 (AS 65001, 127.0.2.51) and r2 (127.0.2.52), raw Python BGP speakers 127.0.2.53-56, 29 November 2026, 05:03-05:05 CET. Logs and bytes kept with the article sources.
[21] RIPEstat, as-overview AS6777: holder AMS-IX-RS Amsterdam Internet Exchange B.V., queried 29 November 2026.
[20] Cisco, Select BGP Best-path Algorithm, document 13753, updated 28 April 2026.
Figures 1-7: Network freak, drawn from the sources above, our lab and RouteViews.

Try it: BGP Route Lookup: origin AS, AS paths and RPKI check - free, runs in your browser.

Comments

Popular posts from this blog

BGP Neighbor States

Reason legend in show ip ospf statistics

Cisco SPAN Port Mirroring for Troubleshooting