示例topo
配置
RTA
RTA# show running-config
Building configuration...
Current configuration:
!
frr version 7.1
frr defaults traditional
hostname bf79f75dec12
log syslog informational
no ipv6 forwarding
hostname RTA
service integrated-vtysh-config
!
router bgp 65001
neighbor 10.1.1.2 remote-as external
neighbor 10.1.4.2 remote-as external
!
line vty
!
end
RTA#
RTB
RTB# show running-config
Building configuration...
Current configuration:
!
frr version 7.1
frr defaults traditional
hostname f185e5bbda31
log syslog informational
no ipv6 forwarding
hostname RTB
service integrated-vtysh-config
!
router bgp 65002
neighbor 10.1.1.1 remote-as 65001
neighbor 10.1.2.2 remote-as 65003
!
line vty
!
end
RTB#
RTC
RTC# show running-config
Building configuration...
Current configuration:
!
frr version 7.1
frr defaults traditional
hostname fea24e78f62c
log syslog informational
no ipv6 forwarding
hostname RTC
service integrated-vtysh-config
!
router bgp 65003
neighbor 10.1.2.1 remote-as external
neighbor 10.1.3.2 remote-as external
!
address-family ipv4 unicast
network 6.6.6.0/24
exit-address-family
!
line vty
!
end
RTC#
RTD
RTD# show running-config
Building configuration...
Current configuration:
!
frr version 7.1
frr defaults traditional
hostname a4a4612ba83a
log syslog informational
no ipv6 forwarding
hostname RTD
service integrated-vtysh-config
!
router bgp 65004
neighbor 10.1.3.1 remote-as external
neighbor 10.1.4.1 remote-as external
!
line vty
!
end
RTD#
分析BGP路由表
RTC# show ip bgp
BGP table version is 5, local router ID is 172.17.0.4, vrf id 0
Default local pref 100, local AS 65003
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 0.0.0.0 0 32768 i
Displayed 1 routes and 1 total paths
RTC#
version字段是版本号,bgp路由表最佳路径发生变化时会加1。例如上面的版本号为5,当RTC路由器撤销6.6.6.0/24路由后,RTA的版本号会加1,变成6.
local router ID 路由器ID,默认使用环回后IP地址,如果没有环回口的话,会选择端口中最大的一个IP地址。
**vrf id ** 路由表所属VRF实例id,默认VRF的id为0。
路由前面会有*>符号,其含义如下:
- The ***** 表示该路由为有效路由,BGP能够使用它。
- The > 表示最佳路由,BGP将其安装到路由表中,如下面可知路由表中安装的就是>对应的路由。
Network字段表示路由前缀
**Next Hop **表示下一跳,当下一跳为0.0.0.0时,表示该路由为本机发布的路由,一般是使用network命令。
Metric 度量值,用于EBGP之间,值越大优先级越低。用于最佳路径选择的第三个属性。
LocPrf 本地优先级,用于最佳路径选择的第二个属性。
Weight 权重,思科私有属性,只在本机有效,frr也实现了该属性,是最佳路径选择的第一个属性,不会传递给其它路由器,值越高优先级越大。
Path 表示经过的路径,由自治区.上面的示例,path下面没有内容,表示该路由是本机发布的。
i 表示来源为IGP,使用network命令发布到BGP的路由。当使用redistribute重分发IGP路由到BGP时,其标志位?
?参考上面的i。
e表示从EGP(注意是EGP,不是EBGP)中学习到路由,但是不能在bgp路由表中看到,这个协议是BGP的前身,已经不再使用了。
还有以下其它的状态码
- supressed: BGP知道这条路由,但是不会发布它,这可能发生在该路由是一个聚合路由的一部分,聚合时设置了summary标志。
- damped: BGP不会发布这条路由,因为它抖动频繁,处于惩罚状态 。
- history: BGP 曾经学习到了这条路由,但此时它不再有效。
- RIB-failure: BGP学习到了这条路由但是没有将其安装到路由表中,这通常发生在:当另一个路由协议学习到了该路由但是有更低的distance参数。
- stale: this is used for non-stop forwarding, this entry has to be refreshed when the remote BGP neighbor has returned.
查看RTA的路由表
RTA# show ip bgp
BGP table version is 5, 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.4.2 0 65004 65003 i
*> 10.1.1.2 0 65002 65003 i
Displayed 1 routes and 2 total paths
RTA#
RTB
RTB# show ip bgp
BGP table version is 5, local router ID is 172.17.0.3, vrf id 0
Default local pref 100, local AS 65002
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.2.2 0 0 65003 i
Displayed 1 routes and 1 total paths
RTB#
RTD
RTD# show ip bgp
BGP table version is 7, local router ID is 172.17.0.5, vrf id 0
Default local pref 100, local AS 65004
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.4.1 0 65001 65002 65003 i
*> 10.1.3.1 0 0 65003 i
Displayed 1 routes and 2 total paths
RTD#