最近在做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