华为,H3C和锐捷:一起学习如何配置VRRP

小编:魅力 更新时间:2022-05-04

华为

华为,H3C和锐捷:一起学习如何配置VRRP

1、配置设备间的网络互联。

#配置设备各接口的IP地址,配置SwitchA。

system-view

sysname switchA

vlan batch 100 300

interface gigabitethernet 1/0/1

port link-type hybrid

port hybrid pvid vlan 300

port hybrid untagged vlan 300

quit


interface gigabitethernet 1/0/2

port link-type hybrid

port hybrid pvid vlan 100

port hybrid untagged vlan 100

quit


interface vlanif 100

ip address 10.1.1.1 24

quit

interface vlanif 300

ip address 192.168.1.1 24

quit

#SwitchB和SwitchC配置与SwitchA类似,不在赘述。

#配置Switch的二层转发功能。

system-view

sysname switch

vlan batch 100

interface gigabitethernet 1/0/1

port link-type hybrid

port hybrid pvid vlan 100

port hybrid untagged vlan 100

quit


interface gigabitethernet 1/0/2

port link-type hybrid

port hybrid pvid vlan 100

port hybrid untagged vlan 100

quit

#配置SwitchA/B/C间采用OSPF协议进行路由学习。

ospf 1

area 0

network 10.1.1.0 0.0.0.255

network 192.168.1.0 0.0.0.255

quit

#SwitchB和SwitchC配置与SwitchA类似,不在赘述。

2.配置VRRP备份组。

#在switchA上创建VRRP备份组1,配置SwitchA在该备份组中的优先级为120,并配置抢占时间为20秒。

interface vlanif 100

vrrp vrid 1 virtual-ip 10.1.1.111

vrrp vrid 1 priority 120

vrrp vrid 1 preempt-mode timer delay 20

quit

#在switchB上创建VRRP备份组1,其在该备份组中的优先级为缺省值100。

interface vlanif 100

vrrp vrid 1 virtual-ip 10.1.1.111

quit

3.验证配置结果。

#在switchA/B上使用display vrrp命令,查看备份中的状态。switchA为master,switchB为backup。

display vrrp

#在switchA/B上使用display ip routing-table命令,查看SwitchA的路由表有一条目的地址为虚拟IP的直连路由,而switchB上该路由为OSPF路由。

display ip routing-table

#在SwitchA的接口ge1/0/2上执行shutdown,模拟swtichA故障,在switchB上使用display vrrp命令查看VRRP状态信息,switchB的状态为master。

#在SwitchA的接口ge1/0/2上执行undo shutdown,等待20秒后,在switchA上使用display vrrp命令查看VRRP状态信息,switchA的状态恢复为master。


H3C

华为,H3C和锐捷:一起学习如何配置VRRP

1.配置SwitchA。

#配置vlan2。

system-view

vlan 2

port fortygige 1/0/5

quit

interface vlan-interface 2

ip address 10.1.1.1 255.255.255.0

#创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.111。

vrrp vrid 1 virtual-ip 10.1.1.111

#配置switchA在备份组1中的优先级为110,以保证switchA成为master负责转发流量。

vrrp vrid 1 priority 110

#配置switchA抢占,保证switchA故障恢复后,能再次抢占成为master,避免频繁地进行状态切换,配置抢占延迟时间为5000厘秒。

vrrp vrid 1 preempt-mode delay 5000

2.配置switchB。

#配置vlan2。

system-view

vlan 2

port fortygige 1/0/5

quit

interface vlan-interface 2

ip address 10.1.1.2 255.255.255.0

#创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.111。

vrrp vrid 1 virtual-ip 10.1.1.111

#配置switchA在备份组1中的优先级为100。

vrrp vrid 1 priority 100

#配置switchB抢占,抢占延迟时间为5000厘秒。

vrrp vrid 1 preemtp-mode delay 5000

3.验证配置。

#使用命令display vrrp verbose在switchA和switchB上查看vrrp详细信息。

display vrrp verbose

#switchA故障时,流量从switchB走,故障恢复后,流量依然从switchA走。


锐捷

华为,H3C和锐捷:一起学习如何配置VRRP

1.配置连通性。

#核心交换机A和核心交换机B的配置。

vlan 10

exit

interface fastethernet 0/1

switch mode trunk

#接入交换机的配置。

vlan 10

exit

interface fastethernet 0/1

switch mode trunk

exit

interface fastethernet 0/2

switch mode trunk

exit

interface fastethernet 0/10

switch access vlan 10

exit

interface fastethernet 0/20

switch access vlan 20

exit

#vrrp配置。

核心交换机A的配置。

int vlan 10

ip address 192.168.10.254 255.255.255.0

vrrp 1 ip 192.168.10.1

vrrp 1 priority 120

exit

核心交换机B的配置。

int vlan 10

ip address 192.168.10.254 255.255.255.0

vrrp 1 ip 192.168.10.1

exit

2.验证配置。

show vrrp brief #查看vrrp状态。

show vrrp 1 #查看vrrp组1的详细信息。