实验注意:
1、在R1 和 R5 上都注入15.0.0.0 网段!
2、使R2 在通往R1 和 R5 时有两条路可走,分别是经过R1和经过R2!
3、
R3#show ip bgp
BGP table version is 7, local router ID is 34.0.0.3
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
* i15.0.0.0         34.0.0.4                 0    100      0 15 i
*>i                  23.0.0.2                 0    100      0 15 i
4、现在它是通过R4到达15.0.0.0,现在改变R4的优先级后,结果如下:
操作:R4(config)#router bgp 234
          R4(config-router)#bgp default local-preference 10
结果:
在R3输入:
R3#clear ip bgp 34.0.0.4 soft in后:(重要!!!!!!!!!)
R3#show ip bgp
BGP table version is 7, local router ID is 34.0.0.3
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
* i15.0.0.0         34.0.0.4                 0     10      0 15 i
*>i                 23.0.0.2                 0    100      0 15 i
5、可以改变R2的路由的优先级
R1的配置如下:
R1#show run
Building configuration...
Current configuration : 1682 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
resource policy
!
ip subnet-zero
!
!
ip cef
no ip dhcp use vrf connected
!        
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback1
 no ip address
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface Serial1/0
 ip address 12.0.0.1 255.0.0.0
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/4
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/5
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/6
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/7
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface FastEthernet2/0
 ip address 15.0.0.1 255.0.0.0
 duplex auto
 speed auto
!
interface FastEthernet2/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
router bgp 15
 no synchronization
 bgp log-neighbor-changes
 network 15.0.0.0
 neighbor 12.0.0.2 remote-as 234
 neighbor 15.0.0.5 remote-as 15
 no auto-summary
!
ip classless
!
no ip http server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
!
!
end      
R2的配置如下:
R1#show run
Building configuration...
Current configuration : 1682 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
resource policy
!
ip subnet-zero
!
!
ip cef
no ip dhcp use vrf connected
!        
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback1
 no ip address
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface Serial1/0
 ip address 12.0.0.1 255.0.0.0
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/4
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/5
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/6
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/7
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface FastEthernet2/0
 ip address 15.0.0.1 255.0.0.0
 duplex auto
 speed auto
!
interface FastEthernet2/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
router bgp 15
 no synchronization
 bgp log-neighbor-changes
 network 15.0.0.0
 neighbor 12.0.0.2 remote-as 234
 neighbor 15.0.0.5 remote-as 15
 no auto-summary
!
ip classless
!
no ip http server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
!
!
end      
R3的配置如下:
R3#show ip bgp
BGP table version is 7, local router ID is 34.0.0.3
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
* i15.0.0.0         34.0.0.4                 0     10      0 15 i
*>i                 23.0.0.2                 0    100      0 15 i
R3#
R3#
R3#clear ip bgp 23.0.0.2 soft in
R3#
R3#show ip bgp
BGP table version is 8, local router ID is 34.0.0.3
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
*>i15.0.0.0         34.0.0.4                 0     10      0 15 i
*      i                 23.0.0.2                 0      5      0 15 i
 

R3#show run
Building configuration...
Current configuration : 1557 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
resource policy
!
ip subnet-zero
!
!
ip cef
no ip dhcp use vrf connected
!        
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface Serial1/0
 ip address 23.0.0.3 255.0.0.0
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/1
 ip address 34.0.0.3 255.0.0.0
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/4
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/5
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/6
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/7
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
router bgp 234
 no synchronization
 bgp log-neighbor-changes
 neighbor 23.0.0.2 remote-as 234
 neighbor 23.0.0.2 route-reflector-client
 neighbor 34.0.0.4 remote-as 234
 neighbor 34.0.0.4 route-reflector-client
 no auto-summary
!
ip classless
!
no ip http server
!
!
!
!
!
!
control-plane
!
!
!
!
!        
!
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
!
!
end

R4的配置如下:
R4#show r
*Feb 26 17:59:58.783: %BGP-5-ADJCHANGE: neighbor 45.0.0.5 Down Peer closed the session
*Feb 26 17:59:59.115: %BGP-5-ADJCHANGE: neighbor 45.0.0.5 Up un
Building configuration...
Current configuration : 1553 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
resource policy
!
ip subnet-zero
!
!
ip cef
no ip dhcp use vrf connected
!        
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface Serial1/0
 ip address 34.0.0.4 255.0.0.0
 serial restart-delay 0
 no dce-terminal-timing-enable
 no fair-queue
!
interface Serial1/1
 ip address 45.0.0.4 255.0.0.0
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/4
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/5
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/6
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/7
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!        
router bgp 234
 no synchronization
 bgp default local-preference 10
 bgp log-neighbor-changes
 neighbor 34.0.0.3 remote-as 234
 neighbor 34.0.0.3 next-hop-self
 neighbor 45.0.0.5 remote-as 15
 no auto-summary
!
ip classless
!
no ip http server
!
!
!
!
!
!
control-plane
!
!
!
!        
!
!
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
!
!
end
R5的配置如下:
R5#show run
Building configuration...
Current configuration : 1682 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R5
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
resource policy
!
ip subnet-zero
!
!
ip cef
no ip dhcp use vrf connected
!        
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback5
 no ip address
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface Serial1/0
 ip address 45.0.0.5 255.0.0.0
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/4
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/5
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/6
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface Serial1/7
 no ip address
 shutdown
 serial restart-delay 0
 no dce-terminal-timing-enable
!
interface FastEthernet2/0
 ip address 15.0.0.5 255.0.0.0
 duplex auto
 speed auto
!
interface FastEthernet2/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
router bgp 15
 no synchronization
 bgp log-neighbor-changes
 network 15.0.0.0
 neighbor 15.0.0.1 remote-as 15
 neighbor 45.0.0.4 remote-as 234
 no auto-summary
!
ip classless
!
no ip http server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
line con 0
 stopbits 1
line aux 0
line vty 0 4
!
!
end