BGP Origin Code Attribute explained

Hello Govardhan

The BGP attributes path selection process is something that has been defined based on designed and extensive testing performed by engineers over the past few decades. In this process, the Origin Type attribute is checked before the MED attribute, and for good reason.

The origin attribute indicates how BGP learned the route, which is generally considered to be more important than the MED attribute.

The origin code tells you if the route was learned from an IGP, EGP, or if it was incomplete. This attribute can provide significant information about the trustworthiness of the route because it indicates the origin of the route, or how the route was learned.

On the other hand, the MED (or Multi-Exit Discriminator), also sometimes referred to as the ā€œmetricā€ is an optional, non-transitive attribute that is usually manually set, that is used for informing external neighbors about the preferred path into an AS when multiple entry points exist. The MED can be thought of as a ā€œhintā€ to external neighbors about the preferred path, but it is not always honored by all routers.

So, in essence, the origin code is usually checked before the MED because it provides what is considered to be more crucial and trustworthy information about the routeā€™s origin, which is often more important to determine the preferred path. Does that make sense?

I hope this has been helpful!

Laz

Hello, everyone!

When would this Origin Code path attribute be even used as a tiebreaker? The situations seem very rare to me. There canā€™t possibly be a situation where we have multiple paths to reach the same destination with different origin codes, right?

That means that the route would have to be advertised using the network or the aggregate-address command (i) and also redistributed and advertised that way (?) for a BGP speaker to make a decision based off the Origin Code

Kind regards,
David

Hello David,

Although technically possible, itā€™s unlikely that you see this often. You need two paths where these are the same:

  • Weight
  • Local preference
  • Originate
  • AS Path Length

And then you need two routers. One that uses the network command, the other one uses the redistribute command. The Origin code is quite far down the list of BGP path selection criteria so itā€™s unlikely you will ever run into this. It is possible thoughā€¦

Rene