BGP Origin Code Attribute explained

I think you have a typo
In your example you have
Lets see what R2 thinks of this

R1#show ip bgp
^^

This is confusing because R1 will prefer the locally originated route by virtue of the path selection algorithm step 3
The output is clearly from R2 but the prompt is R1

Stuart

Hi Stuart,

I see I havenā€™t replied to this before. Thanks for reporting, it has been fixed.

Hi,

please could we prefer origin code (?) over (i) ?

Hi Rawaz

Unfortunately, you canā€™t change the logic to prefer incomplete (?) over IGP (I).

However, you shouldnā€™t want thisā€¦if you want to influence your routing, itā€™s best to use any of the other BGP attributes.

Rene

hi
so how i can prefer one path over another using BGP origin code ?

BR//

Hi Ason,

You shouldnā€™t :slight_smile: Itā€™s best to use any of the other attributes to make a decision like weight, local preference, AS path, etc.

Rene

Hi,
R1 and R3 has same loopback interface ip 1.1.1.1

how is it possible ip address in same network

Thanks

Hello Sims

In this lab, Rene is using loopbacks to represent the same network. In a production network, you would have a switch connected to both R1 and R3, and you would have both routers on the same subnet/VLAN. However, in this case, in order to advertise the same network, Rene used loopback addresses. The important thing here is that both R1 and R3 have routes to the 1.1.1.0/24 network, and that is what is being advertised. Strictly speaking, he could have configured one loopback as 1.1.1.1 and the other as 1.1.1.2 but it would not change the results of this lab specifically.

I hope this has been helpful!

Laz

Hi Rene,

I am still not clear on the differences between originate and the origin attributes,ā€¦I dont see them in the list,but its there in the post that you put on the path selectionā€¦Can you please help me understand ?

Hello Vasanth

Different lists will use slightly different names for various attributes. What is named Originate in Reneā€™s list is described as ā€œPrefer the path that was locally originated via a network or aggregate BGP subcommand or through redistribution from an IGPā€ by Cisco. Similarly, what is described as Origin Code by Rene, is described as ā€œPrefer the path with the lowest origin typeā€ by Cisco.

For a clearer understanding of the difference between these two particular attributes, take a look at the following post.

I hope this has been helpful!

Laz

Hi Rene
thanks for excellent presentation on the BGP basics
Just need your help to understand this origin codes correctly

as per origin code topic itā€™s mentioned
? is incomplete and redistributed routes from IGP and completely understand this but ā€œi " for IGP but ā€œiā€ will be referring to prefixes advertised with network statement command in BGP config ?
not 'iā€ as an IGP right ?

/thanks
ragu

Hello Ragu

Yes, it can get a bit confusing with the terminology and the sources of information. Let me try to clarify.

An origin code of i does indeed mean IGP, as in interior gateway protocol. Why is that term used even though it refers to networks added using the network command? Well, it comes from the fact that in order for a prefix to appear in the BGP table and be advertised, it must first exist in the local routing table. And how are prefixes placed in the local routing table? Via an IGP (or via static or directly connected routers of course). So if you enter the network command on R1, a prerequisite of that network being advertised to R2 is that it must be in the local (R1ā€™s) routing table. I know itā€™s not a completely airtight argument, but thatā€™s where the choice of the origin code name comes from.

Alternatively, when redistributing, the source could be anything. An IGP, a route map, directly connected networks, or another instance of BGP, so the ? is appropriate to use there.

I hope this has been helpful!

Laz

1 Like

I had a question about the Origin attribute in the BGP best path selection process. Letā€™s assume for a second that the Weight and Local Pref values are equal. Lets also assume we will never see a route originated by EGP. My understanding is that if a router learns about the same route from 2 or more separate neighbors, it will prefer the route with an origin of ā€œinternal (i)ā€ over a route with an ā€œincomplete (?)ā€ origin correct? if so, under what circumstances could this occur?

Thank you.

Hello Chris

Assuming all previous BGP attributes are equal, once you get to the origin code, there are indeed three origin codes to choose from. These origin codes indicate from where the router has learned the route:

  • IGP (shows up as i)
  • EGP (shows up as e)
  • Incomplete (shows up as ?)

As you say, assuming you never see EGP since it is obsolete, you will prefer the route that was learned (originated from) an IGP rather than Incomplete.

IGP simply means that you used the network command in the BGP router to get that prefix into the BGP table. A prerequisite to get a prefix in the BGP table, is to have that prefix in the local routing table, and the only way to get it there is via an IGP or static routing. IGP includes both.

Incomplete indicates that the prefix was redistributed into BGP.

The following lesson shows examples of both of these cases:

I hope this has been helpful!

Laz

Hello Guys

Is there a way how to show incomplete(redistribute route ) to show it as i (igp) ?

Regards

Hello Metodija

The origin codes of IGP and Incomplete are specifically defined. If you have a route that is redistributed into BGP from another protocol, then by definition it has an origin code of incomplete. You canā€™t simply change how BGP determines the origin code.

However, you can change the way in which you advertise a particular route. If a route is redistributed into BGP, it will appear with an origin code of incomplete. However if you are able to use the BGP network command to advertise it, then that prefix will appear with an origin of IGP. Remember, to use the network command and have BGP advertise it, the prefix must first be found in the local routing table.

I hope this has been helpful!

Laz

1 Like

Yes exactly what i wanted to confirm to my self :slight_smile: like you are reading my mind :slight_smile:

1 Like

is it normal to get the 192.168.13.0 network due to redistribute connected on R2? since i is preferable e, e i preferable than ? why i get i as best route?

Hello Konstantinos

Iā€™m not sure I understand what you mean. First of all, I assume you mean the 192.168.23.0 network correct?

Secondly, in the lesson, you can see that it is the route via 192.168.12.1 that is the best route:

R2#show ip bgp 
BGP table version is 4, local router ID is 192.168.23.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*  1.1.1.0/24       192.168.23.3             0             0 1 ?
*>                  192.168.12.1             0             0 1 i

Note the ā€œ>ā€ symbol appears where the ā€œiā€ is and not where the ā€œ?ā€ is.

Does that make sense? I hope Iā€™ve answered your question, if not please clarify and Iā€™ll do my best to help you out.

I hope this has been helpful!

Laz

Why origin code is compared before MED? Any problem if the best path selection process compare MED first and then origin code?