↓ Skip to main content
  1. Network Articles/
  2. BGP Articles/

BGP ORIGIN Attribute

Table of Contents

What Is ORIGIN?

ORIGIN (type code 1) is a well-known mandatory path attribute that shows how the route entered BGP (BGP Path Attributes and Best Path Selection). The value is one octet, set by the router that brought the route into BGP, and RFC 4271 section 5.1.1 says no other speaker should change it.

The Three Values

ValueNameMeaning
0IGPA BGP speaker put the route into BGP explicitly, as a route interior to its own AS.
1EGPLearned from EGP (RFC 904), the predecessor of BGP. EGP is no longer used, so this never appears in practice.
2IncompleteThe route entered BGP some other way. Routes injected by redistribution fall here.

In show bgp the value appears as a single character at the end of each line (i / e / ?). Inside an UPDATE it is a one-octet number (0 / 1 / 2); the character in show is that value condensed to one letter.

The i in the third column of *>i is the status code for “internal” (learned over iBGP) and has nothing to do with the i at the end of the line.

Which Operation Produces Which Value

How the route enters BGPORIGIN
Declared explicitly with networkIGP (i)
Generated as an aggregate with aggregate-addressIGP if every component is IGP. If at least one component is Incomplete the aggregate is Incomplete; if none is Incomplete but at least one is EGP it is EGP (RFC 4271 9.2.2.2, BGP route aggregation)
Redistributed from another protocol, a static route or a connected routeIncomplete (?)

network is the administrator declaring routes one by one, hence IGP; redistribute pours in another protocol’s routes, whose provenance BGP cannot see, hence Incomplete.

Where It Sits in Best Path Selection

ORIGIN is compared at the fifth step of best path selection, and the lower value wins (IGP < EGP < Incomplete). In practice LOCAL_PREF or AS_PATH length usually decides first, so ORIGIN matters only when everything above it is tied - for instance when the same prefix is injected at two places in the AS, once with network and once with redistribute.

Levelling ORIGIN to IGP When Advertising to eBGP

Routes originated in your own AS with network are IGP from the start. With redistribute even local routes end up as a mix of i and ?, which can affect best path selection in the neighboring AS. One way to avoid that is a route policy that levels the value to IGP on the way out to eBGP.

Rewriting ORIGIN erases the information about how the route entered BGP, and RFC 4271 section 5.1.1 says other speakers should not change it. Keep it to cases where the mix of ? actually causes trouble, and be careful not to apply it to routes received from other ASes (transit routes).

The simple form levels every route sent to that peer.

IOS XR: level ORIGIN to IGP for every route
route-policy EBGP-OUT
  set origin igp
  pass
end-policy
!
router bgp <AS number>
 neighbor <eBGP peer address>
  address-family ipv4 unicast
   route-policy EBGP-OUT out
  !
 !
!
IOS XE: level ORIGIN to IGP for every route
route-map EBGP-OUT permit 10
 set origin igp
!
router bgp <AS number>
 address-family ipv4
  neighbor <eBGP peer address> activate
  neighbor <eBGP peer address> route-map EBGP-OUT out

The pass on IOS XR and the permit 10 on IOS XE both mean “let every route through”; without them nothing is advertised at all.

This form also hits transit routes. To limit it to routes originated in your own AS, match an empty AS_PATH (^$). The local AS number is prepended after the route policy runs, so from an outbound policy’s point of view a locally originated route has an empty AS_PATH.

IOS XR: level ORIGIN only for locally originated routes
as-path-set LOCAL-ORIGIN
  ios-regex '^$'
end-set
!
route-policy EBGP-OUT
  if as-path in LOCAL-ORIGIN then
    set origin igp
  endif
  pass
end-policy
IOS XE: level ORIGIN only for locally originated routes
ip as-path access-list 1 permit ^$
!
route-map EBGP-OUT permit 10
 match as-path 1
 set origin igp
!
route-map EBGP-OUT permit 20

The empty permit 20 on IOS XE lets the non-matching routes through; without it everything that is not locally originated is dropped.

Verification on Real Devices

Six XRd 26.1.1 routers confirm (1) that ORIGIN decides the best path when everything above it is tied, and (2) what differs between rewriting every route and limiting the rewrite with ^$.

RouterASRole
R165001Advertises 192.168.99.0/24 with network (ORIGIN is i); Loopback99 holds the prefix
R265001Observation point. Receives R1’s i and R3’s ? at the same time
R365001Advertises the same 192.168.99.0/24 with redistribute static (ORIGIN is ?). eBGP with R4
R465002Receives from R3. The peer used for the outbound policy tests
R565003One AS further out, to see whether the rewrite travels that far
R665004Source of the transit routes: 192.168.6.0/24 via network (i) and 192.168.66.0/24 via redistribute static (?)

AS 65001 runs OSPF area 0, with a full mesh of iBGP sessions between the Loopback0s. R3’s static route points at R1’s Loopback0 (10.0.0.1) recursively, so even when R3’s path wins, traffic still reaches R1’s Loopback99.

STEPChangeWhat to check
0none (initial state)Steps 1 to 4 are tied, so ORIGIN decides at step 5 (i wins)
1no network 192.168.99.0/24 on R1The i route disappears and R2’s best becomes ?; R4, R5 and R6 show ? at the end of the line too
2Restore network on R1Back to the STEP 0 state
3EBGP-OUT-ALL on R3 (set origin igp for every route)Not only the local route: the transit route is rewritten to i as well
4EBGP-OUT-LOCAL on R3 (^$ only, final state)Only the locally originated route becomes i; the transit route stays ?

In every STEP R4 and R5 send 50 pings and a traceroute to 192.168.99.1, which also records which path carried the traffic.

STEP 0: ORIGIN Decides the Best Path

In R2’s BGP table only 192.168.99.0/24 has two lines, ending in i (from R1) and ? (from R3).

R2 show bgp (STEP 0)
RP/0/RP0/CPU0:R2#show bgp
Sun Sep 27 12:33:27.495 UTC
BGP router identifier 10.0.0.2, local AS number 65001
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000   RD version: 11
BGP main routing table version 11
BGP NSR Initial initsync version 3 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0
BGP scan interval 60 secs

Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*>i192.168.1.0/24     10.0.0.1                 0    100      0 i
*> 192.168.2.0/24     0.0.0.0                  0         32768 i
*>i192.168.3.0/24     10.0.0.3                 0    100      0 i
*>i192.168.4.0/24     10.3.4.4                 0    100      0 65002 i
*>i192.168.5.0/24     10.3.4.4                      100      0 65002 65003 i
*>i192.168.6.0/24     10.1.6.6                 0    100      0 65004 i
*>i192.168.66.0/24    10.1.6.6                 0    100      0 65004 ?
*>i192.168.99.0/24    10.0.0.1                 0    100      0 i
* i                   10.0.0.1                 0    100      0 ?

Processed 8 prefixes, 9 paths

The detailed output shows that steps 1 to 4 are all tied. The NEXT_HOP and the IGP metric are the same; the only difference is ORIGIN.

R2 show bgp 192.168.99.0/24 (STEP 0)
RP/0/RP0/CPU0:R2#show bgp 192.168.99.0/24
Sun Sep 27 12:33:28.055 UTC
BGP routing table entry for 192.168.99.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                  8            8
Last Modified: Sep 27 12:25:36.023 for 00:07:52
Paths: (2 available, best #1)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Not advertised to any peer
  Local, (received & used)
    10.0.0.1 (metric 2) from 10.0.0.1 (10.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
      Received Path ID 0, Local Path ID 1, version 8
  Path #2: Received by speaker 0
  Not advertised to any peer
  Local, (received & used)
    10.0.0.1 (metric 2) from 10.0.0.3 (10.0.0.3)
      Origin incomplete, metric 0, localpref 100, valid, internal
      Received Path ID 0, Local Path ID 0, version 0
OrderCriterionPath #1 (from R1)Path #2 (from R3)Result
1WEIGHT00tied
2LOCAL_PREF100100tied
3Locally originatedboth learned over iBGPboth learned over iBGPtied
4AS_PATH length0 (originated inside the AS)0 (originated inside the AS)tied
5ORIGINIGPIncompletePath #1 wins

Because R3’s static route points at R1’s Loopback0, the NEXT_HOP is 10.0.0.1 on both paths. Whichever is chosen, traffic goes to the same router, R1, and the pings from R4 in AS 65002 to 192.168.99.1 get through.

R2 show route bgp (STEP 0)
RP/0/RP0/CPU0:R2#show route bgp
Sun Sep 27 12:33:27.791 UTC

B    192.168.1.0/24 [200/0] via 10.0.0.1, 00:07:52
B    192.168.3.0/24 [200/0] via 10.0.0.3, 00:08:03
B    192.168.4.0/24 [200/0] via 10.3.4.4, 00:08:03
B    192.168.5.0/24 [200/0] via 10.3.4.4, 00:08:03
B    192.168.6.0/24 [200/0] via 10.1.6.6, 00:07:51
B    192.168.66.0/24 [200/0] via 10.1.6.6, 00:07:51
B    192.168.99.0/24 [200/0] via 10.0.0.1, 00:07:52
R4 ping / traceroute 192.168.99.1 (STEP 0)
RP/0/RP0/CPU0:R4#ping 192.168.99.1 source 192.168.4.1 count 50 timeout 1
Sun Sep 27 12:34:51.497 UTC
Type escape sequence to abort.
Sending 50, 100-byte ICMP Echos to 192.168.99.1 timeout is 1 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (50/50), round-trip min/avg/max = 6/11/52 ms
RP/0/RP0/CPU0:R4#traceroute 192.168.99.1 source 192.168.4.1 probe 3 timeout 1 maxttl 6
Sun Sep 27 12:34:53.105 UTC

Type escape sequence to abort.
Tracing the route to 192.168.99.1

 1  10.3.4.3 6 msec  5 msec  4 msec 
 2  10.1.3.1 10 msec  *  10 msec 

STEP 1: Removing the i Route Makes the ? Route Win

The network statement is removed from R1, which deletes the i route.

R1 removing network (STEP 1, R1 commit)
RP/0/RP0/CPU0:R1#show configuration commit changes last 1
Sun Sep 27 12:37:03.574 UTC
!! Building configuration...
!! IOS XR Configuration 26.1.1
router bgp 65001
 address-family ipv4 unicast
  no network 192.168.99.0/24
 !
!
end

R2 is left with R3’s Origin incomplete path, and in the neighboring AS 65004 (R6) the end of the line changes from i to ?.

R2 show bgp 192.168.99.0/24 (STEP 0)
RP/0/RP0/CPU0:R2#show bgp 192.168.99.0/24
Sun Sep 27 12:33:28.055 UTC
BGP routing table entry for 192.168.99.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                  8            8
Last Modified: Sep 27 12:25:36.023 for 00:07:52
Paths: (2 available, best #1)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Not advertised to any peer
  Local, (received & used)
    10.0.0.1 (metric 2) from 10.0.0.1 (10.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
      Received Path ID 0, Local Path ID 1, version 8
  Path #2: Received by speaker 0
  Not advertised to any peer
  Local, (received & used)
    10.0.0.1 (metric 2) from 10.0.0.3 (10.0.0.3)
      Origin incomplete, metric 0, localpref 100, valid, internal
      Received Path ID 0, Local Path ID 0, version 0
R2 show bgp 192.168.99.0/24 (STEP 1)
RP/0/RP0/CPU0:R2#show bgp 192.168.99.0/24
Sun Sep 27 12:39:55.014 UTC
BGP routing table entry for 192.168.99.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 12           12
Last Modified: Sep 27 12:37:39.023 for 00:02:16
Paths: (1 available, best #1)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Not advertised to any peer
  Local, (received & used)
    10.0.0.1 (metric 2) from 10.0.0.3 (10.0.0.3)
      Origin incomplete, metric 0, localpref 100, valid, internal, best, group-best
      Received Path ID 0, Local Path ID 1, version 12
R6 show bgp (STEP 0)
RP/0/RP0/CPU0:R6#show bgp
Sun Sep 27 12:36:27.824 UTC
BGP router identifier 10.0.0.6, local AS number 65004
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000   RD version: 10
BGP main routing table version 10
BGP NSR Initial initsync version 4 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0
BGP scan interval 60 secs

Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*> 192.168.1.0/24     10.1.6.1                 0             0 65001 i
*> 192.168.2.0/24     10.1.6.1                               0 65001 i
*> 192.168.3.0/24     10.1.6.1                               0 65001 i
*> 192.168.4.0/24     10.1.6.1                               0 65001 65002 i
*> 192.168.5.0/24     10.1.6.1                               0 65001 65002 65003 i
*> 192.168.6.0/24     0.0.0.0                  0         32768 i
*> 192.168.66.0/24    0.0.0.0                  0         32768 ?
*> 192.168.99.0/24    10.1.6.1                 0             0 65001 i

Processed 8 prefixes, 8 paths
R6 show bgp (STEP 1)
RP/0/RP0/CPU0:R6#show bgp
Sun Sep 27 12:42:58.136 UTC
BGP router identifier 10.0.0.6, local AS number 65004
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000   RD version: 11
BGP main routing table version 11
BGP NSR Initial initsync version 4 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0
BGP scan interval 60 secs

Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*> 192.168.1.0/24     10.1.6.1                 0             0 65001 i
*> 192.168.2.0/24     10.1.6.1                               0 65001 i
*> 192.168.3.0/24     10.1.6.1                               0 65001 i
*> 192.168.4.0/24     10.1.6.1                               0 65001 65002 i
*> 192.168.5.0/24     10.1.6.1                               0 65001 65002 65003 i
*> 192.168.6.0/24     0.0.0.0                  0         32768 i
*> 192.168.66.0/24    0.0.0.0                  0         32768 ?
*> 192.168.99.0/24    10.1.6.1                               0 65001 ?

Processed 8 prefixes, 8 paths

The capture on the R1 - R6 link shows ORIGIN as a number. No.4 in STEP 1 is INCOMPLETE (2), and No.3 after network is restored in STEP 2 is IGP (0).

STEP 1 R1 - R6 No.4 UPDATE (R1 to R6) tshark -V (excerpt)
Border Gateway Protocol - UPDATE Message
<snip>
        Path Attribute - MP_REACH_NLRI
<snip>
            Next hop: 10.1.6.1
<snip>
                192.168.99.0/24
<snip>
        Path Attribute - ORIGIN: INCOMPLETE
<snip>
            Origin: INCOMPLETE (2)
        Path Attribute - AS_PATH: 65001 
<snip>
                AS4: 65001
STEP 2 R1 - R6 No.3 UPDATE (R1 to R6) tshark -V (excerpt)
Border Gateway Protocol - UPDATE Message
<snip>
        Path Attribute - MP_REACH_NLRI
<snip>
            Next hop: 10.1.6.1
<snip>
                192.168.99.0/24
<snip>
        Path Attribute - ORIGIN: IGP
<snip>
            Origin: IGP (0)
        Path Attribute - AS_PATH: 65001 
<snip>
                AS4: 65001
        Path Attribute - MULTI_EXIT_DISC: 0

Download the pcap of the packet in the tshark output above (STEP 1 No.4, ORIGIN 2)

Download the pcap of the packet in the tshark output above (STEP 2 No.3, ORIGIN 0)

Restoring network on R1 in STEP 2 brings R2’s best path back to Origin IGP. The remaining STEPs start from that state.

STEP 3: Rewriting ORIGIN for Every Route in an Outbound Policy

A policy that sets IGP on every route is applied to the eBGP session from R3 to R4.

R3 applying EBGP-OUT-ALL (STEP 3, R3 commit)
RP/0/RP0/CPU0:R3#show configuration commit changes last 1
Sun Sep 27 12:50:01.577 UTC
!! Building configuration...
!! IOS XR Configuration 26.1.1
route-policy EBGP-OUT-ALL
  set origin igp
  pass
end-policy
!
router bgp 65001
 neighbor 10.3.4.4
  address-family ipv4 unicast
   route-policy EBGP-OUT-ALL out
  !
 !
!
end

The end of each line in what R3 advertises to R4, before (STEP 2), after (STEP 3) and once limited with ^$ (STEP 4).

R3 show bgp neighbors 10.3.4.4 advertised-routes (STEP 2)
RP/0/RP0/CPU0:R3#show bgp neighbors 10.3.4.4 advertised-routes
Sun Sep 27 12:47:10.448 UTC
Network            Next Hop        From            AS Path
192.168.1.0/24     10.3.4.3        10.0.0.1        65001i
192.168.2.0/24     10.3.4.3        10.0.0.2        65001i
192.168.3.0/24     10.3.4.3        Local           65001i
192.168.6.0/24     10.3.4.3        10.0.0.1        65001 65004i
192.168.66.0/24    10.3.4.3        10.0.0.1        65001 65004?
192.168.99.0/24    10.3.4.3        Local           65001?

Processed 6 prefixes, 6 paths
R3 show bgp neighbors 10.3.4.4 advertised-routes (STEP 3)
RP/0/RP0/CPU0:R3#show bgp neighbors 10.3.4.4 advertised-routes
Sun Sep 27 12:53:39.252 UTC
Network            Next Hop        From            AS Path
192.168.1.0/24     10.3.4.3        10.0.0.1        65001i
192.168.2.0/24     10.3.4.3        10.0.0.2        65001i
192.168.3.0/24     10.3.4.3        Local           65001i
192.168.6.0/24     10.3.4.3        10.0.0.1        65001 65004i
192.168.66.0/24    10.3.4.3        10.0.0.1        65001 65004i
192.168.99.0/24    10.3.4.3        Local           65001i

Processed 6 prefixes, 6 paths
R3 show bgp neighbors 10.3.4.4 advertised-routes (STEP 4)
RP/0/RP0/CPU0:R3#show bgp neighbors 10.3.4.4 advertised-routes
Sun Sep 27 13:00:07.773 UTC
Network            Next Hop        From            AS Path
192.168.1.0/24     10.3.4.3        10.0.0.1        65001i
192.168.2.0/24     10.3.4.3        10.0.0.2        65001i
192.168.3.0/24     10.3.4.3        Local           65001i
192.168.6.0/24     10.3.4.3        10.0.0.1        65001 65004i
192.168.66.0/24    10.3.4.3        10.0.0.1        65001 65004?
192.168.99.0/24    10.3.4.3        Local           65001i

Processed 6 prefixes, 6 paths

In STEP 3 the locally originated 192.168.99.0/24 becomes i as intended, but the transit route 192.168.66.0/24 is rewritten from ? to i as well. It looks the same from AS 65003 (R5) beyond R4.

R5 show bgp (STEP 3)
RP/0/RP0/CPU0:R5#show bgp
Sun Sep 27 12:55:11.954 UTC
BGP router identifier 10.0.0.5, local AS number 65003
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000   RD version: 12
BGP main routing table version 12
BGP NSR Initial initsync version 3 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0
BGP scan interval 60 secs

Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*> 192.168.1.0/24     10.4.5.4                               0 65002 65001 i
*> 192.168.2.0/24     10.4.5.4                               0 65002 65001 i
*> 192.168.3.0/24     10.4.5.4                               0 65002 65001 i
*> 192.168.4.0/24     10.4.5.4                 0             0 65002 i
*> 192.168.5.0/24     0.0.0.0                  0         32768 i
*> 192.168.6.0/24     10.4.5.4                               0 65002 65001 65004 i
*> 192.168.66.0/24    10.4.5.4                               0 65002 65001 65004 i
*> 192.168.99.0/24    10.4.5.4                               0 65002 65001 i

Processed 8 prefixes, 8 paths

The capture confirms it: in No.3 of STEP 3 the ORIGIN of 192.168.66.0/24 is IGP (0).

STEP 3 R3 - R4 No.3 UPDATE (R3 to R4, 192.168.66.0/24) tshark -V (excerpt)
Border Gateway Protocol - UPDATE Message
<snip>
        Path Attribute - MP_REACH_NLRI
<snip>
            Next hop: 10.3.4.3
<snip>
                192.168.66.0/24
<snip>
        Path Attribute - ORIGIN: IGP
<snip>
            Origin: IGP (0)
        Path Attribute - AS_PATH: 65001 65004 
<snip>
                AS4: 65001
                AS4: 65004
Download the pcap of the packet in the tshark output above (STEP 3 No.3, transit route at 0)

STEP 4: Levelling Only the Locally Originated Routes

Adding ^$ as a condition limits the rewrite to routes originated in this AS.

R3 applying EBGP-OUT-LOCAL (STEP 4, R3 commit)
RP/0/RP0/CPU0:R3#show configuration commit changes last 1
Sun Sep 27 12:56:30.352 UTC
!! Building configuration...
!! IOS XR Configuration 26.1.1
as-path-set LOCAL-ORIGIN
  ios-regex '^$'
end-set
!
no route-policy EBGP-OUT-ALL
route-policy EBGP-OUT-LOCAL
  if as-path in LOCAL-ORIGIN then
    set origin igp
  endif
  pass
end-policy
!
router bgp 65001
 neighbor 10.3.4.4
  address-family ipv4 unicast
   route-policy EBGP-OUT-LOCAL out
  !
 !
!
end

The transit route is back to ?. In the same No.3 UPDATE, only 192.168.66.0/24 carries INCOMPLETE (2).

STEP 4 R3 - R4 No.3 UPDATE (R3 to R4, 192.168.66.0/24) tshark -V (excerpt)
Border Gateway Protocol - UPDATE Message
<snip>
        Path Attribute - MP_REACH_NLRI
<snip>
            Next hop: 10.3.4.3
<snip>
                192.168.66.0/24
<snip>
        Path Attribute - ORIGIN: INCOMPLETE
<snip>
            Origin: INCOMPLETE (2)
        Path Attribute - AS_PATH: 65001 65004 
<snip>
                AS4: 65001
                AS4: 65004
Download the pcap of the packet in the tshark output above (STEP 4 No.3, transit route at 2)

R4’s table shows the split as well: 192.168.99.0/24 is i while 192.168.66.0/24 is ?.

R4 show bgp (STEP 4)
RP/0/RP0/CPU0:R4#show bgp
Sun Sep 27 13:00:53.285 UTC
BGP router identifier 10.0.0.4, local AS number 65002
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000   RD version: 13
BGP main routing table version 13
BGP NSR Initial initsync version 4 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0
BGP scan interval 60 secs

Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*> 192.168.1.0/24     10.3.4.3                               0 65001 i
*> 192.168.2.0/24     10.3.4.3                               0 65001 i
*> 192.168.3.0/24     10.3.4.3                 0             0 65001 i
*> 192.168.4.0/24     0.0.0.0                  0         32768 i
*> 192.168.5.0/24     10.4.5.5                 0             0 65003 i
*> 192.168.6.0/24     10.3.4.3                               0 65001 65004 i
*> 192.168.66.0/24    10.3.4.3                               0 65001 65004 ?
*> 192.168.99.0/24    10.3.4.3                 0             0 65001 i

Processed 8 prefixes, 8 paths

advertised-routes displays 65001 in the AS path, but that is prepended after the policy runs. The policy sees an empty AS_PATH, which matches ^$, while 192.168.66.0/24 already carried 65004 and does not match.

192.168.1.0/24 and 192.168.2.0/24 match ^$ too, but they were already IGP, so nothing visibly changes.

Verification Configs and show Output

Each STEP captures the following files from all six routers, one file per router and kind. The verification config is the ..._run.txt (final state: STEP 4).

FileContents
..._show.txtshow version / show interface description / show route / show bgp / show bgp summary / show route bgp / show bgp for 192.168.99.0/24, 192.168.6.0/24 and 192.168.66.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 and R3 include show route 192.168.99.0/24 (R3 also show cef)
..._log.txtshow logging limited to that STEP
..._run.txtshow running-config at that STEP (the verification config for that STEP)
..._ping.txt50 pings and a traceroute from R4 and R5 to 192.168.99.1
..._trace.txtshow bgp trace neighbor and show bgp trace error
..._commit.cfgThe configuration actually committed in that STEP (only the routers that were changed)

STEP 0: initial state (an i route and a ? route)

Routershow outputsyslogrunning-configpingtraceCommitted config
R1showlogrun—trace—
R2showlogrun—trace—
R3showlogrun—trace—
R4showlogrunpingtrace—
R5showlogrunpingtrace—
R6showlogrun—trace—

STEP 1: remove network 192.168.99.0/24 from R1

Routershow outputsyslogrunning-configpingtraceCommitted config
R1showlogrun—tracecommit
R2showlogrun—trace—
R3showlogrun—trace—
R4showlogrunpingtrace—
R5showlogrunpingtrace—
R6showlogrun—trace—

STEP 2: restore network on R1

Routershow outputsyslogrunning-configpingtraceCommitted config
R1showlogrun—tracecommit
R2showlogrun—trace—
R3showlogrun—trace—
R4showlogrunpingtrace—
R5showlogrunpingtrace—
R6showlogrun—trace—

STEP 3: apply EBGP-OUT-ALL on R3 (level every route to IGP)

Routershow outputsyslogrunning-configpingtraceCommitted config
R1showlogrun—trace—
R2showlogrun—trace—
R3showlogrun—tracecommit
R4showlogrunpingtrace—
R5showlogrunpingtrace—
R6showlogrun—trace—

STEP 4: apply EBGP-OUT-LOCAL on R3 (^$ only, final state)

Routershow outputsyslogrunning-configpingtraceCommitted config
R1showlogrun—trace—
R2showlogrun—trace—
R3showlogrun—tracecommit
R4showlogrunpingtrace—
R5showlogrunpingtrace—
R6showlogrun—trace—

Packet captures were taken per STEP.

STEPR3 - R4R4 - R5R1 - R6
0pcappcappcap
1pcappcappcap
2pcappcappcap
3pcappcappcap
4pcappcappcap

References

SourceTitleSummary
RFC 4271A Border Gateway Protocol 4 (BGP-4)Section 4.3 defines the three ORIGIN values, 5.1.1 how it is generated and that it should not be changed, 9.1.2.2 the comparison in best path selection and 9.2.2.2 the value for aggregates.
RFC 904Exterior Gateway Protocol Formal SpecificationThe protocol the EGP value refers to; no longer used.
IANABorder Gateway Protocol (BGP) ParametersRegistry of numbers used in BGP, including path attribute type codes.

Related Articles