Log-Neighbor-Changes
Scenario to verify BGP log-neighbor-changes parameter configuration.
By default, BGP does not log neighbor state changes to syslog. The
log-neighbor-changes parameter enables logging of BGP neighbor state transitions
(up/down) and the reason for the change. This is useful for troubleshooting and
monitoring BGP session stability.
In this test, DUT0 (AS 20) establishes an iBGP session with DUT1 (AS 20)
with log-neighbor-changes enabled. After the session is established, a shutdown
is applied to trigger a state change. The test then verifies that the neighbor
change event appears in the system logs.
Test BGP Log Neighbor Changes
Description
This test verifies that log-neighbor-changes causes BGP to log neighbor
state transitions to syslog. After establishing an iBGP session with the
parameter enabled, a shutdown is applied to the neighbor on DUT0, and the
system logs are checked for the neighbor change event.
Scenario
Note
Configure iBGP with log-neighbor-changes enabled on DUT0.
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 address 10.10.0.100/24 set protocols bgp 20 neighbor peer remote-address 10.10.0.200 set protocols bgp 20 neighbor peer remote-as 20 set protocols bgp 20 parameters log-neighbor-changes set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0' set system syslog global level info
Step 2: Set the following configuration in DUT1 :
set interfaces ethernet eth0 address 10.10.0.200/24 set protocols bgp 20 neighbor peer remote-address 10.10.0.100 set protocols bgp 20 neighbor peer remote-as 20 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Attention
Verify iBGP session establishes between DUT0 and DUT1.
Step 3: Run command protocols bgp show ip summary at DUT0 and check if output matches the following regular expressions:
10.10.0.200.*EstablishedShow output
IPv4 Unicast Summary: BGP router identifier 10.10.0.100, local AS number 20 VRF default vrf-id 0 BGP table version 0 RIB entries 0, using 0 bytes of memory Peers 1, using 24 KiB of memory Neighbor LocalAddr V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State PfxRcd PfxSnt Desc 10.10.0.200 10.10.0.100 4 20 3 3 0 0 0 00:00:01 Established 0 0 FRRouting/10.4.1 Total number of neighbors 1
Note
Apply shutdown on DUT0 neighbor to trigger a state change event.
Step 4: Modify the following configuration lines in DUT0 :
set protocols bgp 20 neighbor peer shutdown
Attention
Verify session shows Idle (Admin) after shutdown.
Step 5: Run command protocols bgp show ip summary at DUT0 and check if output matches the following regular expressions:
10.10.0.200.*Idle \(Admin\)Show output
IPv4 Unicast Summary: BGP router identifier 10.10.0.100, local AS number 20 VRF default vrf-id 0 BGP table version 0 RIB entries 0, using 0 bytes of memory Peers 1, using 24 KiB of memory Neighbor LocalAddr V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State PfxRcd PfxSnt Desc 10.10.0.200 10.10.0.100 4 20 3 4 0 0 0 00:00:01 Idle (Admin) 0 0 FRRouting/10.4.1 Total number of neighbors 1
Attention
Verify the neighbor change event is logged in syslog.
Step 6: Run command file show running://log/messages | grep ADJCHANGE at DUT0 and check if output contains the following tokens:
%ADJCHANGE: neighbor 10.10.0.200(osdx) in vrf default Down Admin. shutdownShow output
2026-03-05 14:59:22.989846 daemon-info , bgpd[150742]: [N9HHH-F8H1M] %ADJCHANGE: neighbor 10.10.0.200(osdx) in vrf default Up 2026-03-05 14:59:24.753548 daemon-info , bgpd[150742]: [PXVXG-TFNNT] %ADJCHANGE: neighbor 10.10.0.200(osdx) in vrf default Down Admin. shutdown