One of the best commands to verify and troubleshoot your BGP configuration is show ip bgp to see the BGP topology database. This is such an important command that it's worth looking at in depth. The command output lists a table of all the networks BGP knows about, the next hop for each network, some of the attributes for each route, and the AS path for each route. The sample output from this command was taken from an actual Internet BGP peer.
route-server>show ip bgp BGP table version is 22285573, local router ID is 22.214.171.124 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 * 126.96.36.199 188.8.131.52 0 7018 2914 9304 80 i *> 184.108.40.206 0 7018 2914 9304 80 i * 220.127.116.11/23 18.104.22.168 0 7018 ? * 22.214.171.124 2366 0 7018 ? *> 126.96.36.199 0 7018 ? * 188.8.131.52/24 184.108.40.206 0 7018 701 14744 14744 14276 i * 220.127.116.11 0 7018 701 14744 14744 14276 i *> 18.104.22.168 0 7018 701 14744 14744 14276 i
Networks are listed in numerical order, smallest to largest. The first three columns list each route's status. An asterisk (*) in the first column means that the route has a valid next hop. Some other options for the first column include the following:
- "s" for suppressed: BGP knows about this network but is not advertising it, usually because it is part of a summarized route.
- "d" for dampened: BGP can stop advertising a network that flaps (goes up and down) too often until it is stable for a period of time.
- "h" for history: BGP knows about this network but does not currently have a valid route to it.
- "r" for RIB failure: The route was advertised to BGP but it was not installed in the IP routing table. This might be because of another protocol having the same route with a better administrative distance.
- "S" for stale: Used with nonstop forwarding to indicate that the route is stale and needs to be refreshed when the peer is reestablished.
The second column has a greater-than sign (>) beside the route that was selected as the best path to that network. In the example, the second route was selected for network 22.214.171.124.
The third column is blank in the example, which means that the router learned all the routes from an external neighbor. A route learned from an IBGP neighbor would have an "I" in the third column.
The fourth column lists the networks. Those without a subnet mask, such as network 126.96.36.199, use their classful mask. As seen in the example, when the router learns about the same network from multiple sources, it lists only the network once.
The fifth column lists the next-hop address for each route. As you learned in the previous sections on BGP next hops, this might or might not be a directly connected router. A next-hop of 0.0.0.0 means that the local router originated the route.
If a Med value was received with the route, it is listed in the Metric column. Notice that the advertisement for network 188.8.131.52/23 from the router at 184.108.40.206 has a large Med value of 2366. Because the default Local Preference is used for each of the routes shown, no local preference value is displayed. The default Weight value of 0 is listed, however.
The ninth column shows the AS path for each network. Reading this field from left to right, the first AS number shown is the adjacent AS this router learned the route from. After that, the AS paths that this route traversed are shown in order. The last AS number listed is the originating AS. In the example, our router received an advertisement about network 220.127.116.11 from its neighbor AS 7018, which heard about it from AS 2914, which heard about it from AS 9304. And AS 9304 learned the route from AS 80, which originated it. A blank AS path means that the route was originated in the local AS.
The last column shows how BGP originally learned about the route. Networks 18.104.22.168 and 22.214.171.124 show an "i" for their origin codes. This means that the originating router had a network statement for that route. Network 126.96.36.199 shows a "?" as its origin. This means that the route was redistributed into BGP; BGP considers it an "incomplete" route. You will likely never see the third possibility, an "e," because that means BGP learned the route from the Exterior Gateway Protocol (EGP), which is no longer in use.
Some other useful commands for verifying and troubleshooting BGP include
- show ip bgp rib-failure: Displays routes that were not inserted into the IP routing table and the reason they were not used.
- show ip bgp summary: Displays the memory used by the various BGP databases, BGP activity statistics and a list of BGP neighbors.
- show ip bgp neighbors: Displays details about each neighbor. Can be modified by adding the neighbor IP address.
- show ip bgp neighbors address [received | routes | advertised]: Lets you monitor the routes received from and advertised to a particular neighbor.
You can search for "Internet route servers" to find listings of BGP routers that enable public telnet access for viewing their BGP tables. Trying some of these commands on a public route server can help you become familiar with them.