PacketLab
BGP · Attributes and Path Selection

BGP Origin Code

Read the final i, e or ? as an attribute of route origination, not as the internal or external type of the BGP session.

Network and origination

Use the same three-router AS arrangement as the prepend lab. Begin with the baseline network statements below, then on R3 replace only the target network statement with filtered connected redistribution.

Lab topologyIllustrative network
.1 / .2 · eBGP.5 / .6 · eBGPR1AS 65010R2AS 65020R3AS 65010
Solid lines: physical links. Link labels use the last octet of 192.0.2.x; every link is a separate /30. AS labels identify the protocol relationship. Loopback0 is 10.255.0.N/32 for router RN. Exact interfaces and subnets are listed below.
LinkFirst endpointSecond endpoint
R1–R2R1 GigabitEthernet1: 192.0.2.1/30R2 GigabitEthernet1: 192.0.2.2/30
R2–R3R2 GigabitEthernet2: 192.0.2.5/30R3 GigabitEthernet1: 192.0.2.6/30
Complete baseline configurations

R1

hostname R1
ip cef
interface Loopback0
 ip address 10.255.0.1 255.255.255.255
exit
interface Loopback10
 ip address 198.51.100.1 255.255.255.0
exit
interface GigabitEthernet1
 ip address 192.0.2.1 255.255.255.252
 no shutdown
exit
router bgp 65010
 bgp router-id 10.255.0.1
 no bgp default ipv4-unicast
 neighbor 192.0.2.2 remote-as 65020
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.2 activate
  network 198.51.100.0 mask 255.255.255.0
 exit-address-family
end

R2

hostname R2
ip cef
interface Loopback0
 ip address 10.255.0.2 255.255.255.255
exit
interface GigabitEthernet1
 ip address 192.0.2.2 255.255.255.252
 no shutdown
exit
interface GigabitEthernet2
 ip address 192.0.2.5 255.255.255.252
 no shutdown
exit
router bgp 65020
 bgp router-id 10.255.0.2
 no bgp default ipv4-unicast
 neighbor 192.0.2.1 remote-as 65010
 neighbor 192.0.2.6 remote-as 65010
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.1 activate
  neighbor 192.0.2.6 activate
 exit-address-family
end

R3

hostname R3
ip cef
interface Loopback0
 ip address 10.255.0.3 255.255.255.255
exit
interface Loopback10
 ip address 198.51.100.3 255.255.255.0
exit
interface GigabitEthernet1
 ip address 192.0.2.6 255.255.255.252
 no shutdown
exit
router bgp 65010
 bgp router-id 10.255.0.3
 no bgp default ipv4-unicast
 neighbor 192.0.2.5 remote-as 65020
 address-family ipv4 unicast
  no auto-summary
  neighbor 192.0.2.5 activate
  network 198.51.100.0 mask 255.255.255.0
 exit-address-family
end
Outputs are illustrative, not recorded router results. Each lesson is a separate lab. Allow updates to converge after changes; the selected baseline path is an example when all earlier criteria tie.
ip prefix-list TARGET seq 5 permit 198.51.100.0/24
route-map CONNECTED-TARGET permit 10
 match ip address prefix-list TARGET
 set metric 0
exit
route-map CONNECTED-TARGET deny 20
exit
router bgp 65010
 address-family ipv4 unicast
  no network 198.51.100.0 mask 255.255.255.0
  redistribute connected route-map CONNECTED-TARGET
 exit-address-family

The prefix-list filter permits only the /24. R1 still uses network origination. Leave AS-path length, local preference, weight and MED tied to isolate ORIGIN.

Compare origin codes

R2# show ip bgp 198.51.100.0/24
     Network          Next Hop        Metric LocPrf Weight Path
*>   198.51.100.0/24  192.0.2.1            0             0 65010 i
*                     192.0.2.6            0             0 65010 ?
CodeMeaningPreference when earlier checks tie
iIGP origin, normally created by network originationFirst
eHistorical EGP originSecond
?Incomplete origin, normally created by redistributionThird

R2 prefers the i path here. Incomplete does not mean corrupt or unreachable; it describes how the route was introduced. Policies can set the value explicitly.

Change origin with policy

In a separate lab policy experiment, set R1’s exported origin to incomplete and R3’s exported origin to IGP. On R1:

ip prefix-list TARGET seq 5 permit 198.51.100.0/24
route-map ORIGIN-TEST permit 10
 match ip address prefix-list TARGET
 set origin incomplete
exit
route-map ORIGIN-TEST permit 20
exit
router bgp 65010
 address-family ipv4 unicast
  neighbor 192.0.2.2 route-map ORIGIN-TEST out
 exit-address-family

On R3:

ip prefix-list TARGET seq 5 permit 198.51.100.0/24
route-map ORIGIN-TEST permit 10
 match ip address prefix-list TARGET
 set origin igp
exit
route-map ORIGIN-TEST permit 20
exit
router bgp 65010
 address-family ipv4 unicast
  neighbor 192.0.2.5 route-map ORIGIN-TEST out
 exit-address-family
R1# clear ip bgp 192.0.2.2 soft out
R3# clear ip bgp 192.0.2.5 soft out
R2# show ip bgp 198.51.100.0/24
     Network          Next Hop        Metric LocPrf Weight Path
*    198.51.100.0/24  192.0.2.1            0             0 65010 ?
*>                    192.0.2.6            0             0 65010 i

Interpret the result

Both candidates are external paths at R2, even though one ends in i. A leading i in the status area would identify an internal path; the trailing i is ORIGIN. ORIGIN also differs from “locally originated on this router,” which is checked earlier. It does not name the source AS; the ordinary AS sequence supplies that information.

Restore the experiment

Detach the test policy from each originator; keep R3’s filtered redistribution to return to the original i-versus-? comparison.

R1

router bgp 65010
 address-family ipv4 unicast
  no neighbor 192.0.2.2 route-map ORIGIN-TEST out
 exit-address-family

R3

router bgp 65010
 address-family ipv4 unicast
  no neighbor 192.0.2.5 route-map ORIGIN-TEST out
 exit-address-family
R1# clear ip bgp 192.0.2.2 soft out
R3# clear ip bgp 192.0.2.5 soft out
R2# show ip bgp 198.51.100.0/24
     Network          Next Hop        Metric LocPrf Weight Path
*>   198.51.100.0/24  192.0.2.1            0             0 65010 i
*                     192.0.2.6            0             0 65010 ?

Key Takeaways

  • The trailing i, e or ? is the ORIGIN attribute.
  • When earlier checks tie, i is preferred to e, and e to ?.
  • Network origination normally produces i; redistribution normally produces ?.
  • Incomplete origin does not mean that a path is corrupt or unusable.
  • Leading internal-path status, local origination and the source AS are separate concepts.

Origin Code Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. Which order is preferred when earlier checks tie?
2. What does trailing i mean in an externally learned row?
3. What normally produces ? in this experiment?
4. Does incomplete mean the prefix cannot be forwarded?
5. Can a route map set ORIGIN explicitly?
6. Where does leading i belong in the table?
Protocol and command references

Best-path comparison rules · BGP path attributes · Router-symbol attribution.