最近在做BGP練習,在做下面的拓撲的時候遇到了一些問題,拓撲是這樣的
我這樣配置了網段:
其中
1 2 3 4 5 6 7 8 9 10 11 12 13 |
R1 R1(config-if)#do sh ip int br Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial1/0 192.168.12.1 YES manual up up Serial1/1 192.168.13.1 YES manual up up Loopback1 1.1.1.1 YES manual up up |
1 2 3 4 5 6 7 8 9 |
R2 Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial1/0 192.168.12.2 YES manual up up Serial1/1 192.168.24.2 YES manual up up |
1 2 3 4 5 6 7 8 9 |
R3 Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial1/0 192.168.13.3 YES manual up up Serial1/1 192.168.35.3 YES manual up up |
1 2 3 4 5 6 7 8 9 |
R4 Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial1/0 192.168.24.4 YES manual up up Serial1/1 192.168.45.4 YES manual up up |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
R5 R5(config)#do sh ip int br Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial1/0 192.168.35.5 YES manual up up Serial1/1 192.168.45.5 YES manual up up Loopback1 5.5.5.5 YES manual up up Loopback2 7.7.7.7 YES manual up up |
其中R1R2R3在AS1中,R4在AS4中,R5在AS5中
R5上宣告5.5.5.5和7.7.7.7所在網段,R1上宣告1.1.1.1所在網段。
在R1R2R3上跑OSPF,讓AS1 full-mesh但暫時不宣告24和35這兩個網段,這時候應該能在R1上看到bgp表中對於5.5.5.5和7.7.7.7各有兩個路徑並且都沒有寫入路由表
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
R1(config-router)#do sh ip bg BGP table version is 2, 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 *> 1.1.1.0/24 0.0.0.0 0 32768 i * i5.5.5.0/24 192.168.35.5 0 100 0 5 i * i 192.168.24.4 0 100 0 4 5 i * i7.7.7.0/24 192.168.35.5 0 100 0 5 i *i 192.168.24.4 0 100 0 4 5 i |
原因是沒有下一跳,這一點查看R1對應路由表可知
1 2 3 4 5 6 7 |
C 192.168.12.0/24 is directly connected, Serial1/0 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback1 C 192.168.13.0/24 is directly connected, Serial1/1 |
顯然,這是因為剛剛跑IGP(這裡跑的是OSPF)沒有宣告24和35這兩個網段。現在宣告之,果然相應的路由條目已經寫入,看起來運行正確:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
C 192.168.12.0/24 is directly connected, Serial1/0 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback1 C 192.168.13.0/24 is directly connected, Serial1/1 O 192.168.24.0/24 [110/128] via 192.168.12.2, 00:00:04, Serial1/0 5.0.0.0/24 is subnetted, 1 subnets B 5.5.5.0 [200/0] via 192.168.24.4, 00:00:09 7.0.0.0/24 is subnetted, 1 subnets B 7.7.7.0 [200/0] via 192.168.24.4, 00:00:09 O 192.168.35.0/24 [110/128] via 192.168.13.3, 00:00:04, Serial1/1 |
再看看bgp表:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
R1#sh bgp BGP table version is 8, 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 *> 1.1.1.0/24 0.0.0.0 0 32768 i *>i5.5.5.0/24 192.168.35.5 0 100 0 5 i *>i7.7.7.0/24 192.168.35.5 0 100 0 5 i |
怎麼只各剩下一條?
這裡問題就出來了:冗餘哪裡去了。是被AD較高的IGP蓋住了麼?
1 2 3 4 5 |
R1#sh ip bgp rib-failure Network Next Hop RIB-failure RIB-NH Matches R1# |
顯然不用這條命令也能看出不是這麼回事。
如果這時候把IGP關掉,然後在R1上做靜態路由,這裡就正常;如果跑IGP,想要有下一跳路由就要宣告24和35網段,一旦宣告,冗餘的路徑就消失了。
事實上,這個是由於BGP的一個特性造成的:
在BGP中,發送路由更新條目並不是全部都發送,它只發送自己的最優路徑給鄰居。
然後,在AS1中為了形成full-mesh我們跑了BGP但同時R2也學到了35,也就是說在R2這個IBGP中到達R5的線路有兩條!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
R2(config)#do sh ip bg BGP table version is 6, local router ID is 192.168.24.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 *>i1.1.1.0/24 192.168.12.1 0 100 0 i *>i5.5.5.0/24 192.168.35.5 0 100 0 5 i * 192.168.24.4 0 4 5 i *>i7.7.7.0/24 192.168.35.5 0 100 0 5 * 192.168.24.4 0 4 5 i |
這樣就可以理解了,R2把自己的最優路徑發給了R1,結果和R3發送的是一樣的都是走拓撲圖中下邊的路徑(最優路徑)
所以,這時候R1和R3都只有各一條的7和5網段的路由。
本文由 落格博客 原創撰寫:落格博客 » 在IBGP中跑IGP時遇到的問題:BGP只更新最優路由條目
轉載請保留出處和原文鏈接:https://www.logcg.com/archives/264.html