用单组的HSRP配置三层冗余

简介:

一、拓扑图:

 
 
 
二、单组的 HSRP配置及说明:
1、用路由器模拟三层交换机,同时 R1R2中的回环接口模拟某主机与 R1R2直连。
R1(config-line)#int lo0
R1(config-if)#ip add 10.1.1.1 255.255.255.0
R1(config-if)#int f0/0
R1(config-if)#no sh
R1(config-if)#ip add 192.168.1.2 255.255.255.0
 
R2(config-line)#int lo0
R2(config-if)#ip add 10.1.1.1 255.255.255.0
R2(config-if)#int f0/0
R2(config-if)#ip add 192.168.1.3 255.255.255.0
 
PC1(config)#no ip routing
PC1(config)#ip default-gateway 192.168.1.1 (网关配置为HSRP虚拟的网关地址)
PC1(config)#int f0/0
PC1(config-if)#no sh
PC1(config-if)#ip add 192.168.1.10 255.255.255.0
 
2、为了有效的确保网关的冗余,我们在 R1R2上配置 HSRP协议:
R1(config-if)#standby ip 192.168.1.1(设置组0虚拟IP,在standby后面不跟组时,默认为0组)
R2(config-if)#standby ip 192.168.1.1
 
3、启用 HSRP0之后, IOS指出当前 R1active路由器,负责 arp响应和三层路由任务:
*Mar  1 00:33:23.963: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 0 state Standby -> Active
 
4、查看一下 R1R2standby 信息:
R1(config-if)#do sh standby
FastEthernet0/0 - Group 0 (指出为组)
 State is Active (指出当前为活动状态)
    2 state changes, last state change 00:11:49
 Virtual IP address is 192.168.1.1(指出虚拟路由器IP192.168.1.1,也为客户端指定的网关)
 Active virtual MAC address is 0000.0c07.ac00(虚拟路由器的MAC地址)
 Local virtual MAC address is 0000.0c07.ac00 (v1 default)
 Hello time 3 sec, hold time 10 secHSRPHELLO发送周期和保持时间用于监测ACTIVE路由器状态)
   Next hello sent in 1.672 secs
 Preemption disabled (强占没有开启)
 Active router is local
Standby router is 192.168.1.3, priority 100 (expires in 8.864 sec)(指出备份路由器IP和优先级)
 Priority 100 (default 100)  (在没有指定优先级的情况下,都为100
IP redundancy name is "hsrp-Fa0/0-0" (default)
 
R2#sh standby
FastEthernet0/0 - Group 0
 State is Standby (状态为备份)
   1 state change, last state change 00:00:29
 Virtual IP address is 192.168.1.1
Active virtual MAC address is 0000.0c07.ac00
   Local virtual MAC address is 0000.0c07.ac00 (v1 default)
 Hello time 3 sec, hold time 10 sec
   Next hello sent in 0.668 secs
 Preemption disabled
Active router is 192.168.1.2, priority 100 (expires in 9.656 sec)(指出活动路由器IP和优先级)
Standby router is local
 Priority 100 (default 100)
 IP redundancy name is "hsrp-Fa0/0-0" (default)
 
5HSRP组中的每台路由器均会带有一个优先级。优先级会影响哪一台路由器成为 active路由器,用于响应客户端的 ARP请求。如果在 HSRP刚启动,而且每台路由器的优先级均相同,则会优先选择接口 IP较高的为 ACTIVE路由器。但如果在一台路由器配置好之后再去配置另一台,且是优先级相同 ,那么会选择先配置的那台路由器成为 active路由器。这里路由器就选择了 R1成为 active
 
6、在 PC1traceroute一下 10.1.1.1,并查一下 ARP信息:
PC1#traceroute 10.1.1.1
Type escape sequence to abort.
Tracing the route to 10.1.1.1
 
1 192.168.1.2 32 msec *  32 msec (因为R1active,所以它选择了走R1)
 
PC1#sh arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  192.168.1.10            -   cc00.0a88.0000  ARPA   FastEthernet0/0
Internet  192.168.1.1            29   0000.0c07.ac00  ARPA   FastEthernet0/0(看到虚拟网关的IP地址和MAC地址,其中MAC含义:0000.0ccisco厂商标识,07.acHSRP组标识,01HSRP组号)
 
7、为了查看 HSRP的冗余作用我们使用扩展 ping 10.1.1.1/24发送较多的包,并且把 R1F0/0 down掉,我们发现丢了两个包之后转向冗余路由器了:
PC1#ping
Protocol [ip]:
Target IP address: 10.1.1.1
Repeat count [5]: 100000
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 100000, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!..!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(丢了两个包后又起来了)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.(这里还有一个包)
Success rate is 99 percent (2142/2145), round-trip min/avg/max = 1/9/64 ms
PC1#
 
R1(config)#int f0/0
R1(config-if)#shut  (手动downf0/0
 
PC1#traceroute 10.1.1.1
Type escape sequence to abort.
Tracing the route to 10.1.1.1
 
  192.168.1.3 40 msec *  40 msec  (跟踪命令发现下一跳为R2了)
 
8、下面我们把 R1F0/0置为 up后,过一段时间后发现 R1还是 standby角色:
R1(config)#int f0/0
R1(config-if)#no sh
R1#
*Mar  1 01:44:39.779: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 0 state Speak -> Standby
R1#sh standby
FastEthernet0/0 - Group 0
  State is Standby
    4 state changes, last state change 00:04:35
  Virtual IP address is 192.168.1.1
  Active virtual MAC address is 0000.0c07.ac00
    Local virtual MAC address is 0000.0c07.ac00 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 0.464 secs
  Preemption disabled
  Active router is 192.168.1.3, priority 100 (expires in 8.172 sec) (指出活动路由器为R2
  Standby router is local
  Priority 100 (default 100)
  IP redundancy name is "hsrp-Fa0/0-0" (default)
 
9、但如果 R1这台性能比较好, R2只想让它在 R1出问题的情况下顶替上来,因此更希望当 R1恢复时,能够负责 ARP的响应和三层路由任务。那么我们要为 R1配置较高的优先级,并且配置 HSRP抢占功能:
R1(config)#int f0/0
R1(config-if)#standby priority 120 (设置R1HSRP优先级为120
R1(config-if)#standby preempt (开启HSRP的抢占功能)
*Mar  1 09:37:03.313: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 0 state Standby -> Active
(配置完之后,提示信息马上就显示了状态从standby变成active
 
10、如果 R1的上行链路 lo0 down的话,而 PC1将不会意识到走 R1将会不通。会继续把 R1当作下一跳,但 HSRP除了能够对下行链路实施冗余,同时也可以对上行链路进行监测。所以为了确保万无一失,我们需要对上行链路进行跟踪:
R1(config-if)#standby track lo0 30  (对loopback0跟踪,如果发现有问题,优先级将会降30,那么将是120-30=90,比R2100低,这样R2将会成为active。)
 
11、把 R1上的 loopback0 down掉之后 ,看到 HSRP的显示 R1状态变成 standby
R1(config-if)#do sh standby
FastEthernet0/0 - Group 0
  State is Standby (跟踪端口down后,接口优先级降30Hello包接收到更高的优先级,新状态standby
    15 state changes, last state change 00:00:42
  Virtual IP address is 192.168.1.1
  Active virtual MAC address is 0000.0c07.ac00
    Local virtual MAC address is 0000.0c07.ac00 (v1 default)
  Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.580 secs
  Preemption enabled
  Active router is 192.168.1.3, priority 100 (expires in 8.604 sec)
  Standby router is local
  Priority 90 (configured 120)
    Track interface Loopback0 state Down decrement 30 (配置的跟踪)
  IP redundancy name is "hsrp-Fa0/0-0" (default)
 
 
 
 本文转自wxs-163 51CTO博客,原文链接:
 http://blog.51cto.com/supercisco/288456

 
相关文章
|
9月前
|
运维 监控 网络架构
关于静态路由的“冗余性”
该文探讨了静态路由与BFD(双向转发检测)及NQA(网络质量分析)的联动在路由选择和网络故障检测中的应用。通过配置BFD,R1与R2能实时检测链路状态,确保在R2链路故障时,流量自动切换至R3。同样,NQA通过PING测试实现对网络可达性的监控,当R2到R4路径故障时,静态路由失效,浮动备份路由生效,保证通信。这两种技术增强了网络的容错能力和链路利用率。
|
9月前
|
网络虚拟化
以太网链路聚合与交换机堆叠、集群
以太网链路聚合与交换机堆叠、集群
|
10月前
|
负载均衡 网络协议 安全
【计算机网络】虚拟路由冗余(VRRP)协议原理与配置
【计算机网络】虚拟路由冗余(VRRP)协议原理与配置
339 0
|
网络虚拟化 网络架构
VLAN的划分与VLAN间的三层通信,你都懂了吗?
VLAN的划分与VLAN间的三层通信,你都懂了吗?
462 0
|
Linux 网络虚拟化
Cisco—HSRP下实现DHCP主备冗余
Cisco—HSRP下实现DHCP主备冗余
200 1
Cisco—HSRP下实现DHCP主备冗余
|
网络协议 Shell 网络虚拟化
ospf,三层交换机,热备,以太网通道练习实验(含命令)
ospf,三层交换机,热备,以太网通道练习实验(含命令)
188 0
ospf,三层交换机,热备,以太网通道练习实验(含命令)
解决二层单点故障及链路聚合
解决二层单点故障及链路聚合
258 0
|
网络协议 算法 网络架构
二层、三层、四层交换机的区别!!
看正文,希望能提供些帮助!
1407 0