Dynamic BGP Peering

Rashmi Bhardwaj | Blog,Config & Troubleshoot

As we know, configuring the BGP neighbor is not too difficult, but when we are going to configure 100 or more Number of neighbors, then it becomes pretty tedious activity.

BGP Peering

To minimize this configuration overhead, we use the concept of BGP peer Group, where we can group the BGP Neighbors who are sharing the same outbound policies. But first, we need to manually configure 100 Peers and then add to the peer group. Hence the problem is still not resolved.

Related – BGP Neighbor States


Let’s verify BGP peer Group configuration

1 Example: Configuration step of iBGP Peer Group.

bgp peering

2 Example: Configuration step of eBGP peer Group.

bgp configuration

Related – iBGP vs eBGP

With the Dynamic BGP peering feature, BGP router dynamically establishes peering with a group of remote neighbors that are configured using a range of IP addresses and BGP peer group. After a subnet range is configured for a BGP peer group and a TCP session is initiated by another router for an IP address in the subnet range, a new BGP neighbor is dynamically created as a member of that group.

So in this scenario, we will discuss how to configure Dynamic BGP peer.

bgp dynamic neighbors

(Diagram- BGP Peering)

As per diagram R1 wants dynamic peering with R2 and R3, so let’s verify the configuration steps;

Step 1. Define BGP peer group name

R1(config-router)# neighbor  Dynamic-peer peer-group

Step 2. Create a global limit of BGP dynamic subnet range neighbors. The value ranges from 1 to 5000.

R1(config-router)# bgp listen limit 100

Step 3. Define the IP Subnet Range and associate it with a peer group. Multiple subnets can be added to the same peer group.

R1(config-router)# bgp listen range peer-group Dynamic-peer

Step 4. Define the remote-as for the peer group. Optionally, define the list of AS numbers that can be accepted to form neighborship with. The max limit of alternate-as numbers is 5.

R1(config-router)# neighbor Dynamic-peer  remote-as 65002 alternate-as 65003 65004

Step 5. Activate the peer group under ipv4 address-family

R1(config-router)#address-family ipv4

R1(config-router-af)# neighbor Dynamic-peer  activate.

Router1#show run | section router bgp

router bgp 65001

bgp log-neighbor-changes

bgp listen range peer-group Dynamic-peer

neighbor Dynamic-peer peer-group

neighbor Dynamic-peer remote-as 65002 alternate-as 65003 65004


address-family ipv4

neighbor Dynamic-peer activate


Router2#show run | section bgp

router bgp 65002

bgp log-neighbor-changes

neighbor remote-as 65001

Router3#show run | section router bgp

router bgp 65003

bgp log-neighbor-changes

neighbor remote-as 65001

Router1#show ip bgp summary

BGP router identifier, local AS number 65001

BGP table version is 1, main routing table version 1


Neighbor        V           AS    MsgRcvd    MsgSent   TblVer     InQ OutQ    Up/Down    State/PfxRcd

*     4        65002       4                 4             1              0    0         00:00:38        0

*     4        65003       4                 2             1              0    0         00:00:29        0

* Dynamically created based on a listen range command

Dynamically created neighbors: 2, Subnet ranges: 1

BGP peer group Dynamic-peer listen range group members:

Total dynamically created neighbors: 2/(100 max), Subnet ranges: 1

Router1#show tcp brief all

TCB                    Local Address                 Foreign Address                     (state)

A2B61B90                        ESTAB

A2B62F48                        ESTAB

A2B19B20                            *.*                                       LISTEN

The output illustrates that the router is listening on port 179 but with foreign address of *.*

Related- BGP Interview Questions


Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart