HSRP
配置如下:
l
基本配置
R1
配置:
Router>en
Router#config t
Router(config)#hostname R1
R1(config)#lin con 0
R1(config-line)#logg syn
R1(config-line)#exec-t 0 0
R1(config-line)#exit
R1(config)#no ip domain look
R1(config)#end
R1(config)#int f1/0
R1(config-if)#ip add 192.168.0.220 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#int s0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
R1(config-if)#end
R2
配置:
Router>en
Router#config t
Router(config)#hostname R2
R2(config)#lin con 0
R2(config-line)#logg syn
R2(config-line)#exec-t 0 0
R2(config-line)#exit
R2(config)#no ip domain look
R2(config)#end
R2#config t
R2(config)#int f1/0
R2(config-if)#ip add 192.168.0.210 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#int s0/1
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#end
R3
配置:
Router>en
Router#config t
Router(config)#hostname R3
R3(config)#no ip domain look
R3(config)#lin con 0
R3(config-line)#logg syn
R3(config-line)#exec-t 0 0
R3(config-line)#end
R3#config t
R3(config)#int s0/0
R3(config-if)#ip add 192.168.1.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#int s0/1
R3(config-if)#ip add 192.168.2.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#int f1/0
R3(config-if)#ip add 192.168.3.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#end
SWITCH
配置:
Router>en
Router#config t.
Router(config)#hostname SW
SW(config)#no ip domain look
SW(config)#lin con 0
SW(config-line)#logg syn
SW(config-line)#exec-t 0 0
SW(config-line)#end
配置
RIP V2
协议:
RI
配置:
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.0.0
R1(config-router)#network 192.168.1.0
R1(config-router)#passive-interface f1/0 \\
必须配置为被动口
R1(config-router)#end
R2
配置:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.0.0
R2(config-router)#network 192.168.2.0
R2(config-router)#passive-interface f1/0 \\
必须配置为被动口
R2(config-router)#end
R3
配置:
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#network 192.168.1.0
R3(config-router)#network 192.168.2.0
R3(config-router)#network 192.168.3.0
R3(config-router)#end
配置
hsrp
:
R1
配置:
R1#config t
R1(config)#int f1/0
R1(config-if)#standby 1 ip 192.168.0.250 //
设置虚拟网关
192.168.0.254
R1(config-if)#stan
R1(config-if)#standby 1 priority 120
R1(config-if)#standby 1 preempt
R1(config-if)#standby 1 authentication md5 key-string ldh
R1(config-if)#end
R1#show standby bri
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Fa1/0 1 120 P Active local 192.168.0.210 192.168.0.250
R2
配置:
R2#config t
R2(config)#int f1/0
R2(config-if)#standby 1 ip 192.168.0.250
R2(config-if)#standby 1 priority 110
R2(config-if)#standby 1 preempt
R2(config-if)#standby 1 authentication md5 key-string ldh
R2(config-if)#end
R2#show standby bri
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Fa1/0 1 110 P Standby 192.168.0.220 local 192.168.0.250
验证活动路由方法:关闭当前活动路由的
F1/0
接口,再
show standby
brief
即可。
R1#show run
R1#show running-config Building configuration...
Current configuration : 1045 bytes
! version 12.4 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 memory-size iomem 5 ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Serial0/0 ip address 192.168.1.1 255.255.255.0 serial restart-delay 0 ! interface Serial0/1 no ip address shutdown serial restart-delay 0 ! interface Serial0/2 no ip address shutdown serial restart-delay 0 ! interface Serial0/3 no ip address shutdown serial restart-delay 0 ! interface FastEthernet1/0 ip address 192.168.0.220 255.255.255.0 duplex auto speed auto standby 1 ip 192.168.0.250 standby 1 priority 120 standby 1 preempt standby 1 authentication md5 key-string 1dh ! router rip version 2 passive-interface FastEthernet1/0 network 192.168.0.0 network 192.168.1.0 ! ip http server no ip http secure-server ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 ! ! end
R1#
R1#show stan R1#show standby br R1#show standby brief P indicates configured to preempt. | Interface Grp Prio P State Active Standby Virtual IP Fa1/0 1 120 P Active local 192.168.0.210 192.168.0.250 R1#
R2#show run
Building configuration...
Current configuration : 1087 bytes
! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R2 ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ! ! ip cef no ip domain lookup ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Serial0/0 no ip address shutdown serial restart-delay 0 ! interface Serial0/1 ip address 192.168.2.2 255.255.255.0 serial restart-delay 0 ! interface Serial0/2 no ip address shutdown serial restart-delay 0 ! interface Serial0/3 no ip address shutdown serial restart-delay 0 ! interface FastEthernet1/0 ip address 192.168.0.210 255.255.255.0 duplex auto speed auto standby priority 120 standby 1 ip 192.168.0.250 standby 1 priority 110 standby 1 preempt standby 1 authentication md5 key-string 1dh ! router rip version 2 passive-interface FastEthernet1/0 network 192.168.0.0 network 192.168.2.0 ! ip http server no ip http secure-server ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 ! ! end
R2#
R2#show R2#show sta R2#show stan R2#show standby br R2#show standby brief P indicates configured to preempt. | Interface Grp Prio P State Active Standby Virtual IP Fa1/0 1 110 P Standby 192.168.0.220 local 192.168.0.250 R2#
R3#show run
Building configuration...
Current configuration : 946 bytes
! version 12.4 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 memory-size iomem 5 ! ! ip cef no ip domain lookup ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Serial0/0 ip address 192.168.1.3 255.255.255.0 serial restart-delay 0 ! interface Serial0/1 ip address 192.168.2.3 255.255.255.0 serial restart-delay 0 ! interface Serial0/2 no ip address shutdown serial restart-delay 0 ! interface Serial0/3 no ip address shutdown serial restart-delay 0 ! interface FastEthernet1/0 ip address 192.168.3.3 255.255.255.0 duplex auto speed auto ! router rip version 2 network 192.168.1.0 network 192.168.2.0 network 192.168.3.0 ! ip http server no ip http secure-server ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 ! ! end |