使用HSRP和SLB實現服務器羣負載均衡和冗餘

拓撲:tcp

R1配置:ide

interface Loopback0
ip address 192.168.1.1 255.255.255.0
ip nat inside
!
interface FastEthernet0/0
ip address 12.1.1.1 255.255.255.0
ip nat outsideoop

ip route 0.0.0.0 0.0.0.0 12.1.1.2
!
ip nat inside source list 10 interface FastEthernet0/0 overload
!
access-list 10 permit any3d

R2配置:server

interface FastEthernet0/0
ip address 12.1.1.2 255.255.255.0
!
interface FastEthernet0/1
!
interface FastEthernet0/2
ip address 23.1.1.2 255.255.255.0blog

ip route 0.0.0.0 0.0.0.0 23.1.1.3ip

R3配置:ci

interface FastEthernet0/0
switchport access vlan 200
!
interface FastEthernet0/1
switchport access vlan 200
!
interface FastEthernet0/2
ip address 23.1.1.3 255.255.255.0
!
interface Vlan200
ip address 192.168.200.3 255.255.255.0get

ip route 0.0.0.0 0.0.0.0 23.1.1.2
ip route 192.168.100.0 255.255.255.0 192.168.200.254it

 

R4配置:

ip slb serverfarm SF1
nat server
real 6.6.6.6
weight 1
inservice
real 7.7.7.7
weight 1
inservice
!
ip slb vserver VS1
virtual 192.168.100.100 tcp telnet
serverfarm SF1
inservice standby server

interface FastEthernet0/0
no switchport
ip address 192.168.200.4 255.255.255.0
standby 200 ip 192.168.200.254
standby 200 priority 120
standby 200 preempt
standby 200 track Vlan100
!
interface FastEthernet0/1
switchport access vlan 100
!
interface FastEthernet0/15
switchport mode trunk
!
interface Vlan100
ip address 192.168.100.4 255.255.255.0
standby version 2
standby 100 ip 192.168.100.254
standby 100 priority 120
standby 100 preempt
standby 100 name server
!
ip route 0.0.0.0 0.0.0.0 192.168.200.3
ip route 6.6.6.6 255.255.255.255 192.168.100.6
ip route 7.7.7.7 255.255.255.255 192.168.100.7

R5配置:

ip slb serverfarm SF1
nat server
real 6.6.6.6
weight 1
inservice
real 7.7.7.7
weight 1
inservice
!
ip slb vserver VS1
virtual 192.168.100.100 tcp telnet
serverfarm SF1
inservice standby server

interface FastEthernet0/0
switchport access vlan 100
!
interface FastEthernet0/1
no switchport
ip address 192.168.200.5 255.255.255.0
standby 200 ip 192.168.200.254
standby 200 preempt
standby 200 track Vlan100
!
interface FastEthernet0/15
switchport mode trunk
!
interface Vlan100
ip address 192.168.100.5 255.255.255.0
standby version 2
standby 100 ip 192.168.100.254
standby 100 preempt
standby 100 name server
!
ip route 0.0.0.0 0.0.0.0 192.168.200.3
ip route 6.6.6.6 255.255.255.255 192.168.100.6
ip route 7.7.7.7 255.255.255.255 192.168.100.7

R6配置:

interface Loopback0
ip address 6.6.6.6 255.255.255.255
!
interface FastEthernet0/0
!
interface FastEthernet0/1
no switchport
ip address 192.168.100.100 255.255.255.0 secondary
ip address 192.168.100.6 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.100.254
!
line vty 0 4
password cisco
login

R7配置:
interface Loopback0
ip address 7.7.7.7 255.255.255.255
!
interface FastEthernet0/0
no switchport
ip address 192.168.100.100 255.255.255.0 secondary
ip address 192.168.100.7 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.100.254
!
line vty 0 4
password cisco
login

 

驗證: