Understanding the BGP Origin Code Attribute

Understanding the BGP Origin Code Attribute
Understanding the BGP Origin Code Attribute
When you check out a BGP route, you’ll notice several attributes that help routers decide which path to use. The Origin code is one of the simplest and is often overlooked. Even though it isn’t as important as local preference or MED, it still affects path selection and can show you how a route first entered BGP.

What Is the Origin Code?

The Origin attribute is a required part of every BGP route. It shows how the prefix was learned before it got into BGP. You can think of it as a short backstory for each route. There are just three possible values:

  • IGP (i): The route was added to BGP from an Interior Gateway Protocol, such as OSPF or IS-IS, using the network command. This type is the most preferred.
  • EGP (e): The route came from the old Exterior Gateway Protocol, which is now obsolete. You probably won’t see this today, but the code is still there for compatibility.
  • Incomplete (?) – The route didn’t come directly from an IGP. Usually this means it was redistributed into BGP from another source (like static, connected, or learned through redistribution from another protocol). It’s considered the least preferred.

Why It Matters

Routers use the Origin code as one part of the BGP decision process when there are several paths to the same prefix. It is not the main deciding factor, but it can help break a tie. For example, if two routes are equal in local preference, AS path length, and other attributes, the router will choose IGP (i) over Incomplete (?).

For network engineers, Origin codes can also act as a troubleshooting clue. If you’re looking at a route and see a question mark, you know it wasn’t advertised using the network statement—it came from redistribution. That might help you trace back a misconfiguration or understand how that prefix made its way into your table.

Real-World Example

Here’s a snippet from a Cisco show ip bgp output:

ywAAAAAAQABAAACAUwAOw==
Understanding the bgp origin code attribute 2

Both paths go to the same prefix. If everything else is equal, the path with Origin code i (IGP) will be chosen instead of the one with ? (Incomplete).

The post Understanding the BGP Origin Code Attribute appeared first on j2sw Blog.


Discover more from RSS Feeds Cloud

Subscribe to get the latest posts sent to your email.

Discover more from RSS Feeds Cloud

Subscribe now to keep reading and get access to the full archive.

Continue reading