Troubleshoot BGP

2010-04-13 16:07:12
Troubleshoot BGP
BGP is a path-vector routing protocol. Routes are tracked in terms of the AS they pass through,
and routers avoid loops by rejecting routes that have already passed through their AS.

Definitions
Synchronization — Before iBGP can propagate a route, the route must be learned from an IGP.
Split Horizon — BGP will not advertise a route out the interface from which it was learned.
Path Selection — Routers avoid loops by rejecting routes that already include their AS. BGP attributes are used to determine the best route to a destination.

BGP Attributes

Order

Preference

Description
0. Synchronized

TRUE

Use only routes that meet the synchronization requirement
1. Weight
_______________

Highest

Administrative override, a router will use the interface with the highest weight when multiple paths exist. Not propagated to other routers.
2. Local Preference

Highest

Used internally to pick path out of AS and is propagated to its internal peers.
3. Self Originated

TRUE

Prefer paths that originated on this router.
4. AS-Path

Shortest

Minimize AS-hops, prefer the route that has the shortest AS Path.
5. Origin

i<?

Prefer stability, where IGP is lower than EGP, and EGP is lower than incomplete.
6. Multi-Exit Discriminator (MED)

Lowest

Advertised to external neighbors in an attempt to influence path selection in your AS.
7. External

EBGP<IBGP

External path is preferred over an internal path.
8. IGP cost

Lowest

Prefer the path with the lowest IGP cost.
9. EBGP Peering

Oldest

Prefer stability.
10. RID

Lowest

Finally choose the route with lowest BGP router ID.

Sources: BSCI p. 443 and TSHOOT P.229

BGP Updates three tables

Table

Description

Troubleshoot
Neighbor table

Contains listing of neighbors, their IP address, AS Number, neighborship state.

sh ip bgp summary
sh ip bgp neighbor
debug ip bgp updates
BGP table or BGP Routing Information Base (RIB)

Contains routes learned from BGP neigbors and locally injected routes.

sh ip bgp
__________________
IP Routing table

Only the “best” routes as defined by the attributes make it into the routing table.

sh ip route bgp

BGP States
BGP cycles through five states as it runs:
Idle – Searching for neighbors
Connect – TCP three-way handshake complete with neighbor
Open Sent – BGP Open message has been sent
Open Confirm – Response received
Established – BGP neighborship is established
Remember: Established is good, anything else is bad.

Troubleshoot BGP States
– If a neighbor does not progress from idle, look for a next-hop address that cannot be reached.
– If the neighbor stays active, the neighbor is not responding as expected, so look for things that affect this reply. For instance,the peering IP address or AS number may be incorrect, the neighbor may be misconfigured, or authentication may be misconfigured.
BSCI p.406, TSHOOT p.229

TSHOOT BGP
sh ip bgp summary
Helps to debug the neighbor table.

R1#sh ip bgp summ
BGP router identifier 209.65.200.225, local AS number 65001
BGP table version is 16, main routing table version 16
2 network entries using 234 bytes of memory
3 path entries using 156 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 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 786 total bytes of memory
BGP activity 7/5 prefixes, 10/7 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
209.65.200.226  4 65002   47706   47714       16    0    0 4w5d            2

sh ip bgp neighbor
More neighbor table debugging.

R1#sh ip bgp neighbors 
BGP neighbor is 209.65.200.226,  remote AS 65002, external link
  BGP version 4, remote router ID 209.65.200.242
  BGP state = Established, up for 4w5d
  Last read 00:00:54, last write 00:00:17, 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:                  2          2
    Notifications:          1          0
    Updates:                3          2
    Keepalives:         47711      47704
    Route Refresh:          0          0
    Total:              47717      47708
  Default minimum time between advertisement runs is 30 seconds

 For address family: IPv4 Unicast
  BGP table version 16, neighbor version 16/0
 Output queue size : 0
  Index 1, Offset 0, Mask 0x2
  1 update-group member
                                 Sent       Rcvd
  Prefix activity:               ----       ----
    Prefixes Current:               1          2 (Consumes 104 bytes)
    Prefixes Total:                 1          2
    Implicit Withdraw:              0          0
... output removed for brevity ...

sh ip bgp neigh x.x.x.x advertised-routes
This command should be in the troubleshooting list in the book but is not. It shows what advertisements you are sending to a neighbor.

R1#sh ip bgp neigh 209.65.200.226 advertised-routes 
BGP table version is 16, local router ID is 209.65.200.225
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
*> 209.65.200.224/30
                    0.0.0.0                  0         32768 i

Total number of prefixes 1

sh ip bgp neigh x.x.x.x routes
Similarly this command is not discussed in the book. This command shows which routes are being received. Helps to debug the RIB.

R1#sh ip bgp neigh 209.65.200.226 routes 
BGP table version is 16, local router ID is 209.65.200.225
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
*  209.65.200.224/30
                    209.65.200.226           0             0 65002 i
*> 209.65.200.240/29
                    209.65.200.226           0             0 65002 i

Total number of prefixes 2 

sh ip bgp
Help to debug the RIB.

R1#sh ip bgp
BGP table version is 16, local router ID is 209.65.200.225
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
*  209.65.200.224/30
                    209.65.200.226           0             0 65002 i
*>                  0.0.0.0                  0         32768 i
*> 209.65.200.240/29
                    209.65.200.226           0             0 65002 i

sh ip route bgp
What routes are making it from the RIB to routing table.

R1#sh ip route bgp
     209.65.200.0/24 is variably subnetted, 2 subnets, 2 masks
B       209.65.200.240/29 [20/0] via 209.65.200.226, 4w5d

Debug Commands
debug ip bgp
debug ip bgp updates

This entry was posted in Routing. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s