Cisco HSRP热备份路由器协议配置

 

 

HSRP热备份路由器协议:

 

HSRP是 Hot Standby Routing Protocol(热备份路由协议)的缩写,它的作用是当核心路由器不能正常工作时,

备用路由器能够实现自动平滑的替换,以保证网络正常使用。该协议中含有多台路由器,对应一个HSRP组。

该组中只有一个路由器承担转发用户流量的职责,这就是活动路由器。当活动路由器失效后,备份路由器将

承担该职责,成为新的活动路由器。这就是热备份的原理。

 

知识点:VRRP虚拟路由冗余协议与HSRP协议功能相似,作用也是路由热备,VRRP协议是公共协议,HSRP是思科私有协议。

 

 

 

设计思路:

 

1、 C2911设置gi0/1配置一个IP地址充当外网地址并配置VLAN10  VLAN 20  VLAN30回程路由

2、 C2960_03交换机只是作为扩充端口使用

3、 C3560A和C3560B创建三个VLAN(VLAN10 VLAN20 VLAN30)并配置HSRP

4、 C2960_01和C2960_02配置VLAN并分配端口

5、PC0分配VLAN10的IP地址,PC1分配VLAN20的IP地址

6、Laptop0和Laptop1分配VLAN30的IP地址

 

 

 

网络拓扑图:

 

 

 

 

 

 

C3650A配置如下:

 

##配置gi0/1端口IP地址

C2911>enable

C2911#configure terminal

C2911 (config)#interface gigabitEthernet 0/1

C2911 (config-if)#ip address 172.16.1.1 255.255.255.0

C2911 (config-if)#no shutdown

C2911 (config-if)#exit

##配置VLAN 10  VLAN20  VLAN30回程路由

C2911 (config)#ip route 192.168.10.0 255.255.255.0 172.16.1.254

C2911 (config)#ip route 192.168.20.0 255.255.255.0 172.16.1.254

C2911 (config)#ip route 192.168.30.0 255.255.255.0 172.16.1.254

 

 

 

C2960_03配置如下:

 

C2960>enable

C2960#configure terminal

C2960(config)#interface range fastEthernet 0/1-3

C2960(config-if-range)#no shutdown

C2960(config-if-range)#exit

 

 

 

C3650A配置如下:

提示: standby 10 track fastEthernet 0/24 100 设置跟踪上行端口,110降级优先,例如VLAN10设置优先级150,如果fa0/24端口down掉,

优先级变成40,备份路由优先级是100,备份路由就会接替活动路由。此3560交换机版本太旧不支持设置tracke降级优先值。

 

##创建VLAN10  VLAN20  VLAN30

C3560A>enable

C3560A#vlan database

C3560A(vlan)#vlan 10 name VLAN10

C3560A(vlan)#vlan 20 name VLAN20

C3560A(vlan)#vlan 30 name VLAN30

C3560A(vlan)#exit

##配置HSRP

C3560A#configure terminal

C3560A(config)#interface vlan 10

C3560A(config-if)#ip address 192.168.10.1 255.255.255.0

C3560A(config-if)#standby 10 ip 192.168.10.254      #配置HSRP虚拟IP

C3560A(config-if)#standby 10 priority 150           #配置HSRP优先级

C3560A(config-if)#standby 10 preempt                #配置HSRP抢先权

C3560A(config-if)#exit

C3560A(config)#interface vlan 20

C3560A(config-if)#ip address 192.168.20.1 255.255.255.0

C3560A(config-if)#standby 20 ip 192.168.20.254

C3560A(config-if)#standby 20 priority 150

C3560A(config-if)#standby 20 preempt

C3560A(config-if)#exit

C3560A(config)#interface vlan 30

C3560A(config-if)#ip address 192.168.30.1 255.255.255.0

C3560A(config-if)#standby 30 ip 192.168.30.254

C3560A(config-if)#standby 30 priority 150

C3560A(config-if)#standby 30 preempt

C3560A(config-if)#exit

##配置fa0/20-21端口为trunk

C3560A(config)#interface range fastEthernet 0/20-21

C3560A(config-if-range)#switchport trunk encapsulation dot1q

C3560A(config-if-range)#switchport mode trunk

C3560A(config-if-range)#no shutdown

C3560A(config-if-range)#exit

##配置fa0/24为三层接口连接上级路由(连接外网)

C3560A(config)#interface fastEthernet 0/24

C3560A(config-if)#no switchport

C3560A(config-if)#ip address 172.16.1.254 255.255.255.0

C3560A(config-if)#exit

##开启路由功能

C3560A(config)#ip routing

##设置三层交换机默认出口路由

C3560A(config)#ip route 0.0.0.0 0.0.0.0 172.16.1.1

##显示与维护

C3560A#show standby brief

C3560A#show running-config

 

 

 

C3650B配置如下:

 

##创建VLAN10  VLAN20  VLAN30

C3560B>enable

C3560B#vlan database

C3560B(vlan)#vlan 10 name VLAN10

C3560B(vlan)#vlan 20 name VLAN20

C3560B(vlan)#vlan 30 name VLAN30

C3560B(vlan)#exit

##配置HSRP

C3560B#configure terminal

C3560B(config)#interface vlan 10

C3560B(config-if)#ip address 192.168.10.2 255.255.255.0

C3560B(config-if)#standby 10 ip 192.168.10.254

C3560B(config-if)#standby 10 priority 100

C3560B(config-if)#standby 10 preempt

C3560B(config-if)#exit

C3560B(config)#interface vlan 20

C3560B(config-if)#ip address 192.168.20.2 255.255.255.0

C3560B(config-if)#standby 20 ip 192.168.20.254

C3560B(config-if)#standby 20 priority 100

C3560B(config-if)#standby 20 preempt

C3560B(config-if)#exit

C3560B(config)#interface vlan 30

C3560B(config-if)#ip address 192.168.30.2 255.255.255.0

C3560B(config-if)#standby 30 ip 192.168.30.254

C3560B(config-if)#standby 30 priority 100

C3560B(config-if)#standby 30 preempt

C3560B(config-if)#exit

##配置fa0/20-21端口为trunk

C3560B(config)#interface range fastEthernet 0/20-21

C3560B(config-if-range)#switchport trunk encapsulation dot1q

C3560B(config-if-range)#switchport mode trunk

C3560B(config-if-range)#no shutdown

C3560B(config-if-range)#exit

##配置fa0/24为三层接口连接上级路由(连接外网)

C3560B(config)#interface fastEthernet 0/24

C3560B(config-if)#no switchport

C3560B(config-if)#ip address 172.16.1.254 255.255.255.0

C3560B(config-if)#exit

##开启路由功能

C3560B(config)#ip routing

##设置三层交换机默认出口路由

C3560B(config)#ip route 0.0.0.0 0.0.0.0 172.16.1.1

##显示与维护

C3560B#show standby brief

C3560B#show running-config

 

 

 

C2960_01配置如下:

C2960_01>enable

C2960_01#vlan database

C2960_01(vlan)#vlan 10 name VLAN10

C2960_01(vlan)#vlan 20 name VLAN20

C2960_01(vlan)#vlan 30 name VLAN30

C2960_01(vlan)#exit

C2960_01#configure terminal

C2960_01(config)#interface range fastEthernet 0/1-5

C2960_01(config-if-range)#switchport access vlan 10

C2960_01(config-if-range)#switchport mode access

C2960_01(config-if-range)#no shutdown

C2960_01(config-if-range)#exit

C2960_01(config)#interface range fastEthernet 0/6-10

C2960_01(config-if-range)#switchport access vlan 30

C2960_01(config-if-range)#switchport mode access

C2960_01(config-if-range)#no shutdown

C2960_01(config-if-range)#exit

C2960_01(config)#interface range fastEthernet 0/23-24

C2960_01(config-if-range)#switchport mode trunk

C2960_01(config-if-range)#no shutdown

C2960_01(config-if-range)#exit

 

 

C2960_02配置如下:

C2960_02>enable

C2960_02#vlan database

C2960_02(vlan)#vlan 10 name VLAN10

C2960_02(vlan)#vlan 20 name VLAN20

C2960_02(vlan)#vlan 30 name VLAN30

C2960_02(vlan)#exit

C2960_02#configure terminal

C2960_02(config)#interface range fastEthernet 0/1-5

C2960_02(config-if-range)#switchport access vlan 20

C2960_02(config-if-range)#switchport mode access

C2960_02(config-if-range)#no shutdown

C2960_02(config-if-range)#exit

C2960_02(config)#interface range fastEthernet 0/6-10

C2960_02(config-if-range)#switchport access vlan 30

C2960_02(config-if-range)#switchport mode access

C2960_02(config-if-range)#no shutdown

C2960_02(config-if-range)#exit

C2960_02(config)#interface range fastEthernet 0/23-24

C2960_02(config-if-range)#switchport mode trunk

C2960_02(config-if-range)#no shutdown

C2960_02(config-if-range)#exit

 

posted @ 2018-04-17 11:31  邹龙彬  阅读(4611)  评论(0编辑  收藏  举报