BGP Messages and Neighbor States

BGP Messages and Neighbor States
The desired state for BGP neighbors is the established state. In that state, the routers have formed
a TCP connection, and they have exchanged Open messages, with the parameter checks having
passed. At this point, topology information can be exchanged using Update messages. Table 11-3
lists the BGP neighbor states, along with some of their characteristics. Note that if the IP addresses
mismatch, the neighbors settle into an active state.
BGP Message Types
BGP uses four basic messages. Table 11-4 lists the message types and provides a brief description
of each.
Table 11-3 BGP Neighbor States
State
Listen for
TCP?
Initiate
TCP?
TCP
Up?
Open
Sent?
Open
Received?
Neighbor
Up?
Idle No
Connect Yes
Active Yes Yes
Open sent Yes Yes Yes Yes
Open confirm Yes Yes Yes Yes Yes
Established Yes Yes Yes Yes Yes Yes
Table 11-4 BGP Message Types
Message Purpose
Open Used to establish a neighbor relationship and exchange basic parameters.
Keepalive Used to maintain the neighbor relationship, with nonreceipt of a keepalive message
within the negotiated Hold timer causing BGP to bring down the neighbor connection.
(The timers can be configured with the bgp timers keepalive holdtime subcommand or
the neighbor [ip-address | peer-group-name] timers keepalive holdtime BGP
subcommand.)
Building BGP Neighbor Relationships 353
Purposefully Resetting BGP Peer Connections
Example 11-3 shows how to reset neighbor connections by using the neighbor shutdown
command and, along the way, shows the various BGP neighbor states. The example uses routers
R1 and R6 from Figure 11-2, as configured in Example 11-2.
Message Purpose
Update Used to exchange routing information, as covered more fully in the next section.
Notification Used when BGP errors occur; causes a reset to the neighbor relationship when sent.
Example 11-3 Examples of Neighbor States
! R1 shuts down R6’s peer connection. debug ip bgp shows moving to a down state,
! which shows as “Idle (Admin)” under show ip bgp summary.
R1# debug ip bgp
BGP debugging is on for address family: BGP IPv4
R1# conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)# router bgp 123
R1(config-router)# neigh 10.1.16.6 shutdown
R1#
*Mar 4 21:01:45.946: BGP: 10.1.16.6 went from Established to Idle
*Mar 4 21:01:45.946: %BGP-5-ADJCHANGE: neighbor 10.1.16.6 Down Admin. shutdown
*Mar 4 21:01:45.946: BGP: 10.1.16.6 closing
R1# show ip bgp summary | include 10.1.16.6
10.1.16.6 4 678 353 353 0 0 0 00:00:06 Idle (Admin)
! Next, the no neighbor shutdown command reverses the admin state. The various
! debug messages (with some omitted) list the various states. Also note that the
! final message is the one log message in this example that occurs due to the
! default configuration of bgp log-neighbor-changes. The rest are the result of
! a debug ip bgp command.
R1# conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)# router bgp 123
R1(config-router)# no neigh 10.1.16.6 shutdown
*Mar 4 21:02:16.958: BGP: 10.1.16.6 went from Idle to Active
*Mar 4 21:02:16.958: BGP: 10.1.16.6 open active, delay 15571ms
*Mar 4 21:02:29.378: BGP: 10.1.16.6 went from Idle to Connect
*Mar 4 21:02:29.382: BGP: 10.1.16.6 rcv message type 1, length (excl. header) 26
*Mar 4 21:02:29.382: BGP: 10.1.16.6 rcv OPEN, version 4, holdtime 180 seconds
*Mar 4 21:02:29.382: BGP: 10.1.16.6 went from Connect to OpenSent
*Mar 4 21:02:29.382: BGP: 10.1.16.6 sending OPEN, version 4, my as: 123, holdtime 180
seconds
*Mar 4 21:02:29.382: BGP: 10.1.16.6 rcv OPEN w/ OPTION parameter len: 16
BGP: 10.1.16.6 rcvd OPEN w/ remote AS 678
continues
Table 11-4 BGP Message Types (Continued)
*Mar 4 21:02:29.382: BGP: 10.1.16.6 went from OpenSent to OpenConfirm
*Mar 4 21:02:29.382: BGP: 10.1.16.6 send message type 1, length (incl. header) 45
*Mar 4 21:02:29.394: BGP: 10.1.16.6 went from OpenConfirm to Established
*Mar 4 21:02:29.398: %BGP-5-ADJCHANGE: neighbor 10.1.16.6 Up
All BGP neighbors can be reset with the clear ip bgp * exec command, which, like the neighbor
shutdown command, resets the neighbor connection, closes the TCP connection to that neighbor,
and removes all entries from the BGP table learned from that neighbor. The clear command will
be shown in the rest of the chapter as needed, including in coverage of how to clear just some
neighbors.
NOTE The clear command can also be used to implement routing policy changes without
resetting the neighbor completely, using a feature called soft reconfiguration. This feature is not
covered in detail in this book.