BGP dynamic neighbors
A BGP dynamic neighbor is a peer that is discovered and established using a configured IP address range, instead of an explicitly configured or static neighbor configuration.
Dynamic neighbor configuration allows a router to peer with multiple remote neighbors without explicit static entries for each one. The router accepts BGP connections from any peer whose IP address falls within a specified subnet range.
Example:
In a data center, you can configure one dynamic neighbor range to handle a pool of servers or routers that may change frequently.
Benefits of BGP dynamic neighbor support
BGP dynamic neighbor support provides these benefits:
-
Allows you to configure each range of IP addresses as a subnet.
-
Reduces CLI configuration complexity in large networks.
-
Supports both IPv4 and IPv6 peering.
Configure BGP dynamic neighbors using address range
Purpose: Configure BGP dynamic neighbors using an IP prefix, reducing manual neighbor statements in large-scale networks.
Context: Use this when you want to accept BGP peerings from a set of IP addresses, such as a subnet, instead of individually configuring each neighbor.
This figure illustrates a sample topology.
After you configure the subnet range for dynamic neighbors on Router A, Router B can initiate a TCP session from any IP address within that range. Router A then automatically establishes the BGP neighbor connection with Router B, with no further CLI configuration required after the initial setup.
In this example, local autonomous system (AS) is 100 and remote AS is 1.
Follow these steps to configure BGP dynamic neighbors using an address range.
Before you begin
-
Identify the IP subnet that should be allowed as dynamic neighbors.
-
Ensure you know the remote AS number and the local interface for source IP.
Procedure
|
Step 1 |
Enter BGP configuration mode with your AS number and configure the dynamic neighbor prefix. Example:
|
|
Step 2 |
Assign the remote AS number and specify the update source interface. Example:
|
|
Step 3 |
Enable the address family for IPv4 unicast and commit the configuration. Example:
|
|
Step 4 |
Verify the active configuration. Example:
|
The router accepts BGP sessions from any peer with an IP address within the specified range, creating dynamic neighbor entries automatically.
Configure remote AS list
Configure a list of remote autonomous system (AS) numbers for dynamic BGP neighbors.
Context: Use this procedure when you have dynamic neighbors from multiple remote ASes and want to control which AS numbers are accepted.
This figure illustrates a sample topology.
In this example topology, Router B and Router C are configured as remote BGP peers. Both Router B and Router C are in different autonomous systems.
A list of the autonomous systems of the remote routers is created and the list is then configured in Router A under neighbor mode using the remote-as-list command.
Before you begin
-
Identify the IP subnet that should be allowed as dynamic neighbors.
-
Ensure you know the remote AS number and the local interface for source IP.
Procedure
|
Step 1 |
Enter BGP configuration mode and define your local AS number. Example:
|
|
Step 2 |
Run the as-list command to create an AS list. Example:
|
|
Step 3 |
Run the neighbor address/prefix command to configure the dynamic neighbor prefix. Example:
|
|
Step 4 |
Run the remote-as-list command to assign the remote AS list to the neighbor. Example:
|
|
Step 5 |
Enable the address family for IPv4 unicast and commit the configuration. Example:
|
Dynamic neighbor sessions are accepted only if their AS number is in the configured remote AS list.
Configure maximum peers and idle-watch timeout
Limit the number of dynamic BGP neighbors and set the idle timeout for TCP instances.
Context: Use these settings to manage router resources and avoid excessive neighbor creation.
Before you begin
None
Procedure
|
Step 1 |
Enter BGP configuration mode with your AS number and configure the dynamic neighbor prefix. Example:
|
|
Step 2 |
Run the maximum-peers command to set the maximum number of dynamic neighbors for this neighbor address range. Example:
|
|
Step 3 |
Run the idle-watch-time command to set the idle-watch timeout in seconds and save the configuration. Example:
|
The router limits dynamic neighbor creation for the range and removes idle TCP sessions after the specified time.
Feedback