clip_image002

要求:

1、 两个网段10.1.1.0/24和192.168.1./24

2、 R1和R2做双机热备

步骤:

PC1和PC2为路由器,模拟主机:

PC1:

en

conf t

no ip routing

ip default-gateway 10.1.1.1

int f0/0

ip add 10.1.1.10 255.255.255.0

no sh

PC2:

en

conf t

no ip routing

ip default-gateway 192.168.1.1

int f0/0

ip add 192.168.1.10

no sh

将SW1和SW2接口开启,配置完全相同,只写SW1

SW1:

en

conf t

int r f 0/0 – 2

no sh

R1和R2配置接口地址和HSRP

R1:

en

conf t

int f0/0

ip add 10.1.1.2 255.255.255.0

no sh

st 1 ip 10.1.1.1

st 1 pri 150

st 1 pre

int f1/0

ip add 192.168.1.2 255.255.255.0

no sh

st 2 ip 192.168.1.1

st 2 pre

R2:

en

conf t

int f0/0

ip add 10.1.1.3 255.255.255.0

no sh

st 1 ip 10.1.1.1

st 1 pre

int f1/0

ip add 192.168.1.3 255.255.255.0

no sh

st 2 ip 192.168.1.1

st 2 pri 150

st 2 pre

测试

在PC1上ping网关10.1.1.1

clip_image004

在PC1上ping PC2

clip_image006

查看standby状态:

clip_image008

在PC1上连续ping PC2,用shutdown命令关闭R1的f0/0或R2的f1/0

clip_image010

可以看到链路的中断只会导致极少的丢包,查看standby状态

clip_image012

clip_image014

可以看到R2已经成为Group1中的Active路由器

将测试中shutdown的接口开启,当shutdown R1的f1/0接口:

clip_image016

当f1/0接口down,stanby状态不会发生改变,Group1的Active路由器认为R1,但是R1的f1/0口down了,R1上没有192.168.1.0/24的路由,导致目标不可达。解决方法是配置接口追踪,Group1追踪f1/0接口的状态,当f1/0接口down,priority减小60,比R2的priority低,R2成为Active,保证网络连通性。配置命令如下:

R1(config-if)#int f0/0

R1(config-if)#st 1 tr f1/0 60

这样,down掉f1/0接口,R1的priority将为90,R2将成为Active

clip_image018

clip_image020

clip_image022

将其它接口配置track追踪,实验完成。