虽然HSRP本身不属于安全技术,但却可以用来给ipsec vpn的做热备提高其高可用性
一,HSRP-热备份路由器协议 1,角色:Active/Standby Active:发送hello/响应PC的arp的请求/学习虚拟IP地址(MAC)/转发数据/提供网关服务 Standby:做A的备份/发送hello/侦听224.0.0.2的消息/**响应PC的arp的请求/转发数据/提供网关服务 2,目的IP 224.0.0.2 UDP(17)源目端口皆为1985 3,虚拟MAC 0000.0c—思科 07.ac–思科分配给HSRP版本1的默认 XX–Group Number
二.Active选举 1,priority (默认100,比大) 2,IP地址(比大) 注:Active没有抢占功能,若想通过Priority来调整主备设备,必须开启抢占功能!
interface FastEthernet0 /0 ip address 12.1.1.125 5.255.255.0 standby 1 ip12.1.1.254 standby 1 priority 105 standby 1 preempt
三,standby选举原则 1,priority (默认100,比大) 2,IP地址(比大) 3,具有抢占功能 注:除了Active和Standby以外,其他运行HSRP的设备皆为listen状态
四,HSRP的状态 1,initial–初始化 2,learn–学习虚拟IP地址 3,listen–侦听 4,speak–选举 5,standby–必须经历的一个过程/稳定 6,active–稳定状态
五,icmp重定向 1,工作条件 做此动作的设备必须和重定向后设备在同一个子网中 2,目的 通过重新指派网关来选择去往最终目的地的最优路径 3,缺点 容易暴露真实网关设备的IP/MAC 4,在启用HSRP的接口下,自动关闭ICMP的重定向功能
Active# \*Mar 1 01:05:51 .671 :ICMP: 10.1.1.2 does not contain anactive HSRP group \*Mar 1 01:05:51 .671 :ICMP: redirect to 10.1.1.100 for dest 202.100.1.10 filtered
六,HSRP的feature Active(config)#int f1/0 Active(config-if )#standby 1 ? authentication Authentication follow Name of HSRP group to follow ip Enable HSRP IPv4 and set thevirtual IP address ipv6 Enable HSRP IPv6 mac-address Virtual MAC address name Redundancy name string preempt Overthrow lower priority Activerouters priority Priority level timers Hello and hold timers track Priority tracking Active(config-if )#standby 1 track 1 decrement Priority decrement shutdown Shutdown group <cr>
七,HSRP实验 需求:
SW1 为active SW2为standby
虚拟mac为 0000.0c07.ac1e
开启抢占
SW1的优先级为110 SW2优先级为105
开启MD5认证 密码为qytan
配置: 配地址 配Trunk/Access 过程略。
ESW1#sh run int vlan 10 ! interface Vlan10ip address 192.168.1.252 255.255.255.0standby version 1 ---HSRP版本2 standby 30 ip 192.168.1.254 ---虚拟地址 standby 30 priority 110 ----优先级 standby 30 authentication md5 key-string qytang ---md5认证 密码为qytang ! router eigrp 90 ---eigrp network 0.0.0.0ESW2#sh run int vlan 10 interface Vlan10 ip address 192.168.1.253 255.255.255.0standby version 1 standby 30 ip 192.168.1.254 standby 30 priority 105 standby 30 preempt ---开启抢占 standby 30 authentication md5 key-string qytang ! router eigrp 90 ---eigrp network 0.0.0.0R1: router eigrp 90 network 0.0.0.0no auto-summary! interface Loopback0ip address 100.1.1.1 255.255.255.0
验证下路由:
R1#sh ip route eigrp 100.0 .0.0 /8 is variably subnetted, 2 subnets, 2 masks D 100.0 .0.0 /8 is a summary, 05 :55 :16 , Null0 10.0 .0.0 /8 is variably subnetted, 2 subnets, 2 masks D 10.0 .0.0 /8 is a summary, 02 :19 :12 , Null0 12.0 .0.0 /8 is variably subnetted, 2 subnets, 2 masks D 12.0 .0.0 /8 is a summary, 02 :19 :12 , Null0 D 192.168 .1.0 /24 \[90 /28416 \] via 12.1 .1.2 , 05 :07 :11 , FastEthernet1/0 \[90 /28416 \] via 10.1 .1.2 , 05 :07 :11 , FastEthernet0/ R1#ping 192.168 .1.254 source lo0 Type escape sequence to abort. Sending 5 , 100 -byte ICMP Echos to 192.168 .1.254 , timeout is 2 seconds: Packet sent with a source address of 100.1 .1.1 !!!!! Success rate is 100 percent (5 /5 ), round -trip min /avg/max = 20 /34 /60 ms
验证下HSRP: 在HSRPv1中 默认的MAC地址为:
其中XX表示HSRP组号,这里group number为30(十进制) 正好等于1e(十六进制) R2.R3测试一下与网关(HSRP虚拟地址)的连通性:
R2:ping 192.168.1.254 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.254, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 16/33/64 ms
测试一下到远端设备100.1.1.1 此时走Active
当去主网关的链路down掉:
ESW1 (config) #int f1/0 ESW1 (config-if) #shutdown
此时已经走了备份网关。 颖奇L’Amore - 2016年1月2日