BGP Origin Code Attribute explained

The BGP Origin Code is one of the attributes that is used for path selection. There are three origin codes that the BGP table can show:

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

You will see IGP when you use the network command for BGP. It means you advertised the network yourself in BGP. EGP is historical and you won’t see it in the BGP table anymore. EGP is an old routing protocol we don’t use it anymore. Incomplete means you have redistributed something into BGP. Here’s a demonstration:

bgp as path prepend lab
Above you can see the topology that I will use. R1 and R3 are in AS1 and connected to R2 in AS2. Both routers have a loopback0 interface with network 1.1.1.0/24 configured on it.

R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 remote-as 2
R3(config)#router bgp 1
R3(config-router)#neighbor 192.168.23.2 remote-as 2
R2(config)#router bgp 2
R2(config-router)#neighbor 192.168.12.1 remote-as 1
R2(config-router)#neighbor 192.168.23.3 remote-as 1

First we’ll configure BGP. Next step is to get network 1.1.1.0/24 in the BGP table:

R1(config)#router bgp 1
R1(config-router)#network 1.1.1.0 mask 255.255.255.0
R3(config)#router bgp 1
R3(config-router)#redistribute connected

On R1 I’ll advertise network 1.1.1.0/24 in BGP with the network command, on R3 we’ll redistribute it. Let’s see what R2 thinks of this…

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 655 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

546 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Forum Replies

  1. Hi Rene,

    what happen if the BGP router receive a route with the same path and origin code ?

    thanks

    Hussein Sameer

  2. Hi Hussein,

    There’s a long list that BGP uses to select the best path, this is from the Cisco.com website:

    1. Prefer the path with the highest WEIGHT.

      Note: WEIGHT is a Cisco-specific parameter. It is local to the router on which it is configured.


    2. Prefer the path with the highest LOCAL_PREF.

      Note: A path without LOCAL_PREF is considered to have had the value set with the bgp default local-preferencecommand, or to have a value of 100 by default.


    3. Prefer the path that was locally originated via a network or aggregate BGP subcommand or through redistribution fr
    ... Continue reading in our forum

  3. 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

  4. Hi,

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

21 more replies! Ask a question or join the discussion by visiting our Community Forum