實驗拓撲
實驗說明:配置RTA和RTB互為鄰居,在RTB上使用network命令發布兩條路由給RTA,改變RTB的路由策略,觸發RTA向RTB發送route-refresh消息
配置
步驟1
RTA
Current configuration:
!
frr version 7.1
frr defaults traditional
hostname 1fb9e963c62c
log syslog informational
no ipv6 forwarding
service integrated-vtysh-config
!
router bgp 65001
neighbor 10.1.1.2 remote-as external
!
line vty
!
end
RTB
Current configuration:
!
frr version 7.1
frr defaults traditional
hostname 1fb9e963c62c
log syslog informational
no ipv6 forwarding
service integrated-vtysh-config
!
router bgp 65002
neighbor 10.1.1.1 remote-as external
!
address-family ipv4 unicast
network 6.6.6.0/24
network 6.6.7.0/24
exit-address-family
!
line vty
!
end
查看RTA上的鄰居信息
31ae5a7ab4e1# show bgp neighbors 10.1.1.2
BGP neighbor is 10.1.1.2, remote AS 65002, local AS 65001, external link
Hostname: 1fb9e963c62c
BGP version 4, remote router ID 172.17.0.3, local router ID 172.17.0.2
BGP state = Established, up for 00:46:08
Last read 00:00:08, Last write 00:00:08
Hold time is 180, keepalive interval is 60 seconds
Neighbor capabilities:
4 Byte AS: advertised and received
AddPath:
IPv4 Unicast: RX advertised IPv4 Unicast and received
Route refresh: advertised and received(old & new)
從上面可以看出,RTB是支持route-refresh的。frr默認開啟route-refresh功能。
查看RTA上的路由信息
31ae5a7ab4e1# show ip bgp
BGP table version is 10, local router ID is 172.17.0.2, vrf id 0
Default local pref 100, local AS 65001
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 6.6.6.0/24 10.1.1.2 0 0 65002 i
*> 6.6.7.0/24 10.1.1.2 0 0 65002 i
Displayed 2 routes and 2 total paths
31ae5a7ab4e1#
步驟2
在RTA上配置route-map觸發路由策略變化
31ae5a7ab4e1(config)#
31ae5a7ab4e1(config)# route-map METRIC permit 10
31ae5a7ab4e1(config-route-map)# set metric 222
31ae5a7ab4e1(config-route-map)# exit
31ae5a7ab4e1(config)# router bgp 65001
31ae5a7ab4e1(config-router)# address-family ipv4 unicast
31ae5a7ab4e1(config-router-af)# neighbor 10.1.1.2 route-map METRIC in
31ae5a7ab4e1(config-router-af)#
查看RTA上的路由信息
31ae5a7ab4e1# show ip bgp
BGP table version is 12, local router ID is 172.17.0.2, vrf id 0
Default local pref 100, local AS 65001
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 6.6.6.0/24 10.1.1.2 222 0 65002 i
*> 6.6.7.0/24 10.1.1.2 222 0 65002 i
Displayed 2 routes and 2 total paths
31ae5a7ab4e1#
從兩個路由信息可以看出,路由的Metric從0變到了222,路由進行了刷新。
抓包查看
從上面的報文可以看出,RTA給RTB發送了route-refresh消息,RTB重發了原來的兩條路由前綴。