Thursday, May 8, 2014

CCNP ROUTE: 12. BGP RIB Failure

When the BGP best path algorithm has chosen a best route for a prefix, the router then tries to add that route to the IP routing table.
However, rather than add the BGP route to the IP routing table directly, BGP actually gives that best BGP route to another process for consideration: The IOS Routing Table Manager (RTM).
The IOS RTM chooses the best route among many competing sources. For example, routes may be learned by an IGP, BGP, or even as connected or static routes.
IOS collects the best such route for each prefix and feeds those into the RTM function. The RTM then chooses the best route.
RTM uses the concept of Administrative Distance (AD) to choose the best route among these different sources (eBGP AD 20, iBGP AD 200)
An Enterprise router should not see cases in which a prefix learned with BGP has also been learned as a connected or IGP-learned route.

The show ip bgp rib-failures command lists routes for which BGP has chosen the route as best, but the RTM function has not placed the route into the Routing Information Base (RIB), which is simply another name for the IP routing table.

To illustrate a BGP RIB failure, we must first enable the link between R1 and R2 and establish an iBGP peering between them.
The following configs are used, in order for R1 to have only R101 as eBGP peer and R2 to have only R102 as eBGP peer.

R1(config)#int fa 0/0
R1(config-if)#shut

R2(config)#int fa 0/0
R2(config-if)#shut


R1:

!
interface Loopback1
 ip address 1.1.1.1 255.255.255.255
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 100
 neighbor 2.2.2.2 update-source Loopback1
 neighbor 2.2.2.2 next-hop-self
 neighbor 101.101.101.101 remote-as 101
 neighbor 101.101.101.101 password ccnp
 neighbor 101.101.101.101 ebgp-multihop 2
 neighbor 101.101.101.101 update-source Loopback1
 no auto-summary
!
ip route 101.101.101.101 255.255.255.255 201.1.1.2
!

R2:

!
interface Loopback2
 ip address 2.2.2.2 255.255.255.255
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 update-source Loopback2
 neighbor 1.1.1.1 next-hop-self
 neighbor 102.102.102.102 remote-as 102
 neighbor 102.102.102.102 ebgp-multihop 2
 neighbor 102.102.102.102 update-source Loopback2
 no auto-summary
!
ip route 102.102.102.102 255.255.255.255 202.2.2.6
!

R101:

!
interface Loopback101
 ip address 101.101.101.101 255.255.255.255
!
router bgp 101
 no synchronization
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 password ccnp
 neighbor 1.1.1.1 ebgp-multihop 2
 neighbor 1.1.1.1 update-source Loopback101
 neighbor 104.104.104.104 remote-as 104
 neighbor 104.104.104.104 password ccnp
 neighbor 104.104.104.104 ebgp-multihop 2
 neighbor 104.104.104.104 update-source Loopback101
 no auto-summary
!
ip route 1.1.1.1 255.255.255.255 201.1.1.1
ip route 104.104.104.104 255.255.255.255 114.1.1.2
!

R102:

!
interface Loopback102
 ip address 102.102.102.102 255.255.255.255
!
router bgp 102
 no synchronization
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 100
 neighbor 2.2.2.2 ebgp-multihop 2
 neighbor 2.2.2.2 update-source Loopback102
 neighbor 103.103.103.103 remote-as 103
 neighbor 103.103.103.103 ebgp-multihop 2
 neighbor 103.103.103.103 update-source Loopback102
 no auto-summary
!
ip forward-protocol nd
ip route 2.2.2.2 255.255.255.255 202.2.2.5
ip route 103.103.103.103 255.255.255.255 123.1.1.2
!

R103:

!
interface Loopback103
 ip address 103.103.103.103 255.255.255.255
!
router bgp 103
 no synchronization
 bgp log-neighbor-changes
 neighbor 102.102.102.102 remote-as 102
 neighbor 102.102.102.102 ebgp-multihop 2
 neighbor 102.102.102.102 update-source Loopback103
 neighbor 104.104.104.104 remote-as 104
 neighbor 104.104.104.104 ebgp-multihop 2
 neighbor 104.104.104.104 update-source Loopback103
 no auto-summary
!        
ip route 102.102.102.102 255.255.255.255 123.1.1.1
ip route 104.104.104.104 255.255.255.255 134.1.1.2
!

R104:

!
interface Loopback40
 ip address 192.168.40.40 255.255.255.255
!
interface Loopback41
 ip address 192.168.41.41 255.255.255.255
!
interface Loopback42
 ip address 192.168.42.42 255.255.255.255
!
interface Loopback43
 ip address 192.168.43.43 255.255.255.255
!
interface Loopback44
 ip address 192.168.44.44 255.255.255.255
!
interface Loopback104
 ip address 104.104.104.104 255.255.255.255
!
router bgp 104
 no synchronization
 bgp log-neighbor-changes
 network 192.168.40.40 mask 255.255.255.255
 network 192.168.41.41 mask 255.255.255.255
 network 192.168.42.42 mask 255.255.255.255
 network 192.168.43.43 mask 255.255.255.255
 network 192.168.44.44 mask 255.255.255.255
 neighbor 101.101.101.101 remote-as 101
 neighbor 101.101.101.101 password ccnp
 neighbor 101.101.101.101 ebgp-multihop 2
 neighbor 101.101.101.101 update-source Loopback104
 neighbor 103.103.103.103 remote-as 103
 neighbor 103.103.103.103 ebgp-multihop 2
 neighbor 103.103.103.103 update-source Loopback104
 no auto-summary
!
ip route 101.101.101.101 255.255.255.255 114.1.1.1
ip route 103.103.103.103 255.255.255.255 134.1.1.1
!

The results on R1 and R2 are (we are going to focus on the 192.168.44.44/32 route again):

R1#show ip bgp
BGP table version is 6, local router ID is 1.1.1.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
*> 192.168.40.40/32 101.101.101.101                        0 101 104 i
*> 192.168.41.41/32 101.101.101.101                        0 101 104 i
*> 192.168.42.42/32 101.101.101.101                        0 101 104 i
*> 192.168.43.43/32 101.101.101.101                        0 101 104 i
*> 192.168.44.44/32 101.101.101.101                        0 101 104 i

R2#show ip bgp
BGP table version is 11, local router ID is 2.2.2.2
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
*>i192.168.40.40/32 1.1.1.1                  0    100      0 101 104 i
*                   102.102.102.102                        0 102 103 104 i
*>i192.168.41.41/32 1.1.1.1                  0    100      0 101 104 i
*                   102.102.102.102                        0 102 103 104 i
*>i192.168.42.42/32 1.1.1.1                  0    100      0 101 104 i
*                   102.102.102.102                        0 102 103 104 i
*>i192.168.43.43/32 1.1.1.1                  0    100      0 101 104 i
*                   102.102.102.102                        0 102 103 104 i
*>i192.168.44.44/32 1.1.1.1                  0    100      0 101 104 i
*                   102.102.102.102                        0 102 103 104 i

At this point, both R1 and R2 choose the path via R1-R101 to reach 192.168.44.44/32 due to the shorter AS_PATH.

We will configure next the same route-map/local preference settings on R2 as in the previous lab:

R2(config)#ip prefix-list pref44 permit 192.168.44.44/24 le 32
R2(config)#route-map set-pref-200 permit 10
R2(config-route-map)#match ip address prefix-list pref44
R2(config-route-map)#set local-preference 200
R2(config)#route-map set-pref-200 permit 20

R2(config)#router bgp 100
R2(config-router)#neighbor 102.102.102.102 route-map set-pref-200 in
R2#clear ip bgp 102.102.102.102 soft


The result is that now both routers prefer the path via R2-R102 due to the higher LOCAL_PREF:

R1#show ip bgp                 
BGP table version is 7, local router ID is 1.1.1.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
*> 192.168.40.40/32 101.101.101.101                        0 101 104 i
*> 192.168.41.41/32 101.101.101.101                        0 101 104 i
*> 192.168.42.42/32 101.101.101.101                        0 101 104 i
*> 192.168.43.43/32 101.101.101.101                        0 101 104 i
*>i192.168.44.44/32 2.2.2.2                  0    200      0 102 103 104 i
*                   101.101.101.101                        0 101 104 i

R2#show ip bgp
BGP table version is 12, local router ID is 2.2.2.2
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
*>i192.168.40.40/32 1.1.1.1                  0    100      0 101 104 i
*                   102.102.102.102                        0 102 103 104 i
*>i192.168.41.41/32 1.1.1.1                  0    100      0 101 104 i
*                   102.102.102.102                        0 102 103 104 i
*>i192.168.42.42/32 1.1.1.1                  0    100      0 101 104 i
*                   102.102.102.102                        0 102 103 104 i
*>i192.168.43.43/32 1.1.1.1                  0    100      0 101 104 i
*                   102.102.102.102                        0 102 103 104 i
*> 192.168.44.44/32 102.102.102.102               200      0 102 103 104 i

R1 learned the route via iBGP from R2, with an AD of 200:

R1#show ip route 192.168.44.44
Routing entry for 192.168.44.44/32
  Known via "bgp 100", distance 200, metric 0
  Tag 102, type internal
  Last update from 2.2.2.2 00:18:43 ago
  Routing Descriptor Blocks:
  * 2.2.2.2, from 2.2.2.2, 00:18:43 ago
      Route metric is 0, traffic share count is 1
      AS Hops 3
      Route tag 102
     
Now, if another route to the same destination and with a lower (more preferable) AD leaks into the routing table, a RIB failure will occur.
The cause is that BGP has chosen the route as best, but the RTM function has not placed the route into the Routing Information Base (RIB) due to the other route with better AD.
We can accomplish this either with an IGP leakage or by setting a static route:

R1(config)#ip route 192.168.44.44 255.255.255.255 2.2.2.2 199

R1#show ip route 192.168.44.44
Routing entry for 192.168.44.44/32
  Known via "static", distance 199, metric 0
  Routing Descriptor Blocks:
  * 2.2.2.2
      Route metric is 0, traffic share count is 1
     
R1#show ip bgp
BGP table version is 9, local router ID is 1.1.1.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
*> 192.168.40.40/32 101.101.101.101                        0 101 104 i
*> 192.168.41.41/32 101.101.101.101                        0 101 104 i
*> 192.168.42.42/32 101.101.101.101                        0 101 104 i
*> 192.168.43.43/32 101.101.101.101                        0 101 104 i
r>i192.168.44.44/32 2.2.2.2                  0    200      0 102 103 104 i
r                   101.101.101.101                        0 101 104 i

R1#show ip bgp rib-failure
Network            Next Hop                      RIB-failure   RIB-NH Matches
192.168.44.44/32   2.2.2.2             Higher admin distance              n/a

No comments:

Post a Comment