BGP 如何閱讀BGP路由表


示例topo

image-20200114183605307

配置

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# 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM