Overview
Details the role and configuration of the BGP router identifier, emphasizing its selection process and importance within BGP sessions.
Each BGP router needs a unique router identifier (ID) to establish BGP sessions. This ID is sent to BGP peers in the OPEN message when a BGP session starts.
Methods for determining BGP router ID
BGP tries to obtain a router ID in this order of preference:
-
Configured router ID: BGP uses the router ID set explicitly with the bgp router-id command in router configuration mode.
-
Highest IPv4 address on loopback interface: If no router ID is configured, BGP uses the highest IPv4 address from a loopback interface, provided the router was booted with a saved loopback address configuration.
-
Primary IPv4 address of the first configured loopback: If no loopback address exists in the saved configuration, BGP uses the primary IPv4 address of the first loopback interface that is configured.
What happens if BGP fails to obtain a router ID
If none of these methods for obtaining a router ID succeeds, BGP does not have a router ID and cannot establish any peering sessions with BGP neighbors.
In such an instance:
-
The system logs an error message.
-
The show bgp summary command displays a router ID of 0.0.0.0.
Behavior after a router ID is assigned
Once BGP obtains a router ID, it uses that ID continuously, even if a better option becomes available based on the rules. This behavior prevents unnecessary flapping of BGP sessions.
Exception
If the current router ID becomes invalid, for instance due to a down interface or configuration change, BGP selects a new one according to the previously outlined rules. However, this change resets all established peering sessions.
Best practice
We strongly recommend configuring the router ID using the bgp router-id command. This helps prevent unexpected changes to the router ID and avoids potential BGP session flapping.