BGP Confederation Explained

This topic is to discuss the following lesson:

Awesome work !!!

Well Done man. I was reading the same topic on the TCP/IP Vol II but the topology used there was quite confusing. Here you used a simple topology and explained to concept of it in a nice and clean way.

Hi Mauro,

Glad to hear it was useful to you, I did my best to keep it as simple as possible.


Great job Rene… This cant get any simpler than this… Finally I learned confederation… Was not able to answer this in so many interview…Now I’m confident :slight_smile:

Glad to hear that Abhishek :slight_smile:

Very nice explanation Rene… Also can you please add some topics on AS_Confederation_SET and AS_Confederation_Seq

Thank you


Thanks Taslim. I’ll add these two topics to my list.

Hello there! I noticed that you also have OSPF running. Is there any type of redistribution going on here?

No redistribution configs was listed, so I am just wondering. Can you please explain?

Hi Sheldon,

We require an IGP when we run IBGP to advertise loopback interfaces that are used for the neighbor adjacency. Take a look at this lesson, it explains everything:


Thanks Rene , keep going man

Dear Rene,

Nice explanation. I am bit confused about the use of the command bgp confederation identifier 2

Should we use this command only to that router (R2) connecting to EBGP peers-R1 (the External Autonomous System, in this case 1 )?

Or should we use the command also in the routers connecting to Sub-AS (inside the IBGP)?

I saw you have used the command in all Routers. But do we need to use in all the sub-as routers? I am bit confused. Your help is highly appreciated.


Dear Ahammad,

You have to configure this on all routers within the sub-AS otherwise they won’t consider themselves part of the confederation. They will be able to establish BGP peerings but they’ll consider other routers in the confederation as regular “external” or “internal” neighbors. They will also drop routes when they see a confederation path in it.

I tested this, here is the output of some show commands when I removed “bgp confederation identifier 2” on R3, R4 and R5:

R3#show ip bgp
BGP routing table entry for, version 19
Paths: (1 available, best #1, table default)
Flag: 0x820
  Advertised to update-groups: (Pending Update Generation)
  Refresh Epoch 1
  (24) 1 (metric 2) from (
      Origin IGP, metric 0, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0
R4#show ip bgp
BGP routing table entry for, version 20
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
  Refresh Epoch 1
  1 (metric 2) from (
      Origin IGP, metric 0, localpref 100, valid, internal, best
      rx pathid: 0, tx pathid: 0x0
R5#show ip bgp
BGP routing table entry for, version 25
Paths: (2 available, best #2, table default)
  Advertised to update-groups:
  Refresh Epoch 1
  24 1 (metric 3) from (
      Origin IGP, metric 0, localpref 100, valid, external
      rx pathid: 0, tx pathid: 0
  Refresh Epoch 1
  (24) 1 (metric 3) from (
      Origin IGP, metric 0, localpref 100, valid, internal, best
      rx pathid: 0, tx pathid: 0x0

Here’s one of the errors I noticed:

%BGP-6-ASPATH: Invalid AS path 35 (24) received from Confederation AS-path found in the middle

Hope this helps.


Dear Rene,

Thanks for the information. Yes that is correct.

However, I simulated a similar lab like yours but I have not connected R4 and R5 that you have done, only to see if those router can communicate with R1. And i found out that if i don’t connect R4 and R5 to each other as redundant link then those two router do not need the “bgp confederation peer” and “bgp confederation identifier” commands. Also I found out that those two commands are mandatory for R2 and R3. Since, R2 is connecting External AS router R1 and Internal “sub-as” router R3 and R3 is connecting internal “sub-as” router R2 so these R2 and R3 routers need those commands.

I truly appreciate your help to clear my concept on BGP confederation…





Dear Ahammad,

I guess you could make that work, R5 would probably see R2 as a regular iBGP neighbor that advertises an external route (from R1). The question is, why would you want this? :slight_smile: As soon as they do learn something with a sub-as path then they’ll refuse the route. Better to just add the confederation identifier (and peers) to all devices in the confederation.


Hi Rene

Thank you for this article.

I had a question though

When R1 advertises route to R2 that’s external and learned via ebgp. For ibgp protocol states that next hop advertised by ebgp should be carried into ibgp. So when R1 advertises to R2 it uses next hop address as So when R2 advertises this route to its ibgp peers it should have next hop as and not as .
Is this case we can also use next-hop-self command ? or using igp like ospf is the only option?

thank you

Hi Kandhla,
Yes, you can absolutely use the next-help-self option with iBGP. In fact, in some circumstances you might HAVE to. For example, let’s say you have a router (R1) with an external BGP relationship with an ISP, and your highly available site has been given two separate circuits from that ISP. To ensure that R1’s BGP neighborship with the ISP is also highly available, you have configured R1 to use the ISP’s router’s loopback address (you would also have to use the ebgp-multihop option for this). To do this you would create static routes on R1 to get to the ISP’s loopback through both of your circuits.

Now, suppose that R1 also has an iBGP relationship with other routers you have inside your company (say, R2 and R3). What would happen to all the routes that R1 would learn from the ISP, when it shares them with R2 and R3? The answer is that the routes would not appear in the routing table, and the reason is the next-hop attribute associated with the routes.

In order for BGP to consider a route valid, the very first thing it checks for is the reachability of the next-hop address. From the perspective of R2 and R3, they have no idea how to get to the loopback of the ISP’s BGP router. The best way to fix this would be to do what you said–turn on the “next-hop-self” option for R1.


Excellent Work Rene ! Simple and precise.

Both are working on the same manner in order to overcome the drawback of IBGP full mesh…what is the difference between route reflector and bgp confederation??..

Hi Shiva,

Route reflectors solve the IBGP full mesh issue by using a central RR that has clients, instead of a full mesh.

Confederations reduce the IBGP full mesh by chopping an AS into multiple sub-ASes. Keep in mind that each sub-AS still has the full mesh IBGP requirement, or you can use RRs within a sub-AS.

Both options have (dis)advantages so it depends on your network design if you use one or both options.