Explore how BGP Origin Code influences path selection in routing decisions. Learn the differences between IGP, EGP, and Incomplete origins with configuration examples, verification outputs, common mistakes, and interview questions for a clear understanding of this BGP attribute.
When we dive into BGP path selection, it’s all about how routers decide the best path when multiple options are available to reach the same destination.
So far in our journey, we’ve explored attributes like
The next attribute that comes into play is the Origin Code. While it may not seem as powerful as the earlier ones, it still plays a vital role when BGP has to break ties between multiple routes. Let’s explore this in detail.
What is BGP Origin Code?
The Origin Code is an attribute that tells BGP how a particular route was learned or injected into BGP. It’s essentially the “story” of the route’s origin. There are three possible values:
- i → IGP
- The route was injected into BGP using the network command.
- Considered the most preferred.
- e → EGP
- The route was learned from the legacy Exterior Gateway Protocol (EGP).
- Rarely seen in modern networks.
- ? → Incomplete
- The route was redistributed into BGP (e.g., from static routes or IGP protocols like OSPF/EIGRP).
- Least preferred because BGP cannot confirm its origin with certainty.
Preference order:
IGP (i) > EGP (e) > Incomplete (?)
Configuration Example –

In this lab, we’ll continue with the same network topology used in the previous blog on BGP AS-Path. However, instead of focusing on path length, we’ll now advertise the loopback interface IP using two different methods, as illustrated in the diagram above.
In the diagram above:
- R2 (ASN 200) advertises the loopback prefix 10.10.10.10/32 into BGP using the network command.
- This marks the route with Origin Code = i (IGP).
- R3 (ASN 300) advertises the same loopback prefix 10.10.10.10/32, but instead of using the network command, it injects the route into BGP using the redistribute connected command.
- This marks the route with Origin Code = ? (Incomplete).
- R1 (ASN 100) receives the same prefix 10.10.10.10/32 from both R2 and R3. Since the AS-Path length is equal in both cases, R1 must look at the next attribute in the BGP decision process — the Origin Code — to decide which path to prefer.
Configuration –
conf t
interface g1/0
no shutdown
ip address 12.1.1.1 255.255.255.0
interface g2/0
no shutdown
ip address 13.1.1.1 255.255.255.0
router bgp 100
neighbor 12.1.1.2 remote-as 200
neighbor 13.1.1.3 remote-as 300
conf t
interface g1/0
no shutdown
ip address 12.1.1.2 255.255.255.0
router bgp 200
neighbor 12.1.1.1 remote-as 100
conf t
interface g2/0
no shutdown
ip address 13.1.1.3 255.255.255.0
router bgp 300
neighbor 13.1.1.1 remote-as 100
Lets verify –
BGP is showing UP with the both neighbor

Now, we’ll advertise the loopback interface IP into BGP using the network command on both R2 and R3, and then observe at R1 which route BGP prefers.


In the output below, you can see that R1 selects the best path through R2. Since the BGP attributes — Weight, Local Preference, and AS-Path length — are all the same, and the Origin Code is also identical (i – IGP), R1 still chooses the path via R2 as the best route.

Next, let’s explore the BGP path selection attribute Origin Code and see how it can change the best path from R2 to R3. As you already know, the preference order is i > e > ?. To demonstrate this, we’ll modify our advertisements: R2 will now advertise the prefix using the redistribute connected command, while R3 will continue to advertise the same prefix using the network command (as it was already configured).
Now, let’s update the configuration on R2 –
let’s verify which path the R1 router selects as the best route –
As you can see from the Origin Code in the output below, the best path selection has now shifted to R3. This is because the incomplete (redistributed) route from R2 is less preferred compared to the route advertised with the network command from R3.

Key Takeaways
- The Origin Code helps BGP break ties when higher-priority attributes are equal.
- Preference order: IGP (i) > EGP (e) > Incomplete (?).
- In real-world scenarios, you’ll most often see i and ?, since e is nearly obsolete.
- While it’s not a top influencer like Weight or Local Preference, it still ensures consistency in best-path selection.
Common Mistakes with BGP Origin Code
- Assuming Origin Code is the main decision factor
- Many beginners think Origin Code heavily influences routing.
- In reality, it is a tie-breaker attribute — only used when Weight, Local Preference, and AS-Path are equal.
- Redistributing everything into BGP
- Engineers sometimes redistribute OSPF/EIGRP routes into BGP without filters.
- This leads to many routes marked as Origin = ?, which can create unnecessary complexity and even routing loops.
- Ignoring the preference order (i > e > ?)
- Some assume ? is “bad” and will never be selected.
- That’s incorrect — if no better path exists, BGP will still install a route with ?.
- Misunderstanding “e” (EGP)
- Since EGP is obsolete, engineers are often confused when they see “e” in older textbooks or exam dumps.
- In modern real-world networks, you’ll almost never encounter e.
- Not verifying with show ip bgp
- A common mistake is to forget checking the BGP table output.
- The Origin Code is always shown in the last column (i, e, ?) — easy to miss if you’re only looking at the Next Hop or Path.
Common Interview Questions on BGP Origin Code
- What are the three possible values of the Origin Code in BGP?
- Answer: i (IGP), e (EGP), ? (Incomplete).
- Which Origin Code is preferred if all other attributes are equal?
- Answer: IGP (i) is most preferred, followed by EGP (e), and then Incomplete (?).
- When does a route show Origin Code “i”?
- Answer: When it is injected into BGP using the network or aggregate command.
- What does Origin Code “?” mean, and when do you usually see it?
- Answer: It means the route was redistributed into BGP (from static/IGP). Seen most often in redistribution scenarios.
- Can Origin Code alone determine the best path?
- Answer: No. It only comes into play if higher-priority attributes like Weight, Local Preference, and AS-Path are equal.
Conclusion
The Origin Code might look like a small attribute, but it plays a crucial role in ensuring deterministic path selection. When designing or troubleshooting BGP networks, always pay attention to the origin of routes – it might just explain why one path is being preferred over another.
In our next post, we’ll move forward with the next BGP selection criteria after Origin Code and see how the decision-making process continues.