热备份路由协议HSRP和ARRP

HSRP协议:当网络中有多个路由器作为网关时,通过HSRP协议把两个网关地址虚拟成一个虚拟网关。

如图,R1R2都是PC1的出口网关,通过HSRP协议将网关R1R2虚拟成一个网关192.168.1.1,在PC1上指定网关为192.168.1.1。正常情况下,PC1的数据流量只从R1上通过,当R1出故障时,R2替代上来,让流量从R2上通过,从而达到冗余备份,实现网络可靠性。

232104510.jpg

HSRP命令

standby

1、创建HSRP

R1(config-if)#standby group-numberip virtual-ip-address

2、配置HSRP优先级

R1(config-if)#standby group-numberpriority priority-value

3HSRP占先权

R1(config-if)#standby group-numberpreempt

4、配置Hello间隔和保持时间

R1(config-if)#standby group-numbertimes hellotimeholdtime

5HSRP端口跟踪配置

R1(config-if)#standby group-numbertrack type mod/num interface-priority

(注:这些配置都是在真实网关所在接口下配置的)

查看:

查看HSRP摘要信息

R1#show standby [type mod/num][group-number] brief

查看HSRP详细信息

R1#show standby

监听HSRP事件

R1#debug standby events

配置实例

如下图,pc1pc2分别属于vlan10vlan20,使vlan10的流量从M1通过,当M1出故障时PC1流量切换至M2;默认vlan20的的流量M2通过,dangM2出故障时,流量切换至M1

232157117.jpg

1、配置R1M1M2之间的链路相互连通,并在R1配置换回口Loopback1,做测试用。

R1上的配置:

int f0/0

ip add 206.135.1.1 255.255.255.252

no sh

int f0/1

ip add 206.135.1.5 255.255.255.252

no sh

int loop 1

ip add 1.1.1.1 255.0.0.0

no sh

M1上的配置

intf0/0

ipadd206.135.1.2255.255.255.252

nosh

iproute1.0.0.0255.0.0.0206.135.1.1

iproute206.135.1.4255.255.255.252206.135.1.1

M2上配置

intf0/1

ipadd206.135.1.6255.255.255.252

nosh

iproute1.0.0.0255.0.0.0206.135.1.5

iproute206.135.1.0255.255.255.252206.135.1.5

2、在SW1f1/1f1/2划分为vlan10vlan20,并配置中继口

SW1上配置

no ip routing

vlan 10

vlan 20

int f1/1

sw acc vlan 10

int f1/2

sw acc vlan20

int f1/0

sw mo trunk

int f1/15

sw mo trunk

M1上配置

intf1/0

swmotrunk

M2上配置

int f1/15

sw mo trunk

3、在M1M2上配置vlan10vlan20做为真实网关,并在PC1上配置ip测试网络连通性

M1上配置

vlan 10

vlan 20

int vlan 10

ip add 192.168.10.10 255.255.255.0

int vlan20

ip add 192.168.20.20 255.255.255.0

M2上配置

vlan 10

vlan 20

int vlan 10

ip add 192.168.10.20255.255.255.0

int vlan 20

ip add 192.168.20.10 255.255.255.0

4、配置HSRP

M1上配置

int vlan 10

standby 1 ip 192.168.10.1

standby 1 priority120

standby 1 preempt

standby 1 track fa0/0

standby 1 track fa1/0

int vlan 20

standby 2 ip 192.168.20.1

standby2 priority115

standby 2 preempt

M2上配置

int vlan 10

standby 1 ip 192.168.10.1

standby1 priority 115

standby 1 preempt

int vlan 20

standby 2 ip 192.168.20.1

standby 2 priority 120

standby 2 preempt

standby 1 track fa0/1

standby 1 track fa1/15

5、在R1配置静态路由及浮动路由

ip route 192.168.10.0 255.255.255.0 206.135.1.2

ip route 192.168.10.0 255.255.255.0 206.135.1.610

ip route 192.168.20.0 255.255.255.0 206.135.1.6

ip route 192.168.20.0 .

255.255.255.0 206.135.1.210

VRRP协议

HSRP工作原理相似

1、创建VRRP

R1(config-if)#vrrp group-numberi p virtual-ip-address

2、配置HSRP优先级

R1(config-if)#vrrp group-number priority priority-value

3HSRP占先权

R1(config-if)#vrrp group-number preempt

4ARRP端口跟踪配置

R1(config)#track track-number interface interface-typeinterface-number line-protocol

R1(config-if)#vrrp track track-number

:每跟踪一个端口,都需要在全局模式下创建一个track-number


你可能感兴趣的:(可靠性)