NHT feature for BGP
关于BGP Feature:NHT(Next-Hop Tracking)。之前没接触过这个Feature,正好可以测试下。这个feature主要是当用户通过多个neighbor学来同样的前缀时,优选的下一跳地址在RIB里找不到了,那么他会自动切换到另一个下一跳,不用等待bgp neighbor 超时,这样可以加快收敛,这个Feature主要与IGP联动。另外为了防止默认路由使NHT失效,需要用route-map过滤非明晰路由。
测试Topology:
ASR1k——————CRS
测试信息:
ASR1002-1#sh run | b r b router bgp 4837 bgp log-neighbor-changes neighbor 1.1.1.1 remote-as 65152 neighbor 1.1.1.1 ebgp-multihop 3 neighbor 1.1.1.1 update-source Loopback0 neighbor 11.11.11.11 remote-as 65152 neighbor 11.11.11.11 ebgp-multihop 3 neighbor 11.11.11.11 update-source Loopback1 ! address-family ipv4 bgp nexthop route-map rp_NHT !--- empty! bgp nexthop trigger delay 2 network 11.11.11.11 mask 255.255.255.255 network 12.12.12.12 mask 255.255.255.255 neighbor 1.1.1.1 activate neighbor 11.11.11.11 activate exit-address-family ASR1002-1#sh bgp BGP table version is 44, local router ID is 12.12.12.12 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter, a additional-path Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.68.0.0/16 ----1.1.1.1 0 65152 i * 11.11.11.11 0 65152 i ASR1002-1# ASR1002-1# ASR1002-1#sh ip route ospf Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP + - replicated route, % - next hop override Gateway of last resort is 12.1.1.1 to network 0.0.0.0 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/2] via 219.158.2.154, 00:08:20, GigabitEthernet0/0/2 11.0.0.0/32 is subnetted, 1 subnets O 11.11.11.11 [110/2] via 219.158.2.154, 00:00:36, GigabitEthernet0/0/2
>>> Shutdown lo1:1.1.1.1 at CRS, check whether NHB feature work and have alarm?
ASR1002-1#sh ip route ospf Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP + - replicated route, % - next hop override Gateway of last resort is 12.1.1.1 to network 0.0.0.0 11.0.0.0/32 is subnetted, 1 subnets O 11.11.11.11 [110/2] via 219.158.2.154, 00:07:27, GigabitEthernet0/0/2
>>>IGP had already remove 1.1.1.1, but base on follow information, bgp not change until hold time expire
ASR1002-1#sh bgp BGP table version is 44, local router ID is 12.12.12.12 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter, a additional-path Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.68.0.0/16 ----1.1.1.1 0 65152 i * 11.11.11.11 0 65152 i >>> found have default route, lead feature not work:
ASR1002-1#sh route-map rp_NHT route-map rp_NHT, permit, sequence 20 Match clauses: Set clauses: Policy routing matches: 0 packets, 0 bytes ASR1002-1# ASR1002-1# ASR1002-1#sh ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP + - replicated route, % - next hop override Gateway of last resort is 12.1.1.1 to network 0.0.0.0 S* 0.0.0.0/0 [1/0] via 12.1.1.1 1.0.0.0/32 is subnetted, 1 subnets
>>> deny default route and non-exact route
ASR1002-1#config ter
Enter configuration commands, one per line. End with CNTL/Z.
ASR1002-1(config)#no route-map rp_NHT permit 20
ASR1002-1(config)#ip prefix-list pl_NHT seq 10 permit 0.0.0.0/0 le 23
!--- match before 23 prefix.
ASR1002-1(config)#route-map rp_NHT deny 10
ASR1002-1(config-route-map)# match ip address prefix-list pl_NHT
ASR1002-1(config-route-map)#!
ASR1002-1(config-route-map)#route-map rp_NHT permit 20
ASR1002-1(config-route-map)#end
>>> check again, found work and no any alarm appear.
ASR1002-1#sh bgp BGP table version is 8, local router ID is 21.21.21.21 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter, a additional-path Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * 10.68.0.0/16 11.11.11.11 0 65152 i *> -----------------1.1.1.1 0 65152 i ASR1002-1#sh ip route ospf Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP + - replicated route, % - next hop override Gateway of last resort is 12.1.1.1 to network 0.0.0.0 11.0.0.0/32 is subnetted, 1 subnets O 11.11.11.11 [110/2] via 219.158.2.154, 00:01:15, GigabitEthernet0/0/2 ASR1002-1#sh ip bgp BGP table version is 14, local router ID is 21.21.21.21 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter, a additional-path Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.68.0.0/16 ----11.11.11.11 0 65152 i * 1.1.1.1 0 65152 I本文出自 Frank's Blog