Monday, May 23, 2011

Chapter 06: Implementing a Border Gateway Protocol Solution for ISP Connectivity (Part03)

Verifying and Troubleshooting BGP

Add a note here You can verify BGP operation using show EXEC commands, including the following:

  • Add a note here show ip bgp— Displays entries in the BGP topology database (BGP table). Specify a network number to get more specific information about a particular network.

  • Add a note here show ip bgp rib-failure— Displays BGP routes that were not installed in the routing information base (RIB), and the reason that they were not installed.

  • Add a note here show ip bgp neighbors— Displays detailed information about the TCP and BGP connections to neighbors.

  • Add a note here show ip bgp summary— Displays the status of all BGP connections.

Add a note hereUse the show ip bgp ? command on a router to see other BGP show commands.

Add a note here debug commands display events as they happen on the router. For BGP, the debug ip bgp privileged EXEC command has many options, including the following:

  • Add a note here dampening— BGP dampening

  • Add a note here events— BGP events

  • Add a note here keepalives— BGP keepalives

  • Add a note here updates— BGP updates


Caution

Add a note hereUse caution when executing debug commands because they may consume a lot of router resources and could cause problems in a busy production network. Debugging output takes priority over other network traffic. Too much debug output may severely reduce the performance of the router or even render it unusable in the worst case.

Add a note hereThe following sections provide sample output for some of these commands.

Add a note here show ip bgp Command Output Example

Add a note hereUse the show ip bgp command to display the BGP topology database (the BGP table).

Add a note here Example 6-19 is a sample output for the show ip bgp command. The status codes are shown at the beginning of each line of output, and the origin codes are shown at the end of each line. In this output, most of the rows have an asterisk (*) in the first column. This means that the next-hop address (in the fifth column) is valid. Remember, for BGP the next-hop address is not always on a router that is directly connected to this router. Other options for the first column are as follows:

  • Add a note here An s indicates that the specified routes are suppressed (usually because routes have been summarized and only the summarized route is being sent).

  • Add a note hereA d, for dampening, indicates that the route is being dampened (penalized) for going up and down too often. Although the route might be up right now, it is not advertised until the penalty has expired.

  • Add a note hereAn h, for history, indicates that the route is unavailable and is probably down. Historic information about the route exists, but a best route does not exist.

  • Add a note hereAn r, for RIB failure, indicates that the route was not installed in the RIB. The reason that the route is not installed can be displayed using the show ip bgp rib-failure command, as described in the next section.

  • Add a note hereAn S, for stale, indicates that the route is stale. (This is used in a nonstop forwarding-aware router.)

Add a note here Example 6-19: show ip bgp Command Output

Add a note hereRouterA#show ip bgp
BGP table version is 14, local router ID is 172.31.11.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r
RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.0.0/24 0.0.0.0 0 32768 i
* i 10.1.0.2 0 100 0 i
*> 10.1.1.0/24 0.0.0.0 0 32768 i
*>i10.1.2.0/24 10.1.0.2 0 100 0 i
*> 10.97.97.0/24 172.31.1.3 0 64998 64997 i
* 172.31.11.4 0 64999 64997 i
* i 172.31.11.4 0 100 0 64999 64997 i
*> 10.254.0.0/24 172.31.1.3 0 0 64998 i
* 172.31.11.4 0 64999 64998 i
* i 172.31.1.3 0 100 0 64998 i
r> 172.31.1.0/24 172.31.1.3 0 0 64998 i
r 172.31.11.4 0 64999 64998 i
r i 172.31.1.3 0 100 0 64998 i
*> 172.31.2.0/24 172.31.1.3 0 0 64998 i

Add a note hereA greater-than sign (>) in the second column indicates the best path for a route selected by BGP. This route is offered to the IP routing table.

Add a note hereThe third column is either blank or has an i in it. If it is blank, BGP learned that route from an external peer. If it has an i, an IBGP neighbor advertised this route to this router.

Add a note here The fourth column lists the networks that the router learned.

Add a note hereThe fifth column lists all the next-hop addresses for each route. This next-hop address column might contain 0.0.0.0, which signifies that this router originated the route.

Add a note hereThe next three columns list three BGP path attributes associated with the path: metric (MED), local preference, and weight.

Add a note hereThe column with the “Path” header may contain a sequence of autonomous systems in the path. From left to right, the first autonomous system listed is the adjacent autonomous system from which this network was learned. The last number (the rightmost autonomous system number) is this network’s originating autonomous system. The autonomous system numbers between these two represent the exact path that a packet takes back to the originating autonomous system. If the path column is blank, the route is from the current autonomous system.

Add a note hereThe last column signifies how this route was entered into BGP on the original router (the origin attribute). If the last column has an i in it, the original router probably used a network command to introduce this network into BGP. The character e signifies that the original router learned this network from EGP, which is the historic predecessor to BGP. A question mark (?) signifies that the original BGP process cannot absolutely verify this network’s availability because it is redistributed from an IGP into the BGP process.

Add a note here show ip bgp rib-failure Command Output Example

Add a note hereUse the show ip bgp rib-failure command to display BGP routes that were not installed in the RIB, and the reason that they were not installed. In Example 6-20 the displayed routes were not installed because a route or routes with a better administrative distance already existed in the RIB.

Add a note here Example 6-20: show ip bgp rib-failure Command Output

Add a note hereRouterA#show ip bgp rib-failure
Network Next Hop RIB-failure RIB-NH Matches
172.31.1.0/24 172.31.1.3 Higher admin distance n/a
172.31.11.0/24 172.31.11.4 Higher admin distance n/a

Add a note here show ip bgp summary Command Output Example

Add a note hereThe show ip bgp summary command is one way to verify the BGP neighbor relationship. Example 6-21 presents sample output from this command. Here are some of the highlights:

  • Add a note here BGP router identifier— IP address that all other BGP speakers recognize as representing this router.

  • Add a note here BGP table version— Increases in increments when the BGP table changes.

  • Add a note here Main routing table version— Last version of BGP database that was injected into the main routing table.

  • Add a note here Neighbor— The IP address, used in the neighbor statement, with which this router is setting up a relationship.

  • Add a note here Version (V)— The version of BGP this router is running with the listed neighbor.

  • Add a note here AS— The listed neighbor’s autonomous system number.

  • Add a note here Messages received (MsgRcvd)— The number of BGP messages received from this neighbor.

  • Add a note here Messages sent (MsgSent)— The number of BGP messages sent to this neighbor.

  • Add a note here TblVer— The last version of the BGP table that was sent to this neighbor.

  • Add a note here In queue (InQ)— The number of messages from this neighbor that are waiting to be processed.

  • Add a note here Out queue (OutQ)— The number of messages queued and waiting to be sent to this neighbor. TCP flow control prevents this router from overwhelming a neighbor with a large update.

  • Add a note here Up/down— The length of time this neighbor has been in the current BGP state (established, active, or idle).

  • Add a note here State— The current state of the BGP session: active, idle, open sent, open confirm, or idle (admin). The admin state is new to Cisco IOS Software Release 12.0; it indicates that the neighbor is administratively shut down. This state is created by using the neighbor ip-address shutdown router configuration command. (Neighbor states are discussed in more detail in the “Understanding and Troubleshooting BGP Neighbor States” section, later in this chapter.) Note that if the session is in the established state, a state is not displayed. Instead, a number representing the PfxRcd is displayed, as described next.


    Note

    Add a note hereIf the State field of the show ip bgp summary command indicates active, the router is attempting to create a TCP connection to this neighbor.

  • Add a note here Prefix received (PfxRcd)— When the session is in the established state, this value represents the number of BGP network entries received from this neighbor.

Add a note here Example 6-21: show ip bgp summary Command Output

Add a note hereRouterA#show ip bgp summary
BGP router identifier 10.1.1.1, local AS number 65001
BGP table version is 124, main routing table version 124
9 network entries using 1053 bytes of memory
22 path entries using 1144 bytes of memory
12/5 BGP path/bestpath attribute entries using 1488 bytes of memory
6 BGP AS-PATH entries using 144 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 3829 total bytes of memory
BGP activity 58/49 prefixes, 72/50 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

10.1.0.2 4 65001 11 11 124 0 0 00:02:28 8
172.31.1. 3 4 64998 21 18 124 0 0 00:01:13 6
172.31.11. 4 4 64999 11 10 124 0 0 00:01:11 6


Note

Add a note here Example output of the show ip bgp neighbors command is provided in the “Understanding and Troubleshooting BGP Neighbor States” section, later in this chapter.

Add a note here debug ip bgp updates Command Output Example

Add a note here Example 6-22 shows partial output from the debug ip bgp updates command on Router A after the clear ip bgp command is issued to clear BGP sessions with its IBGP neighbor 10.1.0.2.

Add a note here Example 6-22: debug ip bgp updates Command Output

Add a note hereRouterA#debug ip bgp updates
Mobile router debugging is on for address family: IPv4 Unicast
RouterA#clear ip bgp 10.1.0.2

*May 24 11:06:41.309: %BGP-5-ADJCHANGE: neighbor 10.1.0.2 Up
*May 24 11:06:41.309: BGP(0): 10.1.0.2 send UPDATE (format) 10.1.1.0/24, next
10.1.0.1, metric 0, path Local
*May 24 11:06:41.309: BGP(0): 10.1.0.2 send UPDATE (prepend, chgflags: 0x0)
10.1.0.0/24, next 10.1.0.1, metric 0, path Local
*May 24 11:06:41.309: BGP(0): 10.1.0.2 NEXT_HOP part 1 net 10.97.97.0/24, next
172.31.11.4
*May 24 11:06:41.309: BGP(0): 10.1.0.2 send UPDATE (format) 10.97.97.0/24, next
172.31.11.4, metric 0, path 64999 64997
*May 24 11:06:41.309: BGP(0): 10.1.0.2 NEXT_HOP part 1 net 172.31.22.0/24, next
172.31.11.4
*May 24 11:06:41.309: BGP(0): 10.1.0.2 send UPDATE (format) 172.31.22.0/24, next
172.31.11.4, metric 0, path 64999

*May 24 11:06:41.349: BGP(0): 10.1.0.2 rcvd UPDATE w/ attr: nexthop 10.1.0.2,
origin i, localpref 100, metric 0
*May 24 11:06:41.349: BGP(0): 10.1.0.2 rcvd 10.1.2.0/24
*May 24 11:06:41.349: BGP(0): 10.1.0.2 rcvd 10.1.0.0/24

Add a note hereAfter the neighbor adjacency is reestablished, Router A creates and sends updates to 10.1.0.2. The first update highlighted in the example, 10.1.1.0/24, next 10.1.0.1, is an update about network 10.1.1.0/24, with a next hop of 10.1.0.1, which is Router A’s address. The second update highlighted in the example, 10.97.97.0/24, next 172.31.11.4, is an update about network 10.97.97.0/24, with a next hop of 172.31.11.4, which is the address of one of Router A’s EBGP neighbors. The EBGP next-hop address is being carried into IBGP.

Add a note here Router A later receives updates from 10.1.0.2. The update highlighted in the example contains a path to two networks, 10.1.2.0/24 and 10.1.0.0/24.

Add a note here Understanding and Troubleshooting BGP Neighbor States

Add a note hereAfter the TCP handshake is complete, the BGP application tries to set up a session with the neighbor. BGP is a state machine that takes a router through the following states with its neighbors:

  • Add a note here Idle— The router is searching the routing table to see whether a route exists to reach the neighbor.

  • Add a note here Connect— The router found a route to the neighbor and has completed the three-way TCP handshake.

  • Add a note here Open sent— An open message was sent, with the parameters for the BGP session.

  • Add a note here Open confirm— The router received agreement on the parameters for establishing a session.

Add a note hereAlternatively, the router goes into active state if there is no response to the open message.

  • Add a note here Established— Peering is established and routing begins.

Add a note hereAfter you enter the neighbor command, BGP starts in the idle state, and the BGP process checks that it has a route to the IP address listed. BGP should be in the idle state for only a few seconds. However, if BGP does not find a route to the neighboring IP address, it stays in the idle state. If it finds a route, it goes to the connect state when the TCP handshaking synchronize acknowledge (SYN ACK) packet returns (when the TCP three-way handshake is complete). After the TCP connection is set up, the BGP process creates a BGP open message and sends it to the neighbor. After BGP dispatches this open message, the BGP peering session changes to the open sent state. If there is no response for 5 seconds, the state changes to the active state. If a response does come back in a timely manner, BGP goes to the open confirm state and starts scanning (evaluating) the routing table for the paths to send to the neighbor. When these paths have been found, BGP then goes to the established state and begins routing between the neighbors.

Add a note hereThe BGP state is shown in the last column of the show ip bgp summary command output.


Note

Add a note here You can observe the states that two BGP routers are going through to establish a session using debug commands. In Cisco IOS Software Release 12.4, you can use the debug ip bgp ipv4 unicast command (or the debug bgp ipv4 unicast events command) to see this process. In earlier IOS releases, only the debug ip bgp events command was available to provide similar output.

Idle State Troubleshooting

Add a note hereThe idle state indicates that the router does not know how to reach the IP address listed in the neighbor statement. The router is idle for one of the following reasons:

  • Add a note hereIt is waiting for a static route to that IP address or network to be configured.

  • Add a note hereIt is waiting for the local routing protocol (IGP) to learn about this network through an advertisement from another router.

Add a note hereThe most common reason for the idle state is that the neighbor is not announcing the IP address or network that the neighbor statement of the router is pointing to. Check the following two conditions to troubleshoot this problem:

  • Add a note hereEnsure that the neighbor announces the route in its local routing protocol (IGP) (for IBGP neighbors).

  • Add a note hereVerify that you have not entered an incorrect IP address in the neighbor statement.

Active State Troubleshooting

Add a note hereIf the router is in the active state, this means that it has found the IP address in the neighbor statement and has created and sent out a BGP open packet but has not received a response (an open confirm packet) back from the neighbor.

Add a note hereOne common cause of this is when the neighbor does not have a return route to the source IP address. Ensure that the source IP address or network of the packets is advertised into the local routing protocol (IGP) on the neighboring router.

Add a note hereAnother common problem associated with the active state is when a BGP router attempts to peer with another BGP router that does not have a neighbor statement peering back at the first router, or the other router is peering with the wrong IP address on the first router. Check to ensure that the other router has a neighbor statement peering at the correct address of the router that is in the active state.

Add a note hereIf the state toggles between idle and active, the autonomous system numbers might be misconfigured. You see the following console message at the router with the wrong autonomous system number configured in the neighbor statement:

Add a note here%BGP-3-NOTIFICATION: sent to neighbor 172.31.1.3 2/2 (peer in wrong AS)
2 bytes FDE6
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 002D 0104 FDE6 00B4 AC1F 0203 1002 0601
0400 0100 0102 0280 0002 0202 00

Add a note hereAt the remote router, you see the following message:

Add a note here%BGP-3-NOTIFICATION: received from neighbor 172.31.1.1 2/2 (peer in wrong AS) 2 bytes FDE6

Established State

Add a note here The desired state for a neighbor relationship is the established state. This state means that both routers agree to exchange BGP updates with one another and routing has begun. As mentioned, if the state column in the show ip bgp summary command output is blank or has a number in it, BGP is in the established state, and the number shown is the number of routes that have been learned from this neighbor.

Add a note hereUse the show ip bgp neighbors command to display information about the BGP connections to neighbors. In Example 6-23, the BGP state is established, which means that the neighbors have established a TCP connection and the two peers have agreed to use BGP to communicate.

Add a note here Example 6-23: show ip bgp neighbors Command Output

Add a note hereRouterA#show ip bgp neighbors
BGP neighbor is 172.31.1.3, remote AS 64998, external link
BGP version 4, remote router ID 172.31.2.3
BGP state = Established, up for 00:19:10
Last read 00:00:10, last write 00:00:10, hold time is 180, keepalive interval
is 60 seconds
Neighbor capabilities:
Route refresh: advertised and received(old & new)
Address family IPv4 Unicast: advertised and received
Message statistics:
InQ depth is 0
OutQ depth is 0
Sent Rcvd
Opens: 7 7
Notifications: 0 0
Updates: 13 38

No comments:

Post a Comment