下面是配置(以上设备均使用的是思科的3640的IOS):
R1#show running-config
Building configuration...
Current configuration : 943 bytes
version 12.4
service timestamps debug datetimemsec
service timestamps log datetimemsec
no service password-encryption
hostname R1
boot-start-marker
boot-end-marker
noaaa new-model
memory-sizeiomem 5
ipcef
noip domain lookup
interface FastEthernet0/0
ip address 192.168.100.1 255.255.255.0
duplex auto
speed auto
interface FastEthernet1/0
ip address 192.168.0.1 255.255.255.0
duplex auto
speed auto
interface FastEthernet2/0
ip address 192.168.1.1 255.255.255.0
shutdown
duplex auto
speed auto
ip http server
noip http secure-server
ip route 192.168.2.0 255.255.255.0192.168.0.2 50
ip route 192.168.2.0 255.255.255.0192.168.1.2 60
ip route 192.168.3.0 255.255.255.0192.168.1.2 50
ip route 192.168.3.0 255.255.255.0192.168.0.2 60
control-plane
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
linevty 0 4
end
SW1#show running-config
Building configuration...
Current configuration : 1500 bytes
version 12.4
service timestamps debug datetimemsec
service timestamps log datetimemsec
no service password-encryption
hostname SW1
boot-start-marker
boot-end-marker
noaaa new-model
memory-sizeiomem 5
ipcef
noip domain lookup
spanning-treevlan 2 priority 8192
spanning-treevlan 3 priority 16384
interface FastEthernet0/0
noswitchport
ip address 192.168.0.2 255.255.255.0
interface FastEthernet0/1
interface FastEthernet0/2
interface FastEthernet0/3
interface FastEthernet0/4
interface FastEthernet0/5
interface FastEthernet0/6
interface FastEthernet0/7
interface FastEthernet0/8
interface FastEthernet0/9
interface FastEthernet0/10
interface FastEthernet0/11
interface FastEthernet0/12
interface FastEthernet0/13
interface FastEthernet0/14
switchport mode trunk
interface FastEthernet0/15
switchport mode trunk
interface Vlan1
noip address
interface Vlan2
ip address 192.168.2.1 255.255.255.0
standby 2 ip 192.168.2.254
standby 2 priority 200
standby 2 preempt
standby 2 track FastEthernet0/0 100
standby 2 track FastEthernet0/14 100
interface Vlan3
ip address 192.168.3.1 255.255.255.0
standby 3 ip 192.168.3.254
standby 3 priority 150
standby 3 preempt
ip http server
noip http secure-server
ip route 192.168.100.0 255.255.255.0192.168.0.1
control-plane
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
linevty 0 4
end
SW2#show running-config
Building configuration...
Current configuration : 1510 bytes
version 12.4
service timestamps debug datetimemsec
service timestamps log datetimemsec
no service password-encryption
hostname SW2
boot-start-marker
boot-end-marker
noaaa new-model
memory-sizeiomem 5
ipcef
noip domain lookup
spanning-treevlan 2 priority 16384
spanning-treevlan 3 priority 8192
interface FastEthernet0/0
noswitchport
ip address 192.168.1.2 255.255.255.0
shutdown
interface FastEthernet0/1
interface FastEthernet0/2
interface FastEthernet0/3
interface FastEthernet0/4
interface FastEthernet0/5
interface FastEthernet0/6
interface FastEthernet0/7
interface FastEthernet0/8
interface FastEthernet0/9
interface FastEthernet0/10
interface FastEthernet0/11
interface FastEthernet0/12
interface FastEthernet0/13
interface FastEthernet0/14
switchport mode trunk
interface FastEthernet0/15
switchport mode trunk
interface Vlan1
noip address
interface Vlan2
ip address 192.168.2.2 255.255.255.0
standby 2 ip 192.168.2.254
standby 2 priority 150
standby 2 preempt
interface Vlan3
ip address 192.168.3.2 255.255.255.0
standby 3 ip 192.168.3.254
standby 3 priority 200
standby 3 preempt
standby 3 track FastEthernet0/0 100
standby 3 track FastEthernet0/14 100
ip http server
noip http secure-server
ip route 192.168.100.0 255.255.255.0192.168.1.1
control-plane
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
linevty 0 4
end
SW3#show running-config
Building configuration...
Current configuration : 1080 bytes
version 12.4
service timestamps debug datetimemsec
service timestamps log datetimemsec
no service password-encryption
hostname SW3
boot-start-marker
boot-end-marker
noaaa new-model
memory-sizeiomem 5
noip routing
noipcef
noip domain lookup
interface FastEthernet0/0
switchport access vlan 2
interface FastEthernet0/1
switchport access vlan 3
interface FastEthernet0/2
interface FastEthernet0/3
interface FastEthernet0/4
interface FastEthernet0/5
interface FastEthernet0/6
interface FastEthernet0/7
interface FastEthernet0/8
interface FastEthernet0/9
interface FastEthernet0/10
interface FastEthernet0/11
interface FastEthernet0/12
interface FastEthernet0/13
interface FastEthernet0/14
switchport mode trunk
interface FastEthernet0/15
switchport mode trunk
interface Vlan1
noip address
noip route-cache
ip http server
noip http secure-server
control-plane
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
linevty 0 4
end
PC1#show running-config
Building configuration...
Current configuration : 620 bytes
version 12.4
service timestamps debug datetimemsec
service timestamps log datetimemsec
no service password-encryption
hostname PC1
boot-start-marker
boot-end-marker
noaaa new-model
memory-sizeiomem 5
noip routing
noipcef
noip domain lookup
interface FastEthernet0/0
ip address 192.168.2.10 255.255.255.0
noip route-cache
duplex auto
speed auto
ip default-gateway 192.168.2.254
ip http server
noip http secure-server
control-plane
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
linevty 0 4
end
PC2#show running-config
Building configuration...
Current configuration : 620 bytes
version 12.4
service timestamps debug datetimemsec
service timestamps log datetimemsec
no service password-encryption
hostname PC2
boot-start-marker
boot-end-marker
noaaa new-model
memory-sizeiomem 5
noip routing
noipcef
noip domain lookup
interface FastEthernet0/0
ip address 192.168.3.10 255.255.255.0
noip route-cache
duplex auto
speed auto
ip default-gateway 192.168.3.254
ip http server
noip http secure-server
control-plane
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
linevty 0 4
end
PC3#show running-config
Building configuration...
Current configuration : 621 bytes
version 12.4
service timestamps debug datetimemsec
service timestamps log datetimemsec
no service password-encryption
hostname PC3
boot-start-marker
boot-end-marker
noaaa new-model
memory-sizeiomem 5
noip routing
noipcef
noip domain lookup
interface FastEthernet0/0
ip address 192.168.100.2 255.255.255.0
noip route-cache
duplex auto
speed auto
ip default-gateway 192.168.100.1
ip http server
noip http secure-server
control-plane
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
linevty 0 4
end
下面是配置后的实验效果:
在用PC1 PING PC3 1000次时,过一会把SW1的f0/0端口和R1的f1/0端口DOWN时,出现如下现象:
在用PC2 PING PC3 1000次时,过一会把SW2的f0/0端口和R1的f2/0端口DOWN时,出现如下现象:
以上两个图很容易看到HSRP的运行效果。