热备份路由选择协议

author author     2023-03-13     357

关键词:

随着公司的发展,公司对网络的要求越来越高,因此公司决定搭建由两台核心交换机做热备份的网络,为了充分利用网络资源,公司还要求实现vlan的负载均衡。
拓扑图如下:
技术图片
网络规划如下:

  1. 交换机之间的接口全部为trunk模式
  2. 在SW1-3L和SW2-3L上配置HSRP,活跃路由器优先级为150,备份路由器优先级为100
  3. 在SW1-3L交换机上配置vlan接口IP地址
    vlan2接口的IP地址,192.168.2.1/24
    vlan3接口的IP地址,192.168.3.1/24
    vlan4接口的IP地址,192.168.4.1/24
    4.在SW2-3L交换机上配置vlan接口IP地址
    vlan2接口的IP地址,192.168.2.2/24
    vlan3接口的IP地址,192.168.3.2/24
    vlan4接口的IP地址,192.168.4.2/24
    5.PC的IP地址及网关如下
    PC1的IP地址为192.168.2.10/24 网关为192.168.2.254/24
    PC2的IP地址为192.168.3.10/24 网关为192.168.3.254/24
    PC3的IP地址为192.168.2.11/24 网关为192.168.2.254/24
    PC4的IP地址为192.168.4.10/24 网关为192.168.4.254/24

实验步骤:
配置交换机的基本信息
HSRP的基本配置
配置HSRP的优先级
配置HSRP的占先权
配置STP(PVST+),实现VLAN负载均衡
验证HSRP

根据拓扑图搭建环境
PC和三层交换机都用路由器模拟,二层交换机用交换机模拟
技术图片
添加模块
router1和router2模拟的三层交换机,添加NM-16ESW模块,router3到router5添加NM-1FE-TX模块,switch1和switch2添加NM-16ESW模块
技术图片
生成文件CMD窗口最小化就可以了,连接线路,要严格按照拓扑图连接,连接完成点击右下角生成.BAT文件
技术图片

看开生成的BAT文件,router1到switch2全部打开,最小化就可以,
技术图片
打开CRT连接各个模拟器
协议号选择telnet,主机名为127.0.0.1 路由器的端口是2001到2006,交换机是3001 3002,一个一个连接就可以
技术图片
全部连完之后,全部敲一下垃圾命令改一下名字
技术图片

SW1-3L配置0/13-15接口为trunk
SW1-3L(config)#interface range fastEthernet 0/13 - 15
SW1-3L(config-if-range)#switchport trunk encapsulation dot1q
SW1-3L(config-if-range)#switchport mode trunk
技术图片
在SW2-3L上配置F0/13 – 15 接口为trunk
SW2-3L(config)#interface range fastEthernet 0/13 - 15
SW2-3L(config-if-range)#switchport trunk encapsulation dot1q
SW2-3L(config-if-range)#switchport mode trunk
技术图片
在SW3上配置F0/14 – 15接口为trunk
SW3(config)#interface range fastEthernet 0/14 - 15
SW3(config-if-range)#switchport trunk encapsulation dot1q
SW3(config-if-range)#switchport mode trunk
技术图片
在SW4上配置F0/14 – 15接口为trunk
SW4(config)#interface range fastEthernet 0/14 - 15
SW4(config-if-range)#switchport trunk encapsulation dot1q
SW4(config-if-range)#switchport mode trunk
技术图片
在SW1-3L进入vlan数据库,配置域名为Benet.com server工作模式,创建vlan2 vlan3 vlan4
SW1-3L#vlan database
SW1-3L(vlan)#vtp do
SW1-3L(vlan)#vtp domain benet.com
Changing VTP domain name from NULL to benet.com
SW1-3L(vlan)#vtp server
Device mode already VTP SERVER.
SW1-3L(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
SW1-3L(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
SW1-3L(vlan)#vlan 4
VLAN 4 added:
Name: VLAN0004
SW1-3L(vlan)#exit
查看vlan创建是否成功
SW1-3L(vlan)#show vlan-switch b
技术图片
在SW2-3L上进入vlan数据库模式,域名配置为Benet.com,配置为client客户端模式,自动复制vlan2 vlan3 vlan4
SW2-3L#vlan database
SW2-3L(vlan)#vtp domain benet.com
Domain name already set to benet.com .
SW2-3L(vlan)#vtp client
Setting device to VTP CLIENT mode.
SW2-3L(vlan)#exit
技术图片
在SW3上进入vlan数据库模式,域名配置为Benet.com,配置为client客户端模式,自动复制vlan2 vlan3 vlan4
SW3#vlan database
SW3(vlan)#vtp domain benet.com
Domain name already set to benet.com .
SW3(vlan)#vtp client
Setting device to VTP CLIENT mode.
SW3(vlan)#exit
技术图片
在SW4上进入vlan数据库模式,域名配置为Benet.com,配置为client客户端模式,自动复制vlan2 vlan3 vlan4
SW4#vlan database
SW4(vlan)#vtp domain benet.com
Domain name already set to benet.com .
SW4(vlan)#vtp client
Setting device to VTP CLIENT mode.
SW4(vlan)#exit
技术图片
SW1-3L配置vlan2的IP地址,192.168.2.1
SW1-3L(config)#interface vlan 2
SW1-3L(config-if)#ip address 192.168.2.1 255.255.255.0
SW1-3L(config-if)#no shutdown

SW1-3L配置vlan3的IP地址,192.168.3.1
SW1-3L(config)#interface vlan 3
SW1-3L(config-if)#ip address 192.168.3.1 255.255.255.0
SW1-3L(config-if)#no shutdown

SW1-3L配置vlan4的IP地址,192.168.4.1
SW1-3L(config)#interface vlan 4
SW1-3L(config-if)#ip address 192.168.4.1 255.255.255.0
SW1-3L(config-if)#no shutdown

Show ip inter b查看vlanIP是否配置成功
SW1-3L#show ip inter b
技术图片

在SW2-3L上配置vlan2的IP地址,192.168.2.2
SW2-3L(config)#interface vlan 2
SW2-3L(config-if)#ip address 192.168.2.2 255.255.255.0
SW2-3L(config-if)#no shutdown

在SW2-3L上配置vlan3的IP地址,192.168.3.2
SW2-3L(config)#interface vlan 3
SW2-3L(config-if)#ip address 192.168.3.2 255.255.255.0
SW2-3L(config-if)#no shutdown

在SW2-3L上配置vlan4的IP地址,192.168.4.2
SW2-3L(config)#interface vlan 4
SW2-3L(config-if)#ip address 192.168.4.2 255.255.255.0
SW2-3L(config-if)#no shutdown

Show ip inter b查看vlanIP是否配置成功
SW2-3L#show ip inter b
技术图片

配置PC1的IP地址,网关配置为192.168.2.254
PC1-VLAN2(config)#no ip routing
PC1-VLAN2(config)#interface fastEthernet 0/0
PC1-VLAN2(config-if)#no shutdown
PC1-VLAN2(config)#interface fastEthernet 0/0
PC1-VLAN2(config-if)#ip address 192.168.2.10 255.255.255.0
PC1-VLAN2(config-if)#no shutdown
PC1-VLAN2(config-if)#exit
PC1-VLAN2(config)#ip default-gateway 192.168.2.254

配置PC2的IP地址,网关配置为192.168.3.254
PC2-VLAN3(config)#no ip routing
PC2-VLAN3(config)#interface fastEthernet 0/0
PC2-VLAN3(config-if)#no shutdown
PC2-VLAN3(config-if)#exit
PC2-VLAN3(config)#interface fastEthernet 0/0
PC2-VLAN3(config-if)#ip address 192.168.3.10 255.255.255.0
PC2-VLAN3(config-if)#no shutdown
PC2-VLAN3(config-if)#exit
PC2-VLAN3(config)#ip default-gateway 192.168.3.254
PC2-VLAN3(config)#exit

配置PC3的IP地址,网关配置为192.168.2.254
PC3-VLAN2(config)#no ip routing
PC3-VLAN2(config)#interface fastEthernet 0/0
PC3-VLAN2(config-if)#no shutdown
PC3-VLAN2(config-if)#exit
PC3-VLAN2(config)#interface fastEthernet 0/0
PC3-VLAN2(config-if)#ip address 192.168.2.11 255.255.255.0
PC3-VLAN2(config-if)#no shutdown
PC3-VLAN2(config-if)#exit
PC3-VLAN2(config)#ip default-gateway 192.168.2.254
PC3-VLAN2(config)#exit

配置PC4的IP地址,网关配置为192.168.4.254
PC4-VLAN4(config)#no ip routing
PC4-VLAN4(config)#interface fastEthernet 0/0
PC4-VLAN4(config-if)#no shutdown
PC4-VLAN4(config-if)#exit
PC4-VLAN4(config)#interface fastEthernet 0/0
PC4-VLAN4(config-if)#ip address 192.168.4.10 255.255.255.0
PC4-VLAN4(config-if)#no shutdown
PC4-VLAN4(config-if)#exit
PC4-VLAN4(config)#ip default-gateway 192.168.4.254
PC4-VLAN4(config)#exit

配置vlan2活跃路由器,优先级150 跟踪端口降级100
SW1-3L(config)#interface vlan 2
SW1-3L(config-if)#standby 2 ip 192.168.2.254
SW1-3L(config-if)#standby 2 priority 150
*Mar 1 01:32:37.447: %HSRP-6-STATECHANGE: Vlan2 Grp 2 state Standby -> Active
SW1-3L(config-if)#standby 2 track fastEthernet 0/13 100
SW1-3L(config-if)#standby 2 track fastEthernet 0/14 100
SW1-3L(config-if)#standby 2 track fastEthernet 0/15 100
SW1-3L(config-if)#standby 2 preempt
SW1-3L(config-if)#exit

配置vlan3活跃路由器,优先级150 跟踪端口降级100
SW1-3L(config)#interface vlan 3
SW1-3L(config-if)#standby 3 ip 192.168.3.254
SW1-3L(config-if)#standby 3 priority 150
*Mar 1 01:34:22.135: %HSRP-6-STATECHANGE: Vlan3 Grp 3 state Standby -> Active
SW1-3L(config-if)#standby 2 track fastEthernet 0/13 100
SW1-3L(config-if)#standby 2 track fastEthernet 0/14 100
SW1-3L(config-if)#standby 2 track fastEthernet 0/15 100
SW1-3L(config-if)#standby 3 preempt
SW1-3L(config-if)#exit

配置vlan4活跃路由器,优先级150 跟踪端口降级100
SW1-3L(config)#interface vlan 4
SW1-3L(config-if)#standby 4 ip 192.168.4.254
SW1-3L(config-if)#standby 4 priority 150
*Mar 1 01:35:24.007: %HSRP-6-STATECHANGE: Vlan4 Grp 4 state Standby -> Active
SW1-3L(config-if)#standby 4 track fastEthernet 0/13 100
SW1-3L(config-if)#standby 4 track fastEthernet 0/14 100
SW1-3L(config-if)#standby 4 track fastEthernet 0/15 100
SW1-3L(config-if)#standby 4 preempt
SW1-3L(config-if)#exit

配置vlan2的备份路由器,优先级150
SW2-3L(config)#interface vlan 2
SW2-3L(config-if)#standby 2 ip 192.168.2.254
SW2-3L(config-if)#standby 2 priority 150
SW2-3L(config-if)#exit

配置vlan3的备份路由器,优先级150
SW2-3L(config)#interface vlan 3
SW2-3L(config-if)#standby 3 ip 192.168.3.254
SW2-3L(config-if)#standby 3 priority 150
SW2-3L(config-if)#exit

配置vlan4的备份路由器,优先级150
SW2-3L(config)#interface vlan 4
SW2-3L(config-if)#standby 4 ip 192.168.4.254
SW2-3L(config-if)#standby 4 priority 150
SW2-3L(config-if)#exit

配置vlan2活跃路由器的优先级
SW1-3L(config)#interface vlan 2
SW1-3L(config-if)#standby 2 ip 192.168.2.254
SW1-3L(config-if)#standby 2 priority 150

配置vlan3活跃路由器的优先级
SW1-3L(config)#interface vlan 3
SW1-3L(config-if)#standby 3 ip 192.168.3.254
SW1-3L(config-if)#standby 3 priority 150

配置vlan4活跃路由器的优先级
SW1-3L(config)#interface vlan 4
SW1-3L(config-if)#standby 4 ip 192.168.4.254
SW1-3L(config-if)#standby 4 priority 150

开启vlan2 vlan3 vlan4的抢占功能
SW1-3L(config-if)#standby 2 preempt
SW1-3L(config-if)#standby 3 preempt
SW1-3L(config-if)#standby 4 preempt

在SW1-3L配置vlan2 vlan3 vlan4为根网桥
SW1-3L(config)#spanning-tree vlan 2 root primary
VLAN 2 bridge priority set to 8192
VLAN 2 bridge max aging time unchanged at 20
VLAN 2 bridge hello time unchanged at 2
VLAN 2 bridge forward delay unchanged at 15
SW1-3L(config)#spanning-tree vlan 3 root primary
VLAN 3 bridge priority set to 8192
VLAN 3 bridge max aging time unchanged at 20
VLAN 3 bridge hello time unchanged at 2
VLAN 3 bridge forward delay unchanged at 15
SW1-3L(config)#spanning-tree vlan 4 root primary
VLAN 4 bridge priority set to 8192
VLAN 4 bridge max aging time unchanged at 20
VLAN 4 bridge hello time unchanged at 2
VLAN 4 bridge forward delay unchanged at 15

在SW2-3L配置vlan2 vlan3 vlan4为备份根网桥
SW2-3L(config)#spanning-tree vlan 2 root secondary
VLAN 2 bridge priority set to 16384
VLAN 2 bridge max aging time unchanged at 20
VLAN 2 bridge hello time unchanged at 2
VLAN 2 bridge forward delay unchanged at 15
SW2-3L(config)#spanning-tree vlan 3 root secondary
VLAN 3 bridge priority set to 16384
VLAN 3 bridge max aging time unchanged at 20
VLAN 3 bridge hello time unchanged at 2
VLAN 3 bridge forward delay unchanged at 15
SW2-3L(config)#spanning-tree vlan 4 root secondary
VLAN 4 bridge priority set to 16384
VLAN 4 bridge max aging time unchanged at 20
VLAN 4 bridge hello time unchanged at 2
VLAN 4 bridge forward delay unchanged at 15

验证HSRP
技术图片

技术图片

热备份路由选择协议(hsrp)配置命令及原理

热备份路由选择协议(HSRP)HSRP是Cisco私有协议HSRP组成员:(1)活跃路由器(2)备份路由器(3)虚拟路由器(4)其他路由器HSRP消息:HSRP中的所有路由器都发送或接收HSRP消息UDP端口号1985使用组播发送HSRP消息,组播地址224.0.0.2T... 查看详情

热备份路由选择协议(hsrp)的原理与配置

HSRP的原理   HSRP(HotStandbyRoutingProtocol,热备份路由选择协议)是Cisco私有的一种技术,它确保了当网络边缘设备或接入链路出现故障时,用户通信能迅速并透明的恢复,以此为IP网络提供冗余性。通过应用HSRP,可使网络... 查看详情

热备份路由选择协议

热备份路由选择协议目标:理解HSRP的工作原理掌握HSRP的术语和参数的作用掌握HSRP的配置和排错网络的主要目的是让最终用户可以访问网络中的数据与服务。一旦网络中的网关或者关键节点出现故障,将对业务造成灾难性故障。... 查看详情

浅谈hsrp(热备份路由选择协议)

...这两台路由器就是HSRP组成员,一个组中有活跃路由器、备份路由器、虚拟路由器和其他路由器。活跃路由器:转发发送到虚拟路由器的数据包,通过发送hello消 查看详情

热备份路由协议(hsrp)(代码片段)

HSRP(热备份路由协议)是Cisco的一种私有技术,它能够确保当网络边缘设备或接入链路出现故障时,用户通信能迅速并透明的恢复,以此为IP网络提供冗余性。HSRP为IP网路提供了容错和增强的路由选择功能。通过使用同一个虚拟... 查看详情

hsrp(热备份路由选择协议)配置详解(代码片段)

...这两台路由器就是HSRP组成员,一个组中有活跃路由器、备份路由器、虚拟路由器和其他路由器。其各个路由器的功能如下:`活跃路由器`:转发发送到虚拟路由器的数据包,通过发送hello消息来承担和保持它活跃的角色;备份路... 查看详情

hsrp/vrrp,热备份网关协议

HSRP/VRRP,热备份网关协议  技术背景一个高可用性的网络肯定会在设计之初就考虑单点故障所带来的影响,所以都会选择可实现冗余备份的设计,在前文中提到的STP,生成树协议就是这样的操作,可是当数据到达了三层,... 查看详情

hsrp热备份路由协议

HSRP热备份路由协议(cisco私有协议) 目的:多条通往互联网的线路,当一个网络边缘设备或一条接入链路出现故障时,能迅速并透明地恢复 原理:两台或者多台路由器使用同一个虚拟IP地址和虚拟MAC地址,作为一台虚拟... 查看详情

热备份路由选择协议

...要求越来越高,因此公司决定搭建由两台核心交换机做热备份的网络,为了充分利用网络资源,公司还要求实现vlan的负载均衡。拓扑图如下:网络规划如下:交换机之间的接口全部为trunk模式在SW1-3L和SW2-3L上配置HSRP,活跃路由... 查看详情

hsrp和vrrp热备份的应用.dochttps://pan.wps.cn/l/s4egx5t(代码片段)

HSRP和VRRP热备份的应用HSRP热备份路由选择协议热备份路由器协议(HSRP:HotStandbyRouterProtocol),是cisco平台一种特有的技术,是cisco的私有协议。该协议中含有多台路由器,对应一个HSRP组。该组中只有一个路由器承担转发用户流量的职... 查看详情

网关冗余-hsrp协议

网关冗余(双机热备)HSRP(热备份路由选择协议属思科私有)VRRP公有协议  IETF制定,RFC2338  实现原理和过程与HSRP基本相同  在协议上与HSRP有所区别HSRP组成员  活跃路由器  备份路由器  虚拟路由器  其它路... 查看详情

快速生成树mstp及vrrp热备份路由选择协议

1.冗余链路存在的问题在企业的网络设计中,一般都会设计具有冗余的拓扑结构。因为单一的链路会导致单点故障,提高故障的概率。越是大规模的网络,对冗余性的要求越高,但是,当网络具有冗余性之后,一些问题也随之发... 查看详情

大型企业网络构建之网关冗余

...之网关冗余一、HSRP原理1、HSRP(HotStandbyRoutingProtocol)热备份路由选择协议,是cisco的私有协议。HSRP运行在UDP上,采用端口号1985。2、热备份原理:该协议中含有多台路由器,对应一个HSRP组--活动路由器:该组中只有一个路由器承... 查看详情

防火墙双机热备

...外部网络之间的通讯中断,通讯可靠性无法保证。双机热备份技术的出现改变了可靠性难以保证的尴尬状态,通过在网络出口位置部署两台或多台网关设备,保证了内部网络于外部网络之间的通讯畅通。为了避免路由器传统组网... 查看详情

配置hsrp——实现断网用户无感知

HSRP:热备份路由器协议是cisco的私有协议。该协议中含有多台路由器,对应一个HSRP组。该组中只有一个路由器承担转发用户流量的职责,这就是活跃路由器。当活跃路由器失效后,备份路由器将承担该职责,成为新的活跃路由... 查看详情

hsrp热备的配置

一、HSRP的简介:HSRP:热备份路由器协议(HSRP:HotStandbyRouterProtocol),是cisco平台一种特有的技术,是cisco的私有协议。该协议中含有多台路由器,对应一个HSRP组。该组中只有一个路由器承担转发用户流量的职责,这就是活动路... 查看详情

hsrp原理+实验

HSRP原理+实验一、原理热备份路由选择协议当网络边缘设备或接入链路出现故障时使网络的正常运行时间接近100%通过路由器里的优先级进行活跃路由选择二、实验:1、对vlan10、vlan20,分别在sw-3l、R3上进行热备份,2、sw-3l、R3上... 查看详情

keepalived双机热备

...要功能是实现故障切换,类似于我们以前学习过的HSRP热备份路由协议,HSRP是思科的私有协议,而VRRP是通用协议,都是为了实现故障切换,当一台路由器发生故障的时候,另一台马上接替工作,用户感觉不到服务器发生了问题,... 查看详情