CCNA 200-301

CCNP Enterprise

CCNP Security

CCIE Enterprise Lab

CCIE Security Lab

CCNP Service Provider

CCNP Data Center

CCNP Collaboration

CCIE DC Lab

Border Gateway Protocol (BGP) is the routing backbone of enterprise WANs, data centers, and the internet. When a BGP peering session drops, flaps, or fails to establish, the local logging facility on a Cisco router is your primary tool for pinpointing the root cause. Cisco IOS and IOS-XE record neighbor state transitions, TCP reset reasons, and protocol negotiation errors directly into the internal syslog buffer.

Navigating these logs effectively requires enabling the proper log generation directives, knowing how to filter the buffer from the command-line interface (CLI), decoding BGP error notification codes, and selectively running live debugs without overwhelming router CPU resources.


Table of Contents

Enabling BGP Neighbor State Logging in Cisco IOS

Before you can inspect BGP neighbor transitions in the syslog buffer, you must ensure the routing process is configured to capture state changes. By default, some older IOS versions suppress minor state transitions or lack detailed logging triggers.

Follow this step-by-step procedure to activate comprehensive BGP neighbor logging and configure granular log timestamps:

Step 1: Enter Global Configuration Mode

Log in to the router via SSH or console with privileged EXEC permissions, then enter global configuration mode:

Router# configure terminal
Router(config)#

Step 2: Access the BGP Routing Process

Navigate to your active BGP autonomous system configuration:

Router(config)# router bgp 65001
Router(config-router)#

Step 3: Enable Neighbor State Change Logging

Apply the bgp log-neighbor-changes command. This instructs the BGP process to generate a syslog message whenever a neighbor resets, establishes, drops, or changes states (such as Idle, Connect, Active, OpenSent, OpenConfirm, or Established):

Router(config-router)# bgp log-neighbor-changes
Router(config-router)# exit

Step 4: Configure Millisecond-Precision Timestamps

Accurate event correlation requires millisecond-accurate timestamps and timezone indicators on all generated syslog messages:

Router(config)# service timestamps log datetime msec show-timezone

Step 5: Allocate Sufficient Local Logging Buffer

Ensure the internal RAM buffer is large enough to retain historical logs during high-volume events:

Router(config)# logging buffered 64000 informational
Router(config)# end
Router# write memory

Key Takeaway: Enabling bgp log-neighbor-changes ensures every peering transition generates an explicit %BGP-5-ADJCHANGE message in the logging buffer.


Viewing and Filtering Stored BGP Logs in the Router CLI

Once logging is active, the router writes events into its circular logging buffer. In high-traffic environments, general syslog messages from interfaces, security policies, and other protocols can quickly bury BGP events.

Use the following CLI commands and regular expression filters to extract relevant BGP messages:

1. View All BGP Facility Messages

The facility identifier for BGP in Cisco IOS is %BGP. To display only BGP-specific logs, pipe the output of show logging using a case-sensitive include filter:

Router# show logging | include %BGP

2. Case-Insensitive BGP Search

To match any log line referencing “bgp” regardless of capitalization (useful when searching for interface descriptions or custom log tags):

Router# show logging | include -i bgp

3. Filter by Specific Neighbor IP Address

When diagnosing an isolated peer failure on a router handling multiple sessions, filter directly by the neighbor’s IP address:

Router# show logging | include %BGP-5-ADJCHANGE.*198.51.100.2

4. Isolate Session Resets and Teardowns

To display only neighbor drops and skip routine peering establishment notifications, filter specifically for the “Down” status:

Router# show logging | include %BGP-5-ADJCHANGE.*Down

5. Inspect the BGP Running Configuration and State Concurrently

To review how logging is configured alongside current session states without exiting the troubleshooting view:

Router# show running-config | section router bgp
Router# show ip bgp summary

Key Takeaway: Pipelining show logging with %BGP and regular expressions isolates critical session drops from background router noise.


Frequently Asked Questions: Decoding Cisco BGP Log Messages and Error Codes

What does %BGP-5-ADJCHANGE: neighbor x.x.x.x Down Peer closed the session mean?

This message indicates that the remote BGP peer actively terminated the TCP connection by sending a TCP FIN or RST packet. Common causes include an administrator manually shutting down the BGP process or interface on the remote router (neighbor shutdown), the remote router reloading, or a local policy reconfiguration on the remote side.

Why does BGP log %BGP-5-ADJCHANGE: neighbor x.x.x.x Down Hold timer expired?

BGP maintains sessions by exchanging Keepalive messages every 60 seconds (by default) with a 180-second Hold Timer. If three consecutive Keepalive packets are missed, the session resets. This message points to underlying data plane issues: unidirectional packet loss, Layer 2 link flaps, high CPU utilization starving the BGP process of control-plane scheduler cycles, or MTU mismatch issues on large BGP UPDATE packets.

What causes %BGP-3-NOTIFICATION: sent to neighbor or received from neighbor?

A BGP NOTIFICATION message (RFC 4271) is transmitted whenever an unrecoverable protocol error occurs, causing the session to close immediately. The log entry contains an Error Code and an Error Subcode:
– Error Code 2 (OPEN Message Error): Indicates parameter negotiation failure, such as mismatched Autonomous System numbers (Subcode 2: Bad Peer AS), authentication failures, or incompatible BGP capabilities.
– Error Code 3 (UPDATE Message Error): Indicates an invalid or corrupt routing update, such as a missing mandatory well-known attribute (AS_PATH, ORIGIN, NEXT_HOP) or malformed prefix length.
– Error Code 6 (Cease): Indicates an intentional shutdown or threshold enforcement.

What is the meaning of BGP Cease Subcodes (e.g., Cease 1 or Cease 2)?

Defined in RFC 4486, Cease subcodes explain why a session was administratively cleared:
– Subcode 1 (Maximum Number of Prefixes Reached): The peer exceeded the limit defined by the neighbor maximum-prefix command.
– Subcode 2 (Administrative Shutdown): The peer was shut down using the neighbor shutdown command.
– Subcode 3 (Peer De-configured): The peering configuration was removed.
– Subcode 4 (Administrative Reset): A soft or hard clear was executed (e.g., clear ip bgp).

What does %BGP-4-MAXPFX: No. of prefix received from x.x.x.x reaches threshold indicate?

This warning indicates that the number of routes advertised by the peer has exceeded the warning threshold (typically 75% or 80%) set in the neighbor x.x.x.x maximum-prefix <limit> <threshold> configuration. It acts as an early warning before the router triggers a Cease teardown.

Key Takeaway: BGP syslog messages provide explicit error codes; differentiating between a remote TCP FIN and a local Hold Timer expiration reveals whether the root cause is administrative or transport-related.


Safe Real-Time Troubleshooting with BGP Debugging

When historical syslog messages do not provide enough detail—such as during intermittent session establishment failures—real-time debugging is required. However, running unconstrained debugs on production routers running full internet routing tables can exhaust CPU resources and cause complete router failure.

Follow this guide to execute targeted, safe BGP debugs:

Step 1: Secure the Terminal and Disable Console Logging

Unthrottled console logging can lock up the Cisco IOS EXEC process. Redirect debug output strictly to your virtual terminal (VTY) session:

Router# configure terminal
Router(config)# no logging console
Router(config)# logging monitor debugging
Router(config)# end
Router# terminal monitor

Step 2: Target the Debug Strictly to the Problematic Peer

Never execute a generic debug ip bgp. Always append the specific neighbor IP address and restrict the scope to protocol state machine events:

Router# debug ip bgp 198.51.100.2 events

This restricts logging output to Finite State Machine (FSM) state shifts (e.g., OpenSent to OpenConfirm) for that single peer.

Step 3: Monitor TCP Handshake Failures

If BGP remains stuck in the Active or Connect state, the TCP three-way handshake (port 179) is failing. Safely debug the transport layer:

Router# debug ip tcp transactions

Step 4: Terminate Debugging Immediately

As soon as the necessary state transitions or failure notifications are captured, disable all active debug processes:

Router# undebug all

(Alternative shorthand: Router# u all)

Step 5: Verify Control-Plane Health

Confirm that debugging execution did not create residual processor contention:

Router# show processes cpu | include BGP

Key Takeaway: Always scope BGP debug commands to a specific neighbor IP and execute undebug all immediately after capturing the required protocol state transitions.


External Syslog Configuration Template for BGP Logging

Local router buffers have limited memory and will eventually overwrite older messages. To preserve BGP history for audit compliance, post-mortem analysis, and automated alerting, export syslog messages to an external Security Information and Event Management (SIEM) or syslog server using this configuration template.

! ==============================================================================
! CISCO IOS / IOS-XE BGP SYSLOG EXPORT CONFIGURATION TEMPLATE
! ==============================================================================

configure terminal

! --- Step 1: Timestamp & Buffer Standardization ---
service timestamps log datetime msec show-timezone
service sequence-numbers
logging buffered 64000 informational

! --- Step 2: Source Interface & Facility Definition ---
! Bind logging traffic to a stable loopback interface to prevent source IP flapping
logging source-interface Loopback0
logging facility local7

! --- Step 3: Syslog Trap Level & Destination Servers ---
! Set logging trap level to 'informational' (level 6) to include BGP ADJCHANGE
logging trap informational

! Define primary and secondary remote syslog / SIEM collectors
logging host 192.0.2.50 transport udp port 514
logging host 192.0.2.51 transport udp port 514

! --- Step 4: BGP Neighbor Change Logging Activation ---
router bgp 65001
 bgp log-neighbor-changes
 exit

end
write memory

Key Takeaway: Binding syslog output to a loopback interface and setting the trap level to informational guarantees reliable transmission of BGP state transitions to centralized collectors.


Centralized Log Management: Syslog Analyzer Tools for BGP Monitoring

While the router CLI is suitable for real-time investigation, managing enterprise BGP topologies requires centralized log analytics platforms. These tools continuously parse Cisco syslog streams, detect flapping neighbor states, and trigger real-time incident workflows.

ToolPrimary Ingestion ProtocolBGP Flap Alerting EngineStorage & Search ArchitectureBest Deployment Scenario
Splunk EnterpriseSyslog (UDP/TCP), HEC, Splunk Universal ForwarderDynamic SPL rules, real-time trigger correlations, MLTK anomaly detectionProprietary indexed flat files; highly scalable distributed clustersLarge enterprises needing deep security analytics, SIEM correlation, and forensic auditing.
Graylog EnterpriseSyslog, GELF, Beats, KafkaStream-based rules, alerting pipelines, correlation engineElasticsearch / OpenSearch backend with MongoDB metadataOrganizations seeking high-throughput log aggregation with flexible, rule-based stream routing.
SolarWinds Log Analyzer (LA) / NPMSyslog, SNMP Traps, NetFlow/IPFIXNative Cisco Syslog event parser; pre-built BGP state change alertsMicrosoft SQL Server backendMid-market to large enterprise IT shops already operating the SolarWinds Orion ecosystem.
PRTG Network MonitorSyslog Receiver, SNMP, Packet SniffingSyslog message filters mapped to sensor error states; native BGP SNMP sensorsProprietary internal databaseSmall-to-midsize networks prioritizing lightweight, all-in-one infrastructure monitoring with minimal configuration overhead.
Elastic Stack (ELK / OpenSearch)Logstash (Syslog input), Filebeat, Elastic AgentWatcher alerts, Kibana alerting rules, Elasticsearch threshold queriesDistributed Lucene indices (Elasticsearch / OpenSearch)Engineering-heavy teams requiring open-source flexibility, deep query customization, and API-driven automation.

Key Takeaway: Selecting a log analysis tool depends on organizational scale: integrated platforms like SolarWinds and PRTG provide out-of-the-box BGP tracking, while Splunk and Graylog provide advanced parsing across distributed environments.


Official Cisco Diagnostic Reference and Technical Standards

Primary Cisco Verification Commands

The following diagnostic commands form the standard verification baseline defined in Cisco technical references:

  • show ip bgp summary: Displays the status of all active BGP connections, the local autonomous system number, and the number of prefixes received. Peering states showing numeric values indicate an Established session; textual representations (e.g., Active, Idle) indicate a non-operational session.
  • show ip bgp neighbors [ip-address]: Outputs complete configuration, operational states, negotiated timers, BGP capabilities, and a running counter of sent and received BGP message types (OPEN, UPDATE, KEEPALIVE, NOTIFICATION).
  • show logging: Displays the state of syslog logging, buffer memory consumption, active log traps, and the contents of the internal message buffer.

Cisco Technical Documentation References

  • Cisco IOS Master Command List – show logging: Outlines command syntax, keyword extensions, and memory allocation parameters across Cisco IOS and IOS-XE releases.
  • Cisco Tech Note (Document ID: 13783 / 22144) – Troubleshooting BGP Neighbor Flaps: Documents systematic diagnostic workflows for resolving transient BGP resets, focusing on MTU mismatches, queue starvation, and interface hardware drops.
  • RFC 4271 (A Border Gateway Protocol 4 – BGP-4): The official Internet Engineering Task Force (IETF) specification defining the BGP Finite State Machine and Section 4.5 NOTIFICATION Message formatting.
  • RFC 4486 (Subcodes for BGP Cease NOTIFICATION Message): The formal standard defining operational error assignments for BGP administrative resets and maximum-prefix enforcement.

Key Takeaway: Cisco diagnostic procedures rely on cross-referencing show ip bgp summary and show logging against standardized RFC 4271 protocol states to verify operational convergence.


Conclusion

Troubleshooting BGP effectively on Cisco routers requires a structured approach to log analysis. Enabling bgp log-neighbor-changes along with millisecond timestamps provides the baseline visibility needed to capture session resets. From the CLI, filtering the buffer with show logging | include %BGP quickly isolates neighbor drops without clutter.

When static logs reveal deeper protocol errors, decoding RFC NOTIFICATION codes and safely applying targeted commands like debug ip bgp <neighbor-ip> events allows you to observe state changes in real time without endangering router stability. Finally, exporting syslog messages to centralized monitoring platforms guarantees long-term retention and automated alerting across your entire routing infrastructure.

Please follow and like us:
Last modified: November 16, 2026

Author

Comments

Write a Reply or Comment

Your email address will not be published.