What Are Path Attributes?
Path attributes are the extra information BGP carries with a route. They live in the Path Attributes field of an UPDATE and apply to every NLRI that UPDATE carries (BGP Messages).
The ASes traversed (AS_PATH), the next forwarding address (NEXT_HOP) and the preferences (LOCAL_PREF, MED) all go here: BGP evaluates routes by this set of attributes rather than by a metric. Each attribute consists of flags, a type code, a length and a value.
The Four Categories
The two high-order bits of Attribute Flags (Optional and Transitive) put every attribute into one of four categories (RFC 4271 section 5). They decide whether an implementation must support the attribute and whether an unknown attribute may be passed on.
| Category | Optional | Transitive | Meaning |
|---|---|---|---|
| Well-known mandatory | 0 | 1 | Every implementation must support it, and it must be present in the UPDATE. |
| Well-known discretionary | 0 | 1 | Every implementation must support it, but including it is optional. |
| Optional transitive | 1 | 1 | Support is optional. An unknown attribute is passed on with the Partial bit set. |
| Optional non-transitive | 1 | 0 | Support is optional. An unknown attribute is discarded and not passed on. |
Well-known attributes always have the Transitive bit set. The Partial bit is used only for optional transitive attributes, set by a router that passes on an attribute it does not understand.
The only attribute RFC 4271 explicitly calls well-known discretionary is ATOMIC_AGGREGATE (section 5.1.6). LOCAL_PREF is also a well-known attribute, but the attribute table in section 5 lists it as required towards iBGP (see LOCAL_PREF).
List of Path Attributes
The main path attributes (numbers from the IANA BGP Parameters registry).
| Type code | Attribute | Category | Summary |
|---|---|---|---|
| 1 | ORIGIN | Well-known mandatory | How the route entered BGP (IGP / EGP / Incomplete). Covered in ORIGIN. |
| 2 | AS_PATH | Well-known mandatory | The sequence of ASes the route traversed, used for loop detection and path length. Covered in AS_PATH. |
| 3 | NEXT_HOP | Well-known mandatory | The next-hop IP address of the route. See NEXT_HOP and next-hop-self. |
| 4 | MULTI_EXIT_DISC (MED) | Optional non-transitive | Tells a neighboring AS which entry point into this AS to prefer. See MED. |
| 5 | LOCAL_PREF | Well-known (required towards iBGP peers, never sent to eBGP peers) | Which exit to prefer inside the AS. See LOCAL_PREF. |
| 6 | ATOMIC_AGGREGATE | Well-known discretionary | Marks an aggregate that covers more specific routes. Covered in BGP route aggregation. |
| 7 | AGGREGATOR | Optional transitive | The AS number and Router ID of the router that aggregated the route. Covered in BGP route aggregation. |
| 8 | COMMUNITY | Optional transitive | Tags routes so that policies can address them as a group. See COMMUNITY. |
| 9 | ORIGINATOR_ID | Optional non-transitive | The Router ID of the router that brought the route into the AS, added by a route reflector. Covered in Route Reflector. |
| 10 | CLUSTER_LIST | Optional non-transitive | The list of cluster IDs the route passed through. Covered in Route Reflector. |
| 14 | MP_REACH_NLRI | Optional non-transitive | Carries routes of address families other than IPv4 unicast (RFC 4760). |
| 15 | MP_UNREACH_NLRI | Optional non-transitive | The withdrawal counterpart for the multiprotocol extensions. |
| 16 | EXTENDED COMMUNITIES | Optional transitive | Communities extended to eight bytes (RFC 4360). |
| 17 | AS4_PATH | Optional transitive | Complements AS_PATH across routers that do not support four-octet AS numbers (RFC 6793). |
| 18 | AS4_AGGREGATOR | Optional transitive | Complements AGGREGATOR in the same way. |
| 32 | LARGE_COMMUNITY | Optional transitive | Twelve-byte communities (RFC 8092). |
MP_REACH_NLRI attribute rather than in the NLRI field of the UPDATE itself (BGP Messages).Handling Malformed Attributes (RFC 7606)
RFC 4271 said that an UPDATE with a missing mandatory attribute or an inconsistent length must be answered with a NOTIFICATION, tearing the session down. Because a single bad route then took every route with it, RFC 7606 revised this and assigns one of the following to each attribute.
| Handling | What happens |
|---|---|
| Attribute discard | Only the attribute is dropped and the route is kept (optional attributes such as COMMUNITY) |
| Treat-as-withdraw | The NLRI the UPDATE carries is treated as withdrawn (AS_PATH, NEXT_HOP, LOCAL_PREF and others) |
| Session reset | The session is torn down (when the attribute lengths do not add up and the UPDATE boundary is unknown) |
WEIGHT Is Not a Path Attribute
Cisco’s WEIGHT is evaluated first in best-path selection, but it is a Cisco-specific local value and never appears in an UPDATE.
| Item | LOCAL_PREF | WEIGHT |
|---|---|---|
| A path attribute? | Yes (type code 5) | No (a Cisco-specific local value) |
| Scope | All iBGP peers (inside the AS) | The configured router only |
| Default | 100 | 0 (32768 for locally originated routes) |
| Comparison | Higher is preferred | Higher is preferred |
Best Path Selection Order
When several routes exist for the same prefix, BGP picks exactly one as the best path, installs it in the routing table and advertises it to peers.
Routes whose NEXT_HOP is unreachable are excluded (next-hop-self). The remaining routes are compared in the following order, stopping as soon as one wins.
| Order | Criterion | Preferred | Source |
|---|---|---|---|
| 1 | WEIGHT | Higher | Cisco-specific |
| 2 | LOCAL_PREF | Higher | RFC 4271 9.1.1 (degree of preference) |
| 3 | Locally originated | Originated by network, redistribute or aggregation | Cisco-specific |
| 4 | AS_PATH length | Shorter | RFC 4271 9.1.2.2 a |
| 5 | ORIGIN | IGP < EGP < Incomplete | RFC 4271 9.1.2.2 b |
| 6 | MULTI_EXIT_DISC | Lower (compared only between routes from the same neighboring AS) | RFC 4271 9.1.2.2 c |
| 7 | eBGP over iBGP | The route learned over eBGP | RFC 4271 9.1.2.2 d |
| 8 | IGP metric to the NEXT_HOP | Lower | RFC 4271 9.1.2.2 e |
| — | Multipath decision | Install several qualifying routes | Cisco-specific (multipath) |
| 9 | Keep the existing best path | Between eBGP routes tied through step 8, keep the path already chosen (disabled by bgp bestpath compare-routerid) | Cisco-specific |
| 10 | BGP Router ID | Lower (the ORIGINATOR_ID value if present) | RFC 4271 9.1.2.2 f, RFC 4456 9 |
| 11 | CLUSTER_LIST length | Shorter | RFC 4456 9 |
| 12 | Neighbor IP address | Lower | RFC 4271 9.1.2.2 g |
WEIGHT, the locally originated step and keeping the existing best path are Cisco-specific and are not in any RFC. IOS XE uses the same order; what differs is the name of the commands that change how the comparison works.
| Behavior | IOS XR | IOS XE |
|---|---|---|
| Compare MED even between different neighboring ASes | bgp bestpath med always | bgp always-compare-med |
Do not compare AS_PATH length | bgp bestpath as-path ignore | bgp bestpath as-path ignore |
| Always compare the Router ID on a tie | bgp bestpath compare-routerid | bgp bestpath compare-routerid |
Verification on Real Devices
Seven XRd 26.1.1 routers, with R1 receiving the same prefix over two paths as the observation point.
| Router | AS | Role |
|---|---|---|
| R1 | 65001 | Observation point. iBGP with both R2 and R3 (no session between R2 and R3) |
| R2 | 65001 | Border router with two eBGP sessions, to R4 and R5 in AS 65002 |
| R3 | 65001 | Border router with eBGP to R6 in AS 65004 |
| R4 | 65002 | Originates 192.168.100.0/24 with redistribute static (ORIGIN is ?) |
| R5 | 65002 | Originates the same 192.168.100.0/24 with network (ORIGIN is i); Loopback100 holds the prefix |
| R6 | 65004 | Transit. Receives from R5 and passes the prefix to R3, making the AS_PATH one AS longer as seen from R1 |
| R7 | 65003 | Used to confirm that COMMUNITY crosses two ASes |
AS 65001 runs OSPF area 0 and the iBGP sessions are between Loopback0s. The eBGP-facing links of R2 and R3 are advertised into OSPF as passive interfaces.
R1 receives 192.168.100.0/24 twice: via R2 (AS_PATH 65002) and via R3 (AS_PATH 65004 65002).
Day 0 carries the higher-priority criteria, and each STEP levels one of them with the other path, so the deciding criterion moves one step down at a time.
WEIGHT already attached to a received route did not go away with no weight, with an inbound soft refresh or even with a hard clear. Changes that add a value take effect immediately.| STEP | Change | Deciding criterion on R1 (or R2) |
|---|---|---|
| 0 | none (initial state) | (1) WEIGHT (only the path via R2 has 100) |
| 1 | weight 100 on R1’s R3 neighbor as well | (2) LOCAL_PREF (200 on the path via R3) |
| 2 | set local-preference 200 in R1’s FROM-R2 as well | (4) AS_PATH length (shorter via R2) |
| 3 | bgp bestpath as-path ignore on R1 | (5) ORIGIN (IGP via R3, Incomplete via R2) |
| 4 | R4 switches to network, levelling ORIGIN | (8) IGP metric (MED is not compared on R1) |
| 5 | OSPF cost 100 on R1 - R2 as well, levelling the metric | (10) BGP Router ID |
| 6 | weight 100 on R2’s R5 neighbor as well | (on R2) (6) MED |
| 7 | MED 100 in R5’s TO-R2 as well, levelling MED | (on R2) down to steps (9) / (10) |
| 8 | clear bgp ipv4 unicast 10.2.4.4 on R2 | rejected by the CLI, so it never ran |
| 9 | bgp bestpath compare-routerid on R2 | no change |
| 10 | send-community-ebgp on R4 (toward R7) | COMMUNITY crosses two ASes |
| 11 | remove send-community-ebgp from R2 (final state) | sending is separate from transitivity |
In every STEP R1 sends 50 pings and a traceroute to 192.168.100.1 (R5’s Loopback100), which also shows that forwarding follows the best path.
The Four Categories in an UPDATE
The same UPDATE for 192.168.100.0/24 on the R1 - R2 link (iBGP) and on the R2 - R4 link (eBGP), captured when R4 changed how it originates the prefix in STEP 4.
Border Gateway Protocol - UPDATE Message
<snip>
Path Attribute - MP_REACH_NLRI
Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
Next hop: 10.2.4.4
<snip>
192.168.100.0/24
<snip>
Path Attribute - ORIGIN: IGP
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Origin: IGP (0)
Path Attribute - AS_PATH: 65002
Flags: 0x40, Transitive, Well-known, Complete
<snip>
AS4: 65002
Path Attribute - MULTI_EXIT_DISC: 100
Flags: 0x80, Optional, Non-transitive, Complete
<snip>
Multiple exit discriminator: 100
Path Attribute - LOCAL_PREF: 100
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Local preference: 100Border Gateway Protocol - UPDATE Message
<snip>
Path Attribute - MP_REACH_NLRI
Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
Next hop: 10.2.4.4
<snip>
192.168.100.0/24
<snip>
Path Attribute - ORIGIN: IGP
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Origin: IGP (0)
Path Attribute - AS_PATH: 65002
Flags: 0x40, Transitive, Well-known, Complete
<snip>
AS4: 65002
Path Attribute - MULTI_EXIT_DISC: 100
Flags: 0x80, Optional, Non-transitive, Complete
<snip>
Multiple exit discriminator: 100 Download the pcap of the packet in the tshark output above (STEP 4, the iBGP UPDATE)
Download the pcap of the packet in the tshark output above (STEP 4, the eBGP UPDATE)
Well-known attributes carry 0x40 and optional non-transitive ones 0x80. LOCAL_PREF (well-known; required towards iBGP peers and never sent to eBGP peers) appears only on the iBGP side, not on the eBGP side.
Optional transitive (0xc0) shows up with COMMUNITY, in the UPDATE R4 sent to R7 in AS 65003 (STEP 10).
Border Gateway Protocol - UPDATE Message
<snip>
Path Attribute - MP_REACH_NLRI
Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
Next hop: 10.4.7.4
<snip>
Path Attribute - ORIGIN: IGP
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Origin: IGP (0)
Path Attribute - AS_PATH: 65002 65001
Flags: 0x40, Transitive, Well-known, Complete
<snip>
AS4: 65002
AS4: 65001
Path Attribute - COMMUNITIES: 65001:100
Flags: 0xc0, Optional, Transitive, Complete
<snip>
Communities: 65001:100 | Category | Flags | Attributes observed here |
|---|---|---|
| Well-known mandatory | 0x40 | ORIGIN, AS_PATH |
| Well-known (required towards iBGP) | 0x40 | LOCAL_PREF (iBGP only) |
| Optional transitive | 0xc0 | COMMUNITIES |
| Optional non-transitive | 0x80 | MULTI_EXIT_DISC, MP_REACH_NLRI |
0x90 of MP_REACH_NLRI is 0x80 plus 0x10 (Extended Length, a two-byte length field). ORIGINATOR_ID and CLUSTER_LIST, both optional non-transitive, are added by a route reflector; there is none in this verification, so they were not observed here (the captures in Route Reflector show them).The Deciding Criterion Moves Down One Step at a Time
show bgp 192.168.100.0/24 on R1. The (received-only) entries are the pre-policy copies kept by soft-reconfiguration inbound always.
RP/0/RP0/CPU0:R1#show bgp 192.168.100.0/24
Wed Sep 23 12:10:27.708 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 34 34
Last Modified: Sep 23 12:00:35.023 for 00:09:52
Paths: (3 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002, (received & used)
10.2.4.4 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin incomplete, metric 100, localpref 100, weight 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 34
Path #2: Received by speaker 0
Not advertised to any peer
65004 65002
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 200, valid, internal, group-best
Received Path ID 0, Local Path ID 0, version 0
Path #3: Received by speaker 0
Not advertised to any peer
65004 65002, (received-only)
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0RP/0/RP0/CPU0:R1#show bgp 192.168.100.0/24
Wed Sep 23 12:17:25.011 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 39 39
Last Modified: Sep 23 12:15:13.023 for 00:02:12
Paths: (3 available, best #2)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002, (received & used)
10.2.4.4 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin incomplete, metric 100, localpref 100, weight 100, valid, internal, group-best
Received Path ID 0, Local Path ID 0, version 0
Path #2: Received by speaker 0
Not advertised to any peer
65004 65002
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 200, weight 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 39
Path #3: Received by speaker 0
Not advertised to any peer
65004 65002, (received-only)
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0RP/0/RP0/CPU0:R1#show bgp 192.168.100.0/24
Wed Sep 23 12:24:25.916 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 45 45
Last Modified: Sep 23 12:22:13.023 for 00:02:13
Paths: (4 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002
10.2.4.4 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin incomplete, metric 100, localpref 200, weight 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 45
Path #2: Received by speaker 0
Not advertised to any peer
65002, (received-only)
10.2.4.4 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin incomplete, metric 100, localpref 100, weight 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0
Path #3: Received by speaker 0
Not advertised to any peer
65004 65002
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 200, weight 100, valid, internal, group-best
Received Path ID 0, Local Path ID 0, version 0
Path #4: Received by speaker 0
Not advertised to any peer
65004 65002, (received-only)
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0RP/0/RP0/CPU0:R1#show bgp 192.168.100.0/24
Wed Sep 23 12:31:27.860 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 47 47
Last Modified: Sep 23 12:29:15.023 for 00:02:12
Paths: (4 available, best #3)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002
10.2.4.4 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin incomplete, metric 100, localpref 200, weight 100, valid, internal, group-best
Received Path ID 0, Local Path ID 0, version 0
Path #2: Received by speaker 0
Not advertised to any peer
65002, (received-only)
10.2.4.4 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin incomplete, metric 100, localpref 100, weight 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0
Path #3: Received by speaker 0
Not advertised to any peer
65004 65002
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 200, weight 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 47
Path #4: Received by speaker 0
Not advertised to any peer
65004 65002, (received-only)
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0RP/0/RP0/CPU0:R1#show bgp 192.168.100.0/24
Wed Sep 23 12:38:29.238 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 48 48
Last Modified: Sep 23 12:36:36.023 for 00:01:53
Paths: (4 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002
10.2.4.4 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin IGP, metric 100, localpref 200, weight 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 48
Path #2: Received by speaker 0
Not advertised to any peer
65002, (received-only)
10.2.4.4 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin IGP, metric 100, localpref 100, weight 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0
Path #3: Received by speaker 0
Not advertised to any peer
65004 65002
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 200, weight 100, valid, internal, group-best
Received Path ID 0, Local Path ID 0, version 0
Path #4: Received by speaker 0
Not advertised to any peer
65004 65002, (received-only)
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0RP/0/RP0/CPU0:R1#show bgp 192.168.100.0/24
Wed Sep 23 12:45:27.510 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 48 48
Last Modified: Sep 23 12:36:36.023 for 00:08:51
Paths: (4 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002
10.2.4.4 (metric 101) from 10.0.0.2 (10.0.0.2)
Origin IGP, metric 100, localpref 200, weight 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 48
Path #2: Received by speaker 0
Not advertised to any peer
65002, (received-only)
10.2.4.4 (metric 101) from 10.0.0.2 (10.0.0.2)
Origin IGP, metric 100, localpref 100, weight 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0
Path #3: Received by speaker 0
Not advertised to any peer
65004 65002
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 200, weight 100, valid, internal, group-best
Received Path ID 0, Local Path ID 0, version 0
Path #4: Received by speaker 0
Not advertised to any peer
65004 65002, (received-only)
10.3.6.6 (metric 101) from 10.0.0.3 (10.0.0.3)
Origin IGP, localpref 100, valid, internal
Received Path ID 0, Local Path ID 0, version 0Step by step:
| STEP | Difference between the two paths | Best | Why it was decided there |
|---|---|---|---|
| 0 | Only the path via R2 has weight 100 | via R2 | WEIGHT is compared first, so the LOCAL_PREF of 200 on the path via R3 is never looked at |
| 1 | Both have weight 100, the path via R3 has localpref 200 | via R3 | WEIGHT is now equal, so LOCAL_PREF decides |
| 2 | Both have localpref 200 | via R2 | AS_PATH is 65002 (one AS) against 65004 65002 (two) |
| 3 | as-path ignore stops the length comparison | via R3 | ORIGIN is IGP (R5 originates with network) against Incomplete (R4 with redistribute static) |
| 4 | R4 also switches to network, levelling ORIGIN | via R2 | MED is not compared on R1: the neighboring AS is 65002 via R2 but 65004 via R3. The next step, the IGP metric, is (metric 2) against (metric 101) |
| 5 | OSPF cost 100 on R1 - R2 as well, so both are (metric 101) | via R2 | The Router ID 10.0.0.2 is lower than 10.0.0.3 |
Forwarding follows the best path: in STEP 0 the traffic leaves through R2, in STEP 1 through R3.
RP/0/RP0/CPU0:R1#ping 192.168.100.1 source 192.168.1.1 count 50 timeout 1
Wed Sep 23 12:10:17.621 UTC
Type escape sequence to abort.
Sending 50, 100-byte ICMP Echos to 192.168.100.1 timeout is 1 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (50/50), round-trip min/avg/max = 8/14/75 ms
RP/0/RP0/CPU0:R1#traceroute 192.168.100.1 source 192.168.1.1 probe 3 timeout 1 maxttl 6
Wed Sep 23 12:10:19.958 UTC
Type escape sequence to abort.
Tracing the route to 192.168.100.1
1 10.1.2.2 7 msec 5 msec 5 msec
2 10.2.4.4 24 msec 10 msec 9 msec
3 10.4.5.5 11 msec * 11 msec RP/0/RP0/CPU0:R1#ping 192.168.100.1 source 192.168.1.1 count 50 timeout 1
Wed Sep 23 12:17:14.977 UTC
Type escape sequence to abort.
Sending 50, 100-byte ICMP Echos to 192.168.100.1 timeout is 1 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (50/50), round-trip min/avg/max = 7/10/23 ms
RP/0/RP0/CPU0:R1#traceroute 192.168.100.1 source 192.168.1.1 probe 3 timeout 1 maxttl 6
Wed Sep 23 12:17:16.475 UTC
Type escape sequence to abort.
Tracing the route to 192.168.100.1
1 10.1.3.3 10 msec 4 msec 4 msec
2 10.3.6.6 11 msec 47 msec 8 msec
3 10.5.6.5 12 msec * 18 msec On R2, Which Receives Two Paths From the Same Neighboring AS, MED Applies
R2 receives the same prefix from R4 and R5 in AS 65002. Because the neighboring AS is the same, MED is compared.
RP/0/RP0/CPU0:R2#show bgp 192.168.100.0/24
Wed Sep 23 12:11:09.060 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 7 7
Last Modified: Sep 23 11:33:33.023 for 00:37:36
Paths: (2 available, best #1)
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.1
Path #1: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.1
65002, (received & used)
10.2.4.4 from 10.2.4.4 (10.0.0.4)
Origin incomplete, metric 100, localpref 100, weight 100, valid, external, best, group-best
Received Path ID 0, Local Path ID 1, version 7
Origin-AS validity: (disabled)
Path #2: Received by speaker 0
Not advertised to any peer
65002, (received & used)
10.2.5.5 from 10.2.5.5 (10.0.0.5)
Origin IGP, metric 200, localpref 100, valid, external
Received Path ID 0, Local Path ID 0, version 0
Origin-AS validity: (disabled)RP/0/RP0/CPU0:R2#show bgp 192.168.100.0/24
Wed Sep 23 12:53:08.026 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 16 16
Last Modified: Sep 23 12:50:16.023 for 00:02:52
Paths: (3 available, best #1)
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.1
Path #1: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.1
65002, (received & used)
10.2.4.4 from 10.2.4.4 (10.0.0.4)
Origin IGP, metric 100, localpref 100, weight 100, valid, external, best, group-best
Received Path ID 0, Local Path ID 1, version 12
Origin-AS validity: (disabled)
Path #2: Received by speaker 0
Not advertised to any peer
65002
10.2.5.5 from 10.2.5.5 (10.0.0.5)
Origin IGP, metric 200, localpref 100, weight 100, valid, external
Received Path ID 0, Local Path ID 0, version 0
Origin-AS validity: (disabled)
Path #3: Received by speaker 0
Not advertised to any peer
65002, (received-only)
10.2.5.5 from 10.2.5.5 (10.0.0.5)
Origin IGP, metric 200, localpref 100, valid, external
Received Path ID 0, Local Path ID 0, version 0
Origin-AS validity: (disabled)RP/0/RP0/CPU0:R2#show bgp 192.168.100.0/24
Wed Sep 23 13:00:01.970 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 16 16
Last Modified: Sep 23 12:50:16.023 for 00:09:46
Paths: (2 available, best #1)
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.1
Path #1: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.1
65002, (received & used)
10.2.4.4 from 10.2.4.4 (10.0.0.4)
Origin IGP, metric 100, localpref 100, weight 100, valid, external, best, group-best
Received Path ID 0, Local Path ID 1, version 12
Origin-AS validity: (disabled)
Path #2: Received by speaker 0
Not advertised to any peer
65002, (received & used)
10.2.5.5 from 10.2.5.5 (10.0.0.5)
Origin IGP, metric 100, localpref 100, weight 100, valid, external
Received Path ID 0, Local Path ID 0, version 0
Origin-AS validity: (disabled)In STEP 0 the weight 100 toward R4 decides and the MED values (100 and 200) are never looked at. Levelling WEIGHT in STEP 6 makes MED the deciding criterion, and levelling MED in STEP 7 leaves only step (9) onward.
Steps (9) keep the existing best path, (11) CLUSTER_LIST length and (12) neighbor IP address were not observed in this verification.
STEP 8 was meant to reset R2’s session to see (9), but clear bgp ipv4 unicast 10.2.4.4 returned % Incomplete command. on IOS XR 26.1.1 and never ran.
Even if it had, R4’s Router ID (10.0.0.4) is lower than R5’s (10.0.0.5) in this topology, so (9) and (10) could not be told apart.
Step (9) is observed on real devices in BGP AS_PATH Attribute, which follows STEP by STEP how the best path does not return after an AS_PATH prepend is added and then removed.
COMMUNITY Crosses Two ASes
COMMUNITY is optional transitive, so a router that supports it passes it on across AS boundaries. Only R2 in AS 65001 attaches it.
RP/0/RP0/CPU0:R7#show bgp 192.168.2.0/24
Wed Sep 23 13:17:17.693 UTC
BGP routing table entry for 192.168.2.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 6 6
Last Modified: Sep 23 11:33:33.023 for 01:43:44
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002 65001, (received & used)
10.4.7.4 from 10.4.7.4 (10.0.0.4)
Origin IGP, localpref 100, valid, external, best, group-best
Received Path ID 0, Local Path ID 1, version 6
Origin-AS validity: (disabled)RP/0/RP0/CPU0:R7#show bgp 192.168.2.0/24
Wed Sep 23 13:24:19.299 UTC
BGP routing table entry for 192.168.2.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 10 10
Last Modified: Sep 23 13:17:56.023 for 00:06:23
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002 65001, (received & used)
10.4.7.4 from 10.4.7.4 (10.0.0.4)
Origin IGP, localpref 100, valid, external, best, group-best
Received Path ID 0, Local Path ID 1, version 10
Community: 65001:100
Origin-AS validity: (disabled)RP/0/RP0/CPU0:R7#show bgp 192.168.2.0/24
Wed Sep 23 13:31:14.786 UTC
BGP routing table entry for 192.168.2.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 13 13
Last Modified: Sep 23 13:24:56.023 for 00:06:18
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002 65001, (received & used)
10.4.7.4 from 10.4.7.4 (10.0.0.4)
Origin IGP, localpref 100, valid, external, best, group-best
Received Path ID 0, Local Path ID 1, version 13
Origin-AS validity: (disabled)It does not arrive until STEP 9 because R4 has no send-community-ebgp toward R7. Adding it in STEP 10 carries the value all the way to R7, and when R2 stops sending in STEP 11 it disappears.
Whether an attribute is transitive and whether an implementation sends it are two different things. IOS XR and IOS XE suppress sending COMMUNITY to eBGP peers by default (send-community-ebgp on IOS XR, send-community on IOS XE).
Verification Configs and show Output
Each STEP captures the following files from all seven routers, one file per router and kind. The verification config is the ..._run.txt (final state: STEP 11).
| File | Contents |
|---|---|
..._show.txt | show version / show interface description / show route / show bgp / show bgp summary / show route bgp / show bgp for 192.168.100.0/24, 192.168.1.0/24 and 192.168.2.0/24 / show bgp neighbors / per-peer advertised-routes, routes and received routes / show bgp update-group / show bgp process / show rpl route-policy. R1 to R3 also include show ospf neighbor / show route ospf; R1 also includes show route 192.168.100.0/24 / show cef 192.168.100.0/24 |
..._log.txt | show logging limited to that STEP |
..._run.txt | show running-config at that STEP (the verification config for that STEP) |
..._ping.txt | 50 pings and a traceroute from R1 to 192.168.100.1, and pings from R7 to 192.168.1.1 |
..._trace.txt | show bgp trace neighbor and show bgp trace error |
..._commit.cfg | The configuration actually committed in that STEP (only the routers that were changed) |
..._exec.txt | The clear command and its time in that STEP (R2 in STEP 8) |
STEP 0: none (initial state)
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | — |
| R2 | show | log | run | — | trace | — |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 1: weight 100 on R1’s R3 neighbor as well
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | commit |
| R2 | show | log | run | — | trace | — |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 2: set local-preference 200 in R1’s FROM-R2 as well
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | commit |
| R2 | show | log | run | — | trace | — |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 3: bgp bestpath as-path ignore on R1
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | commit |
| R2 | show | log | run | — | trace | — |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 4: R4 switches to network, levelling ORIGIN
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | — |
| R2 | show | log | run | — | trace | — |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | commit |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 5: OSPF cost 100 on R1 - R2 as well, levelling the metric
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | commit |
| R2 | show | log | run | — | trace | — |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 6: weight 100 on R2’s R5 neighbor as well
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | — |
| R2 | show | log | run | — | trace | commit |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 7: MED 100 in R5’s TO-R2 as well, levelling MED
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | — |
| R2 | show | log | run | — | trace | — |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | commit |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 8: clear bgp ipv4 unicast 10.2.4.4 on R2
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | — |
| R2 | show | log | run | — | trace | exec |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 9: bgp bestpath compare-routerid on R2
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | — |
| R2 | show | log | run | — | trace | commit |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 10: send-community-ebgp on R4 (toward R7)
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | — |
| R2 | show | log | run | — | trace | — |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | commit |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
STEP 11: remove send-community-ebgp from R2 (final state)
| Router | show output | syslog | running-config | ping | trace | Committed config |
|---|---|---|---|---|---|---|
| R1 | show | log | run | ping | trace | — |
| R2 | show | log | run | — | trace | commit |
| R3 | show | log | run | — | trace | — |
| R4 | show | log | run | — | trace | — |
| R5 | show | log | run | — | trace | — |
| R6 | show | log | run | — | trace | — |
| R7 | show | log | run | ping | trace | — |
Packet captures were taken per STEP.
| STEP | R1 - R2 (iBGP) | R2 - R4 (eBGP) | R4 - R7 (eBGP) |
|---|---|---|---|
| 0 | pcap | pcap | pcap |
| 1 | pcap | pcap | pcap |
| 2 | pcap | pcap | pcap |
| 3 | pcap | pcap | pcap |
| 4 | pcap | pcap | pcap |
| 5 | pcap | pcap | pcap |
| 6 | pcap | pcap | pcap |
| 7 | pcap | pcap | pcap |
| 8 | pcap | pcap | pcap |
| 9 | pcap | pcap | pcap |
| 10 | pcap | pcap | pcap |
| 11 | pcap | pcap | pcap |
References
| Source | Title | Summary |
|---|---|---|
| RFC 4271 | A Border Gateway Protocol 4 (BGP-4) | Defines the four categories of path attributes (section 5), the degree of preference from LOCAL_PREF (9.1.1) and the tie-breaking procedure (9.1.2.2). |
| RFC 7606 | Revised Error Handling for BGP UPDATE Messages | Assigns per-attribute handling for malformed attributes (attribute discard / treat-as-withdraw / session reset). |
| RFC 1997 | BGP Communities Attribute | Defines the COMMUNITY attribute. |
| RFC 4360 | BGP Extended Communities Attribute | Defines the EXTENDED COMMUNITIES attribute. |
| RFC 4456 | BGP Route Reflection | Defines ORIGINATOR_ID and CLUSTER_LIST and their impact on route selection (section 9). |
| RFC 4760 | Multiprotocol Extensions for BGP-4 | Defines MP_REACH_NLRI and MP_UNREACH_NLRI. |
| RFC 6793 | BGP Support for Four-Octet AS Number Space | Defines AS4_PATH and AS4_AGGREGATOR. |
| RFC 8092 | BGP Large Communities Attribute | Defines the LARGE_COMMUNITY attribute. |
| IANA | Border Gateway Protocol (BGP) Parameters | Registry of numbers used in BGP, including path attribute type codes. |
Related Articles
- BGP (Border Gateway Protocol)
- BGP Messages
- BGP Neighbor States
- iBGP vs. eBGP
- BGP next-hop-self
- BGP Route Reflector
- BGP Path Attributes and Best Path Selection
- BGP ORIGIN Attribute
- BGP AS_PATH Attribute
- BGP NEXT_HOP Attribute
- BGP LOCAL_PREF Attribute
- BGP MED Attribute
- BGP WEIGHT Attribute
- BGP COMMUNITY Attribute
- BGP Route Aggregation (aggregate-address)
- MP-BGP (Multiprotocol Extensions)
- BGP Extended Community
- BGP Multipath (maximum-paths)
- BGP Four-Octet AS Numbers (RFC 6793)
- Removing Private AS Numbers in BGP (remove-private-AS)
- BGP ADD-PATH (RFC 7911)
- BGP PIC (Prefix Independent Convergence)
- BGP Best External (advertising a non-best external route)