拓扑:
R7配置:
interface FastEthernet0/0
ip address 192.168.100.7 255.255.255.0
ip route 0.0.0.0 0.0.0.0 192.168.100.254
R8配置:
interface FastEthernet0/0
ip address 192.168.200.8 255.255.255.0
ip route 0.0.0.0 0.0.0.0 192.168.200.254
R6配置:
VLAN D
VLAN 100
VLAN 200
interface FastEthernet1/0
switchport mode trunk
interface FastEthernet1/1
switchport mode trunk
interface FastEthernet1/2
switchport access vlan 100
interface FastEthernet1/3
switchport access vlan 200
R1配置:
track 3 ip sla 3
!
track 4 ip sla 4
!
track 1000 ip route 59.1.1.0 255.255.255.0 reachability
!
interface FastEthernet0/0
ip address 13.1.1.1 255.255.255.0
ip nat outside
speed 100
duplex full
!
interface FastEthernet0/1
ip address 14.1.1.1 255.255.255.0
ip nat outside
speed 100
duplex full
!
interface FastEthernet1/0
no ip address
speed 100
duplex full
!
interface FastEthernet1/0.100
encapsulation dot1Q 100
ip address 192.168.100.1 255.255.255.0
ip nat inside
standby 100 ip 192.168.100.254
standby 100 priority 150
standby 100 preempt
standby 100 track 1000 decrement 80
!
interface FastEthernet1/0.200
encapsulation dot1Q 200
ip address 192.168.200.1 255.255.255.0
ip nat inside
standby 200 ip 192.168.200.254
standby 200 preempt
standby 200 track 1000 decrement 80
!
ip nat inside source route-map to_r3 interface FastEthernet0/0 overload
ip nat inside source route-map to_r4 interface FastEthernet0/1 overload
ip forward-protocol nd
!
ip route 59.1.1.0 255.255.255.0 13.1.1.3 100 track 3
ip route 59.1.1.0 255.255.255.0 14.1.1.4 200 track 4
!
ip access-list standard vlan_100
permit 192.168.100.0 0.0.0.255
ip access-list standard vlan_200
permit 192.168.200.0 0.0.0.255
!
ip sla 3
icmp-echo 13.1.1.3
frequency 30
ip sla schedule 3 life forever start-time now
ip sla 4
icmp-echo 14.1.1.4
frequency 30
ip sla schedule 4 life forever start-time now
!
route-map to_r4 permit 10
match ip address vlan_100 vlan_200
match interface FastEthernet0/1
!
route-map to_r3 permit 10
match ip address vlan_100 vlan_200
match interface FastEthernet0/0
R2配置:
track 3 ip sla 3
!
track 4 ip sla 4
!
track 1000 ip route 59.1.1.0 255.255.255.0 reachability
!
interface FastEthernet0/0
ip address 24.1.1.2 255.255.255.0
ip nat outside
speed auto
duplex auto
!
interface FastEthernet0/1
ip address 23.1.1.2 255.255.255.0
ip nat outside
speed auto
duplex auto
!
interface FastEthernet1/0
no ip address
speed 100
duplex full
!
interface FastEthernet1/0.100
encapsulation dot1Q 100
ip address 192.168.100.2 255.255.255.0
ip nat inside
standby 100 ip 192.168.100.254
standby 100 preempt
standby 100 track 1000 decrement 80
!
interface FastEthernet1/0.200
encapsulation dot1Q 200
ip address 192.168.200.2 255.255.255.0
ip nat inside
standby 200 ip 192.168.200.254
standby 200 priority 150
standby 200 preempt
standby 200 track 1000 decrement 80
!
ip nat inside source route-map to_r3 interface FastEthernet0/0 overload
ip nat inside source route-map to_r4 interface FastEthernet0/1 overload
!
ip route 59.1.1.0 255.255.255.0 23.1.1.3 200 track 3
ip route 59.1.1.0 255.255.255.0 24.1.1.4 100 track 4
!
ip access-list standard vlan_100
permit 192.168.100.0 0.0.0.255
ip access-list standard vlan_200
permit 192.168.200.0 0.0.0.255
!
ip sla 3
icmp-echo 23.1.1.3
frequency 30
ip sla schedule 3 life forever start-time now
ip sla 4
icmp-echo 24.1.1.4
frequency 30
ip sla schedule 4 life forever start-time now
!
route-map to_r4 permit 10
match ip address vlan_100 vlan_200
match interface FastEthernet0/1
!
route-map to_r3 permit 10
match ip address vlan_100 vlan_200
match interface FastEthernet0/0
R3配置:
interface FastEthernet0/0
ip address 13.1.1.3 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet0/1
ip address 23.1.1.3 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet1/0
ip address 35.1.1.3 255.255.255.0
speed 100
full-duplex
!
router bgp 300
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 13.1.1.0 mask 255.255.255.0
network 23.1.1.0 mask 255.255.255.0
neighbor 35.1.1.5 remote-as 500
no auto-summary
R4配置:
interface FastEthernet0/0
ip address 24.1.1.4 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet0/1
ip address 14.1.1.4 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet1/0
ip address 45.1.1.4 255.255.255.0
speed 100
full-duplex
!
router bgp 400
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
network 14.1.1.0 mask 255.255.255.0
network 24.1.1.0 mask 255.255.255.0
neighbor 45.1.1.5 remote-as 500
no auto-summary
R5配置:
interface FastEthernet0/0
ip address 35.1.1.5 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet0/1
ip address 45.1.1.5 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet1/0
ip address 59.1.1.5 255.255.255.0
duplex auto
speed auto
!
router bgp 500
no synchronization
bgp router-id 5.5.5.5
bgp log-neighbor-changes
network 59.1.1.0 mask 255.255.255.0
neighbor 35.1.1.3 remote-as 300
neighbor 45.1.1.4 remote-as 400
no auto-summary
R9配置:
interface FastEthernet0/0
ip address 59.1.1.9 255.255.255.0
duplex auto
speed auto
!
ip route 0.0.0.0 0.0.0.0 59.1.1.5
验证:
连通性:
如果服务器是内部的那么R9的配置可以改变为(内部不可路由192.168.100.9对外的可路由地址是59.1.1.100 ,内部不可路由192.168.200.9对外的可路由地址是59.1.1.200 )