1 组网需求
如图所示,在承担网关功能的Switch A和Switch B上分别配置组号相同的VRRP备份组,用户IPv4网络中的主机将VRRP备份组作为缺省网关。要求满足如下需求:
· Switch A是VRRP备份组中的Master设备,用户网络的主机在正常情况下优先从Switch A访问外网。当Switch A故障时,Switch B能够迅速成为Master设备,承担转发任务。
· 当Switch A连接上行链路的接口故障时,用户网络中的主机能够从Switch B访问外网。
· 配置MSTP避免Switch A、Switch B和二层交换机之间存在的环路问题,并指定Master设备为根桥。
图1IPv4 VRRP单备份组配置组网图

2配置思路
· 为了保证用户网络在正常情况下优先从Switch A访问外网,可以设置Switch A在备份组中具有更高的优先级,即保证Switch A优先作为备份组的Master设备。本例中将Switch A的优先级配置为120,Switch B使用缺省优先级100。
· 为了保证当Switch A出现故障时,Switch B能够迅速成为Master设备,以保证通信不会中断,可以在Switch B上配置Track项与BFD联动监视Switch A的状态。
· Switch A连接上行链路的接口出现故障时,备份组无法感知上行链路接口的故障,这将导致用户网络内的主机无法访问外部网络。可以在Switch A上配置Track项监视上行接口,当Switch A连接上行链路的接口处于Down或Removed状态时,Switch A主动降低自己的优先级,使得备份组内的Switch B优先级高于Switch A,Switch B能够成功抢占成为Master,承担转发任务。
3使用版本
本举例是在S12500-CMW520-R1825P01版本上进行配置和验证的。
4配置注意事项
· 同一VRRP备份组多个备份的路由器之间,虚拟IP地址及虚拟IP地址个数必须一致。
· 不要在Super VLAN对应的VLAN接口下创建VRRP备份组,以免对网络性能造成影响。
· 备份组的虚拟IP地址不能为全零地址(0.0.0.0)、广播地址(255.255.255.255)、环回地址、非A/B/C类地址和其它非法IP地址(如0.0.0.1)。
· 配置的虚拟IP地址和接口IP地址必须在同一网段,且为合法的主机地址(比如不能为接口IP地址所在网段的网络地址或网络广播地址),否则VRRP备份组无法正常工作。
5配置步骤
5.1设备A的配置
#配置VLAN101和VLAN102。
system-view
[SwitchA] vlan 101
[SwitchA-vlan101] port Gigabitethernet 2/0/1
[SwitchA-vlan101] port Gigabitethernet 2/0/24
[SwitchA-vlan101] quit
[SwitchA] vlan 102
[SwitchA-vlan102] port Gigabitethernet 2/0/2
[SwitchA-vlan102] quit
[SwitchA] interface GigabitEthernet 2/0/1
[SwitchA-GigabitEthernet2/0/1] undo shutdown
[SwitchA-GigabitEthernet2/0/1] quit
[SwitchA] interface GigabitEthernet 2/0/24
[SwitchA-GigabitEthernet2/0/24] undo shutdown
[SwitchA-GigabitEthernet2/0/24] quit
[SwitchA] interface GigabitEthernet 2/0/2
[SwitchA-GigabitEthernet2/0/2] undo shutdown
[SwitchA-GigabitEthernet2/0/2] quit
#配置上行接口。
[SwitchA] interface vlan-interface 102
[SwitchA-Vlan-interface102] ip address 100.0.0.2 24
[SwitchA–Vlan-interface102] undo shutdown
[SwitchA-Vlan-interface102] quit
#创建VRRP备份组1。
[SwitchA] interface vlan-interface 101
[SwitchA–Vlan-interface101] undo shutdown
[SwitchA-Vlan-interface101] ip address 10.0.0.2 24
[SwitchA-Vlan-interface101] vrrp vrid 1 virtual-ip 10.0.0.1
#配置Switch A在备份组1中的优先级为120。
[SwitchA-Vlan-interface101] vrrp vrid 1 priority 120
#配置监视上行接口。
[SwitchA-Vlan-interface101] vrrp vrid 1 track interface Vlan-interface102 reduced 255
[SwitchA-Vlan-interface101] quit
#配置MSTP。
[SwitchA] stp region-configuration
[SwitchA-mst-region] region-name vrrp
[SwitchA-mst-region] instance 1 vlan 101
[SwitchA-mst-region] active region-configuration
[SwitchA-mst-region] quit
[SwitchA] stp instance 1 root primary
[SwitchA] stp enable
[SwitchA] interface GigabitEthernet 2/0/2
[SwitchA-GigabitEthernet2/0/2] stp disable
5.2设备B的配置
#配置BFD echo报文方式的Source IP,IP地址可以任意指定,不要与实际接口地址相同。
system-view
[SwitchB] bfd echo-source-ip 10.10.10.10
#配置VLAN101和VLAN102。
[SwitchB] vlan 101
[SwitchB-vlan101] port Gigabitethernet 3/0/1
[SwitchB-vlan101] port Gigabitethernet 3/0/24
[SwitchB-vlan101] quit
[SwitchB] vlan 102
[SwitchB-vlan102] port Gigabitethernet 3/0/2
[SwitchB-vlan102] quit
[SwitchB] interface GigabitEthernet 3/0/1
[SwitchB-GigabitEthernet3/0/1] undo shutdown
[SwitchB-GigabitEthernet3/0/1] quit
[SwitchB] interface GigabitEthernet 3/0/24
[SwitchB-GigabitEthernet3/0/24] undo shutdown
[SwitchB-GigabitEthernet3/0/24] quit
[SwitchB] interface GigabitEthernet 3/0/2
[SwitchB-GigabitEthernet3/0/2] undo shutdown
[SwitchB-GigabitEthernet3/0/2] quit
#配置上行接口。
[SwitchB] interface vlan-interface 102
[SwitchB-Vlan-interface102] undo shutdown
[SwitchB-Vlan-interface102] ip address 100.0.0.3 24
[SwitchB-Vlan-interface102] quit
#创建VRRP备份组1。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] undo shutdown
[SwitchB-Vlan-interface101] ip address 10.0.0.3 24
[SwitchB-Vlan-interface101] vrrp vrid 1 virtual-ip 10.0.0.1
[SwitchB–Vlan-interface101] vrrp vrid 1 track 1 switchover
#配置接口接收BFD echo报文的最小时间间隔。
[SwitchB–Vlan-interface101] bfd min-echo-receive-interval 10
[SwitchB–Vlan-interface101] bfd detect-multiplier 3
[SwitchB–Vlan-interface101] quit
#配置Track对象。
[SwitchB] track 1 bfd echo interface vlan-interface 101 remote ip 10.0.0.2 local ip 10.0.0.3
#配置MSTP。
[SwitchB] stp region-configuration
[SwitchB-mst-region] region-name vrrp
[SwitchB-mst-region] instance 1 vlan 101
[SwitchB-mst-region] active region-configuration
[SwitchB-mst-region] quit
[SwitchB] stp enable
[SwitchB] interface GigabitEthernet 3/0/2
[SwitchB-GigabitEthernet3/0/2] stp disable
5.3二层交换机的配置
配置MSTP,配置方法同Switch B。
6验证配置
(1) 配置完成后,用户IPv4网络中的主机可以ping通外网。
(2) 通过display vrrp verbose命令查看配置后的结果。
#显示Switch A上备份组1的详细信息。
[SwitchA] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface101
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 120 Running Pri : 120
Preempt Mode : Yes Delay Time : 0
Auth Type : None
Virtual IP : 10.0.0.1
Virtual MAC : 0000-5e00-0101
Master IP : 10.0.0.2
VRRP Track Information:
Track Interface: Vlan102 State : Up Pri Reduced : 255
#显示Switch B上备份组1的详细信息。
[SwitchB] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface101
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 0
Auth Type : None
Virtual IP : 10.0.0.1
Master IP : 10.0.0.2
VRRP Track Information:
Track Object : 1 State : Positive Switchover
#显示MSTP状态,二层设备上的一个端口被阻塞。
[LSW]display stp instance 1 brief
MSTID Port Role STP State Protection
1 GigabitEthernet6/1/1 ALTE DISCARDING NONE
1 GigabitEthernet6/1/2 ROOT FORWARDING NONE
# Switch A出现故障或者被监视的上行VLAN接口down后,通过display vrrp verbose命令查看Switch B上备份组的详细信息,可以看到Switch B抢占为Master。
[SwitchB] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface101
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 0
Auth Type : None
Virtual IP : 10.0.0.1
Virtual MAC : 0000-5e00-0101
Master IP : 10.0.0.3
VRRP Track Information:
Track Object : 1 State : Negative Switchover
用户IPv4网络中的主机仍然可以ping通外网。
7配置文件
· 设备A:
#
vlan 101 to 102
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
active region-configuration
#
stp instance 1 root primary
stp enable
#
interface Vlan-interface101
ip address 10.0.0.2 255.255.255.0
vrrp vrid 1 virtual-ip 10.0.0.1
vrrp vrid 1 priority 120
vrrp vrid 1 track interface Vlan-interface102 reduced 255
#
interface Vlan-interface102
ip address 100.0.0.2 255.255.255.0
#
interface GigabitEthernet2/0/1
port link-mode bridge
port access vlan 101
#
interface GigabitEthernet2/0/2
port link-mode bridge
port access vlan 102
stp disable
#
interface GigabitEthernet2/0/24
port link-mode bridge
port access vlan 101
#
· 设备B:
#
bfd echo-source-ip 10.10.10.10
#
vlan 101 to 102
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
active region-configuration
#
stp enable
#
interface Vlan-interface101
ip address 10.0.0.3 255.255.255.0
bfd min-echo-receive-interval 10
bfd detect-multiplier 3
vrrp vrid 1 virtual-ip 10.0.0.1
vrrp vrid 1 track 1 switchover
#
interface Vlan-interface102
ip address 100.0.0.3 255.255.255.0
#
interface GigabitEthernet3/0/1
port link-mode bridge
port access vlan 101
#
interface GigabitEthernet3/0/2
port link-mode bridge
port access vlan 102
stp disable
#
interface GigabitEthernet3/0/24
port link-mode bridge
port access vlan 101
#
track 1 bfd echo interface vlan-interface 101 remote ip 10.0.0.2 local ip 10.0.0.3
#
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/223107.html原文链接:https://javaforall.net
