BGP Peer Groups on Cisco IOS

When you configure BGP on a router it’s possible that some of the BGP neighbors share the exact same configuration. This can be annoying since you have to type in the exact same commands for each of these neighbors. Also, when BGP prepares updates it does this separately for each neighbor. This means that it has to use CPU resources to prepare the update for each neighbor.

To simplify the configuration of BGP and to reduce the number of updates BGP has to create, we can use peer groups. We can add neighbors to a peer group and then apply all our configurations to the peer group. BGP will prepare the updates for the peer group which requires less CPU resources than preparing them for each neighbor separately.

Configuration

Let’s take a look at two examples so you can see the difference between using peer groups or not. I’ll use the following topology to demonstrate this:

R1 R2 R3 R4 eBGP Topology

Above we have 4 routers in different autonomous systems. R1 is connected to R2, R3 and R4. Let’s say that we have the following requirements for these eBGP neighbors:

Let’s start with the example without the peer group…

I am using loopback interfaces for the neighbor adjacency so don’t forget to add some static routes:

R1(config)#ip route 2.2.2.2 255.255.255.255 192.168.12.2
R1(config)#ip route 3.3.3.3 255.255.255.255 192.168.13.3
R1(config)#ip route 4.4.4.4 255.255.255.255 192.168.14.4
R2(config)#ip route 1.1.1.1 255.255.255.255 192.168.12.1
R3(config)#ip route 1.1.1.1 255.255.255.255 192.168.13.1
R4(config)#ip route 1.1.1.1 255.255.255.255 192.168.14.1

And here s the route-map to set the MED:

R1(config)#route-map SET_MED permit 10
R1(config-route-map)#set metric 2323

Without BGP Peer Group

Here’s what our BGP configuration on R1 would look like:

R1(config)#router bgp 1
R1(config-router)#neighbor 2.2.2.2 remote-as 2
R1(config-router)#neighbor 3.3.3.3 remote-as 3
R1(config-router)#neighbor 4.4.4.4 remote-as 4
R1(config-router)#neighbor 2.2.2.2 update-source loopback 0
R1(config-router)#neighbor 3.3.3.3 update-source loopback 0
R1(config-router)#neighbor 4.4.4.4 update-source loopback 0
R1(config-router)#neighbor 2.2.2.2 ebgp-multihop 2
R1(config-router)#neighbor 3.3.3.3 ebgp-multihop 2
R1(config-router)#neighbor 4.4.4.4 ebgp-multihop 2
R1(config-router)#neighbor 2.2.2.2 route-map SET_MED out
R1(config-router)#neighbor 3.3.3.3 route-map SET_MED out
R1(config-router)#neighbor 4.4.4.4 route-map SET_MED out

In the configuration of R1 above the only difference is the AS number for each neighbor. The update-source, ebgp-multihop and route-map are the same. This works but we have to repeat the same commands over and over again.

With BGP Peer Group

Let’s simplify the configuration of R1 with our peer group. I will start with a fresh BGP configuration on R1.

First we have to configure the AS number for each eBGP neighbor separately:

R1(config)#router bgp 1
R1(config-router)#neighbor 2.2.2.2 remote-as 2
R1(config-router)#neighbor 3.3.3.3 remote-as 3
R1(config-router)#neighbor 4.4.4.4 remote-as 4

Now we can create the peer group. If you look at the neighbor command you will see some options:

R1(config-router)#neighbor ?
  A.B.C.D     Neighbor address
  WORD        Neighbor tag
  X:X:X:X::X  Neighbor IPv6 address

We can specify an IPv4 or IPv6 address for the neighbor or we can use a tag. That’s what we need to use for the peer group, let’s try that:

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 660 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

503 Sign Ups in the last 30 days

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

Tags:


Forum Replies

  1. Hi Hamood,

    That’s right, if you source eBGP from the loopback interfaces then you’ll need multihop.

    The problem with the R1-R2-R3 scenario is that R2 will never learn about any prefixes, when R1 tries to reach a network behind R3 (or R3 wants to reach something behind R1) then R2 will receive an IP packet with a destination it doesn’t know about.

    If you really had to use eBGP between R1 and R3 then a GRE tunnel might be a solution…

    Rene

  2. Hi Rouzbeh,

    In the example with the two interfaces, we use static routes only for the neighbor adjacency. Once BGP is up and running, we’ll use it to advertise networks. With only two routers there’s no need to run BGP, just imagine that R1 and R2 are part of a much larger network with multiple ASes, routers, etc. :slight_smile:

    Rene

  3. Hi Jason,

    R1(config-router)# neighbor 2.2.2.2 remote-as 2

    That command instructs R1 to establish a neighbor relationship with 2.2.2.2. It does not, however, tell R1 to use any specific interface as source or “from” address when establishing the relationship. By default, BGP will try to use the closest interface to the neighbor to establish the relationship. Knowing this, what do you suppose would happen if we just used the command above to try to establish a BGP neighbor relationship with R2?

    From R2’s perspective it would be receiving packets from R1, but t

    ... Continue reading in our forum

  4. I’m still not clear on why the second scenario requires multihop when the neighbours are directly connected.

    Are you saying that when traffic is sourced from and to a loopback, it is effectively taking 3 hops? (2 of which are virtual within the routers).

  5. Hello Chris

    Essentially, if you use the FastEthernet interfaces to interconnect BGP, then the routers are considered directly connected and you wouldn’t need to use multihop. However, because we are using two redundant links to connect the two routers, if we use the fastEtherent interfaces, and one link goes down, then the BGP connection between them will also go down, thus rendering the redundant link unusable. This is why it is preferable to use the loopback interfaces. However, If you use the loopback interfaces, you can see that these loopbacks are not d

    ... Continue reading in our forum

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