Why Every BGP Session Dropped When You Changed the Router-ID

The Incident and Its Cause

It is a quiet Tuesday afternoon. An engineer is asked to add a management loopback to an edge router, so that the new monitoring platform has a stable address to poll. The change looks harmless. One interface, one /32, one line in the IGP. It goes in during business hours because "it is only a loopback".

Nothing happens. The next week the router is reloaded for a software upgrade inside a planned window. It comes back, and every BGP session comes up. Then, an hour later, the NOC sees strange best path changes on the route reflectors, and a customer complains that their traffic now leaves through a different exit. Nobody touched BGP. So what changed?

The Router-ID changed. The new management loopback had a higher address than Loopback0, the router had never had a manual Router-ID, and the reload ran the selection again. This post explains how the Router-ID is chosen, why changing it resets sessions, and how to prove what happened from show command output.

To see why, start with what the Router-ID is. BGP speakers identify themselves with a 32-bit number called the BGP Identifier, which Cisco calls the Router-ID. It is sent in the OPEN message when the session starts, and it is written like an IPv4 address, for example 1.1.1.1. It is a label, not a destination, and nothing routes to it.

On Cisco IOS and IOS XE, the Router-ID comes from the first of these rules that gives a result. A value configured with "#bgp router-id" always wins. Without it, the router takes the highest IPv4 address on an up loopback. Without a loopback, it takes the highest IPv4 address on an up physical interface.

The key word in the second rule is "highest". The engineer in our incident added Loopback99 with 172.31.255.10. Loopback0 was 10.0.0.1. After the reload, 172.31.255.10 was the highest loopback address, so it became the Router-ID.

Reproducing It in the Lab

Start with an edge router that peers with an upstream provider and with two route reflectors, using Loopback0 as the update source. No Router-ID is configured.

PE1(config)#interface Loopback0
PE1(config-if)#ip address 10.0.0.1 255.255.255.255
PE1(config-if)#router bgp 65000
PE1(config-router)#neighbor 10.0.0.14 remote-as 65000
PE1(config-router)#neighbor 10.0.0.14 update-source Loopback0
PE1(config-router)#neighbor 10.0.0.11 remote-as 65000
PE1(config-router)#neighbor 10.0.0.11 update-source Loopback0
PE1(config-router)#neighbor 203.0.113.1 remote-as 64500
PE1#show ip bgp summary
BGP router identifier 10.0.0.1, local AS number 65000
BGP table version is 412, main routing table version 412
380 network entries using 94240 bytes of memory
761 path entries using 103496 bytes of memory

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.0.11       4        65000   14862   14790      412    0    0 1w2d          190
10.0.0.14       4        65000   14871   14790      412    0    0 1w2d          190
203.0.113.1     4        64500   15012   14402      412    0    0 1w2d          380

Now add the management loopback.

PE1(config)#interface Loopback99
PE1(config-if)#description MGMT-POLLING
PE1(config-if)#ip address 172.31.255.10 255.255.255.255
PE1#show ip bgp summary | include identifier
BGP router identifier 10.0.0.1, local AS number 65000

In the lab the Router-ID did not move while the process kept running. Cisco does not document this behaviour for IOS or IOS XE (it documents it only for IOS XR), so treat it as observed behaviour and test it on your own release. Either way, this is why the original change looked safe. Now save and reload, which is what the upgrade did.

PE1#show ip bgp summary
BGP router identifier 172.31.255.10, local AS number 65000
BGP table version is 389, main routing table version 389
380 network entries using 94240 bytes of memory
761 path entries using 103496 bytes of memory

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.0.11       4        65000      38      29      389    0    0 00:04:51      190
10.0.0.14       4        65000      37      29      389    0    0 00:04:52      190
203.0.113.1     4        64500      44      21      389    0    0 00:04:40      380

The reload ran the selection again, and the highest loopback won.

That explains the new identifier, but not the traffic shift. A new Router-ID would only be cosmetic if nothing else used it. But the reflectors now compare this router's paths using its new Router-ID, and every client receives the reflected routes with the new value as the ORIGINATOR_ID, which replaces the Router-ID in the best path tie-breaker. On the reflectors, PE1's paths and PE2's paths for the customer's multihomed prefixes were equal all the way down to the Router-ID step. Before, 10.0.0.1 beat PE2's 10.0.0.2. After the reload, 172.31.255.10 lost to 10.0.0.2. Traffic moved to PE2 for every prefix that was decided at that step.

RR14#show ip bgp 198.51.100.0
BGP routing table entry for 198.51.100.0/24, version 2291
Paths: (2 available, best #2, table default)
  Advertised to update-groups:
     2
  Refresh Epoch 1
  64510, (Received from a RR-client)
    10.0.0.1 (metric 20) from 10.0.0.1 (172.31.255.10)
      Origin IGP, metric 0, localpref 100, valid, internal
  Refresh Epoch 1
  64510, (Received from a RR-client)
    10.0.0.2 (metric 20) from 10.0.0.2 (10.0.0.2)
      Origin IGP, metric 0, localpref 100, valid, internal, best

The number in brackets is the Router-ID of the sender. That single field is the evidence for the whole incident.

Fixing It Without Another Outage

Once the cause is understood, the fix is to pin the Router-ID with "#bgp router-id 10.0.0.1". The command takes effect immediately, and it resets every BGP session on the router. There is no soft option. The identifier was exchanged in the OPEN message, and the only way to tell a neighbour about a new one is to open the session again.

PE1(config)#router bgp 65000
PE1(config-router)#bgp router-id 10.0.0.1

Prove the reset with the Up/Down counter, not with log text. Every session restarted at the same moment.

PE1#show ip bgp summary
BGP router identifier 10.0.0.1, local AS number 65000
BGP table version is 23, main routing table version 23
380 network entries using 94240 bytes of memory
761 path entries using 103496 bytes of memory

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.0.11       4        65000       9       7       23    0    0 00:00:14      190
10.0.0.14       4        65000       9       7       23    0    0 00:00:14      190
203.0.113.1     4        64500      11       5       23    0    0 00:00:13      380

With a full Internet table on the upstream session, this is a full reconvergence: the upstream resends every prefix, the router recomputes best paths, and the reflectors withdraw and re-advertise everything this PE contributed. That is a maintenance window job.

Because the fix itself is disruptive, it needs a plan. A CCIE-level plan has four parts.

First, drain the router before the change. Raise the AS_PATH towards the upstream with outbound prepending, and lower local preference on the routes this PE sends into the AS, so traffic moves away before the reset. Graceful shutdown with the GSHUT community does the same job in a single step if the network supports it.

Second, think about the clients. Because the change resets every session together, both reflectors lose this PE at the same moment, and every client loses its paths through this exit at once. The drain in step one is what protects them, because the alternative paths are already best before the reset happens.

Third, verify after the change. Check "#show ip bgp summary" for the new identifier and fresh Up/Down counters, check on the reflectors that the brackets now show the expected identifier, and compare best path counts against the values you saved before the change.

Fourth, undo the drain only after the tables are stable and the prefix counts match the baseline.

Stepping back from the details, the incident was not caused by the loopback. It was caused by a router running for years with an automatic Router-ID, which turned every future interface change into a hidden risk that only showed up at the next reload. The professional standard is to configure "#bgp router-id" on day one, use the address of the loopback you peer from, and add a check to your configuration audit that flags any BGP process without it.

In an exam lab the same rule saves time. If a task says a router must keep a specific identifier "even after future interface changes", the answer is always the manual command, never a careful choice of loopback addresses.