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.
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.
|0. Synchronized||TRUE||Use only routes that meet the synchronization requirement|
|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
|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 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
sh ip bgp summary
Helps to debug the neighbor table.
R1#sh ip bgp summ BGP router identifier 18.104.22.168, 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 22.214.171.124 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 126.96.36.199, remote AS 65002, external link BGP version 4, remote router ID 188.8.131.52 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 184.108.40.206 advertised-routes BGP table version is 16, local router ID is 220.127.116.11 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 *> 18.104.22.168/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 22.214.171.124 routes BGP table version is 16, local router ID is 126.96.36.199 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 * 188.8.131.52/30 184.108.40.206 0 0 65002 i *> 220.127.116.11/29 18.104.22.168 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 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/30 188.8.131.52 0 0 65002 i *> 0.0.0.0 0 32768 i *> 184.108.40.206/29 220.127.116.11 0 0 65002 i
sh ip route bgp
What routes are making it from the RIB to routing table.
R1#sh ip route bgp 18.104.22.168/24 is variably subnetted, 2 subnets, 2 masks B 22.214.171.124/29 [20/0] via 126.96.36.199, 4w5d
debug ip bgp
debug ip bgp updates