RTA:
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 172.16.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet2/0
ip address 20.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet3/0
ip address 30.1.1.1 255.255.255.0
duplex auto
speed auto
!
router bgp 100
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 20.1.1.0 mask 255.255.255.0
network 30.1.1.0 mask 255.255.255.0
network 172.16.1.0 mask 255.255.255.0
network 192.168.1.0
neighbor 2.2.2.2 remote-as 200
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 2.2.2.2 update-source Loopback0
neighbor 3.3.3.3 remote-as 200
neighbor 3.3.3.3 ebgp-multihop 2
neighbor 3.3.3.3 update-source Loopback0
no auto-summary
!
ip http server
no ip http secure-server
!
ip route 2.2.2.2 255.255.255.255 FastEthernet2/0
ip route 3.3.3.3 255.255.255.255 FastEthernet1/0
RTB:
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 40.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 20.1.1.2 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 40.1.1.0 0.0.0.255 area 0
!
router bgp 200
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 40.1.1.0 mask 255.255.255.0
network 50.1.1.0 mask 255.255.255.0
network 100.1.1.0 mask 255.255.255.0
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 1.1.1.1 update-source Loopback0
neighbor 3.3.3.3 remote-as 200
neighbor 3.3.3.3 update-source Loopback0
neighbor 4.4.4.4 remote-as 200
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 next-hop-self
neighbor 4.4.4.4 route-map jiang out
no auto-summary
!
ip http server
no ip http secure-server
!
ip route 1.1.1.1 255.255.255.255 FastEthernet1/0
!
!
access-list 1 permit 192.168.1.0 0.0.0.255
access-list 2 permit 172.16.1.0 0.0.0.255
!
route-map jiang permit 10
match ip address 1
set local-preference 200
!
route-map jiang permit 20
match ip address 2
set local-preference 100
RTC:
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 50.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 30.1.1.2 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 50.1.1.0 0.0.0.255 area 0
!
router bgp 200
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 40.1.1.0 mask 255.255.255.0
network 50.1.1.0 mask 255.255.255.0
network 100.1.1.0 mask 255.255.255.0
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 1.1.1.1 update-source Loopback0
neighbor 2.2.2.2 remote-as 200
neighbor 2.2.2.2 update-source Loopback0
neighbor 4.4.4.4 remote-as 200
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 next-hop-self
neighbor 4.4.4.4 route-map xinzhi out
no auto-summary
!
ip http server
no ip http secure-server
!
ip route 1.1.1.1 255.255.255.255 FastEthernet1/0
!
!
access-list 1 permit 192.168.1.0 0.0.0.255
access-list 2 permit 172.16.1.0 0.0.0.255
!
route-map xinzhi permit 10
match ip address 1
set local-preference 100
!
route-map xinzhi permit 20
match ip address 2
set local-preference 200
!
RTD:
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 40.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 50.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet2/0
ip address 100.1.1.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 0
network 40.1.1.0 0.0.0.255 area 0
network 50.1.1.0 0.0.0.255 area 0
network 100.1.1.0 0.0.0.255 area 0
!
router bgp 200
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
network 40.1.1.0 mask 255.255.255.0
network 50.1.1.0 mask 255.255.255.0
network 100.1.1.0 mask 255.255.255.0
neighbor 2.2.2.2 remote-as 200
neighbor 2.2.2.2 update-source Loopback0
neighbor 3.3.3.3 remote-as 200
neighbor 3.3.3.3 update-source Loopback0
no auto-summary
!
ip http server
no ip http secure-server
!
路由器模拟的客户端:
interface FastEthernet0/0
ip address 100.1.1.2 255.255.255.0
no ip route-cache
duplex auto
speed auto
!
ip default-gateway 100.1.1.1
ip http server
no ip http secure-server