实验内容是BGP的基本配置

实验拓扑如下:

主要配置如下:

R1:

interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface Loopback1
 ip address 172.16.0.1 255.255.255.0
!
interface Loopback2
 ip address 172.16.1.1 255.255.255.0
!
interface Loopback3
 ip address 172.16.2.1 255.255.255.0
!
interface Loopback4
 ip address 172.16.3.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 172.16.255.1 255.255.255.252
 duplex auto
 speed auto
!
router rip
 version 2
 network 1.0.0.0
 network 172.16.0.0
 no auto-summary
!
router bgp 64512
 no synchronization
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 network 1.1.1.0 mask 255.255.255.0
 network 172.16.0.0
 neighbor 2.2.2.2 remote-as 64512
 neighbor 2.2.2.2 update-source Loopback0
 auto-summary
!

R2:

interface Loopback0
 ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
 ip address 172.16.255.2 255.255.255.252
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 10.1.255.1 255.255.255.252
 serial restart-delay 0
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!        
router rip
 version 2
 network 2.0.0.0
 network 172.16.0.0
!
router bgp 64512
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 network 2.2.2.0 mask 255.255.255.0
 network 10.1.255.0 mask 255.255.255.252
 network 172.16.0.0
 neighbor 1.1.1.1 remote-as 64512
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 1.1.1.1 next-hop-self
 neighbor 10.1.255.2 remote-as 64513
 auto-summary

R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.0
!
interface Loopback1
 ip address 192.168.0.1 255.255.255.0
!
interface Loopback2
 ip address 192.168.1.1 255.255.255.0
!
interface Loopback3
 ip address 192.168.2.1 255.255.255.0
!
interface Loopback4
 ip address 192.168.3.1 255.255.255.0
!
interface Serial1/0
 ip address 10.1.255.2 255.255.255.252
 serial restart-delay 0
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
router bgp 64513
 no synchronization
 bgp router-id 3.3.3.3
 bgp log-neighbor-changes
 network 10.1.255.0 mask 255.255.255.252
 network 192.168.0.0
 network 192.168.1.0
 network 192.168.2.0
 network 192.168.3.0
 neighbor 10.1.255.1 remote-as 64512
 auto-summary

做到这时,问题就出现了,在R1,show ip bgp时,不是R1直连的网段,总是在最优路径和不优路径之间变换,一会儿优了,一会儿又不优。

试着将R1、R2上network所有的网段,本来是做了个汇总的,但问题还在,试了将汇总功能关掉或打开,但都不行,在AS64512上,我用的是RIP协议,而且它将172.16中的所有网段都汇总成一个172.16.0.0/16,我觉得是这个RIP协议的问题,但就是不知道这什么会这样

改成了ospf就没问题了

最优路径考虑的两个方面

第一,下一跳可达,在这里,我在R2上做了next-hop-seft,应该就没问题了,

第二,同步,我觉得也是没问题的,如果说在network 172.16.0.0这个命令有问题的话,那将所有的网段都network进去,问题还是在。

所以我觉得是RIP协议的问题,但就是说不出来哪的问题,不知那位高手知道的,指点指点。