54-VRRP典型配置举例
本章节下载: 54-VRRP典型配置举例 (600.55 KB)
目 录
1.3 VRRP与Track、NQA联动监视Master上行链路典型配置举例
1.4 VRRP与Track、BFD联动监视Master上行链路典型配置举例
1.5 VRRP与Track、BFD联动实现快速切换典型配置举例
本章介绍使用VRRP技术提高网络可靠性的典型配置举例。
表1 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1208系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图1所示,Host A所在网络的出口处部署了两台设备。现要求使用VRRP单备份组功能,将这两台设备组成一台虚拟路由器,作为Host A的缺省网关。具体应用需求如下:
· 在正常情况下,由Switch A承担网关功能,转发Host A发送至外网的流量;
· 当Switch A或其上行接口出现故障时,由Switch B接替Switch A承担网关功能;当Switch A故障恢复后,由Switch A继续承担网关功能;
· 保护VRRP备份组中的设备不受网络中非法VRRP报文的影响。
图1 VRRP单备份组配置组网图
· 为了使Switch A优先被选举为VRRP备份组的Master设备,需要为其配置较高的优先级;
· 配置VRRP备份组工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 监视Switch A上行接口的状态,当监测到其上行接口故障时,Switch A的优先级会自动降低指定的数额,使备份组内Switch B的优先级高于Switch A,从而实现主备切换;
· 为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间;
· VRRP备份组认证功能可以保证VRRP备份组内的设备仅处理合法的VRRP报文。
· 同一个VRRP备份组的成员设备,如下配置必须保证完全一致:虚拟路由器的IP地址个数、每个备份组虚拟路由器的IP地址、定时器间隔时间和认证方式。
· 用户在配置降低优先级幅度时,需要确保降低后的优先级,比备份组内其他交换机的优先级要低,确保备份组内有其他交换机被选为Master交换机。
# 配置VLAN 3。
<SwitchA> system-view
[SwitchA] vlan 3
[SwitchA-vlan3] port gigabitethernet 1/0/3
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ip address 100.0.0.2 24
[SwitchA-Vlan-interface3] quit
# 配置VLAN 2。
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 202.38.160.1 255.255.255.0
# 创建VRRP备份组1,其虚拟IP地址为202.38.160.111/24。
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 202.38.160.111
# 设置Switch A在备份组中的优先级为110。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
# 设置备份组的认证方式为SIMPLE认证,认证字为hello。
[SwitchA-Vlan-interface2] vrrp vrid 1 authentication-mode simple hello
#设置Switch A工作在抢占方式,抢占延迟时间为5秒。
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
# 设置监视Switch A连接Internet的VLAN接口3。当被监视的接口不可用时,Switch A的优先级会自动降低20,使备份组内Switch B的优先级高于Switch A,从而实现主备切换。
[SwitchA-Vlan-interface2] vrrp vrid 1 track interface vlan-interface 3 reduced 20
(2) 配置Switch B
# 配置VLAN 3。
<SwitchB> system-view
[SwitchB] vlan 3
[SwitchB-vlan3] port gigabitethernet 1/0/3
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ip address 101.0.0.2 24
[SwitchB-Vlan-interface3] quit
# 配置VLAN 2。
[SwitchB] vlan 2
[SwitchB-Vlan2] port gigabitethernet 1/0/5
[SwitchB-Vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 202.38.160.2 255.255.255.0
# 创建一个VRRP备份组1,其虚拟IP地址为202.38.160.111/24。
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 202.38.160.111
# 设置备份组的认证方式为SIMPLE认证,认证字为hello。
[SwitchB-Vlan-interface2] vrrp vrid 1 authentication-mode simple hello
# 设置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
(3) 配置主机
配置Host A的缺省网关为202.38.160.111,具体配置过程略。
配置完成后,在Host A上可以ping通Host B。通过display vrrp verbose命令查看配置后的结果。
# 显示Switch A上备份组1的详细信息。
[SwitchA-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : 202.38.160.111
Virtual MAC : 0000-5e00-0101
Master IP : 202.38.160.1
VRRP Track Information:
Track Interface: Vlan3 State : Up Pri Reduced : 20
# 显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : Simple Key : ******
Virtual IP : 202.38.160.111
Master IP : 202.38.160.1
以上显示信息表示在备份组1中Switch A为Master,Switch B为Backup,Host A发送给Host B的报文通过Switch A转发。
Switch A出现故障后,在Host A上仍然可以ping通Host B。通过display vrrp verbose命令查看Switch B上备份组的详细信息。
# Switch A出现故障后,显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : 202.38.160.111
Virtual MAC : 0000-5e00-0101
Master IP : 202.38.160.2
以上显示信息表示Switch A出现故障后,Switch B成为Master,Host A发送给Host B的报文通过Switch B转发。
Switch A连接Internet的VLAN接口3不可用时,在Host A上仍然可以ping通Host B。通过display vrrp verbose命令查看备份组的信息。
# Switch A的VLAN接口3不可用时,显示Switch A上备份组1的详细信息。
[SwitchA-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 110 Running Pri : 90
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : Simple Key : ******
Virtual IP : 202.38.160.111
Master IP : 202.38.160.2
VRRP Track Information:
Track Interface: Vlan3 State : Down Pri Reduced : 20
# Switch A的VLAN接口3不可用时,显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : 202.38.160.111
Virtual MAC : 0000-5e00-0101
Master IP : 202.38.160.2
以上显示信息表示Switch A的VLAN接口3不可用时,Switch A的优先级降低为90,成为Backup,Switch B成为Master,Host A发送给Host B的报文通过Switch B转发。
· Switch A上的配置
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 202.38.160.1 255.255.255.0
vrrp vrid 1 virtual-ip 202.38.160.111
vrrp vrid 1 priority 110
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 track interface Vlan-interface3 reduced 20
vrrp vrid 1 authentication-mode simple cipher $c$3$1FcANPYJCkyfZyS7FAl0oW8bBcUXNbbc
#
interface Vlan-interface3
ip address 100.0.0.2 255.255.255.0
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
· Switch B上的配置
vlan 2 to 3
#
interface Vlan-interface2
ip address 202.38.160.2 255.255.255.0
vrrp vrid 1 virtual-ip 202.38.160.111
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 authentication-mode simple cipher $c$3$vxKRiU4Fy/p4dRTiw+znGTQyYNDfQrxb
#
interface Vlan-interface3
ip address 101.0.0.2 255.255.255.0
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
配置备份组发送和接收VRRP报文的认证方式之后,认证字的显示方式(明文或密文)与设备的软件版本有关,此处以密文为例。
表2 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1208系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图2所示,Host A所在网络的出口处部署了两台设备。现要求使用VRRP单备份组功能,将这两台设备组成一台虚拟路由器,作为Host A的缺省网关。具体应用需求如下:
· 在正常情况下,由Switch A承担网关功能,转发Host A发送至外网的流量;
· 当Switch A或其上行链路出现故障时,由Switch B接替Switch A承担网关功能;当Switch A故障恢复后,由Switch A继续承担网关功能;
· 保护VRRP备份组中的设备不受网络中非法VRRP报文的影响。
图2 VRRP与Track、NQA联动监视Master上行链路配置组网图
· 为了使Switch A优先被选举为VRRP备份组的Master设备,需要为其配置较高的优先级;
· 配置VRRP备份组工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 利用NQA技术监视Switch A上行链路的连通情况,当监测到其上行链路不通时,Switch A的优先级会自动降低指定的数额,使备份组内Switch B的优先级高于Switch A,从而实现主备切换;
· 为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间;
· VRRP备份组认证功能可以保证VRRP备份组内的设备仅处理合法的VRRP报文。
同一个VRRP备份组的成员设备,如下配置必须保证完全一致:虚拟路由器的IP地址个数、每个备份组虚拟路由器的IP地址、定时器间隔时间和认证方式。
(1) 按照图2配置各接口的IP地址
下面以Switch A Vlan-interface 2为例进行介绍,其它接口的配置过程类似,不再一一赘述。
# 配置Switch A Vlan-interface 2的接口地址。
<SwitchA> system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 10.1.1.1 255.255.255.0
[SwitchA-Vlan-interface2] quit
(2) 在Switch A上配置NQA测试组
# 创建管理员名为admin、操作标签为test的NQA测试组。
[SwitchA] nqa entry admin test
# 配置测试类型为ICMP-echo。
[SwitchA-nqa-admin-test] type icmp-echo
# 配置目的地址为10.1.2.2。
[SwitchA-nqa-admin-test-icmp-echo] destination ip 10.1.2.2
# 测试频率为100ms。
[SwitchA-nqa-admin-test-icmp-echo] frequency 100
# 配置联动项1(连续失败5次触发联动)。
[SwitchA-nqa-admin-test-icmp-echo] reaction 1 checked-element probe-fail threshold-type consecutive 5 action-type trigger-only
[SwitchA-nqa-admin-test-icmp-echo] quit
# 启动探测。
[SwitchA] nqa schedule admin test start-time now lifetime forever
(3) 在Switch A上配置Track项
# 配置Track项1,关联NQA测试组(管理员为admin,操作标签为test)的联动项1。
[SwitchA] track 1 nqa entry admin test reaction 1
(4) 在Switch A上配置VRRP
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.10。
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.10
# 设置Switch A在备份组1中的优先级为110。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
# 设置备份组的认证方式为SIMPLE,认证字为hello。
[SwitchA-Vlan-interface2] vrrp vrid 1 authentication-mode simple hello
# 设置Switch A工作在抢占方式,抢占延迟时间为5秒。
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
# 设置监视Track项。
[SwitchA-Vlan-interface2] vrrp vrid 1 track 1 reduced 20
(5) 在Switch B上配置VRRP
<SwitchB> system-view
[SwitchB] interface vlan-interface 2
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.10。
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.10
# 设置备份组的认证方式为SIMPLE,认证字为hello。
[SwitchB-Vlan-interface2] vrrp vrid 1 authentication-mode simple hello
# 设置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
(6) 配置主机
配置Host A的缺省网关为10.1.1.10,具体配置过程略。
配置完成后,在Host A上可以ping通Host B。通过display vrrp命令查看配置后的结果。
# 显示Switch A上备份组1的详细信息。
[SwitchA-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : 10.1.1.10
Virtual MAC : 0000-5e00-0101
Master IP : 10.1.1.1
VRRP Track Information:
Track Object : 1 State : Positive Pri Reduced : 20
# 显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : Simple Key : ******
Virtual IP : 10.1.1.10
Master IP : 10.1.1.1
以上显示信息表示在备份组1中Switch A为Master,Switch B为Backup,Host A发送给Host B的报文通过Switch A转发。
Switch A与Switch C不通时,在Host A上仍然可以ping通Host B。通过display vrrp命令查看备份组的信息。
# Switch A与Switch C不通时,显示Switch A上备份组1的详细信息。
[SwitchA-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 110 Running Pri : 90
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : Simple Key : ******
Virtual IP : 10.1.1.10
Master IP : 10.1.1.2
VRRP Track Information:
Track Object : 1 State : Negative Pri Reduced : 20
# Switch A与Switch C不通时,显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : 10.1.1.10
Virtual MAC : 0000-5e00-0101
Master IP : 10.1.1.2
以上显示信息表示Switch A与Switch C不通时,Switch A的优先级降低为90,成为Backup,Switch B成为Master,Host A发送给Host B的报文通过Switch B转发。
· Switch A上的配置
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 10.1.1.1 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.10
vrrp vrid 1 priority 110
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 track 1 reduced 20
vrrp vrid 1 authentication-mode simple cipher $c$3$Fq7Gw6ux6gf6sjUnaPxfYaJSJ08rxGhc
#
interface Vlan-interface3
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet1/0/5
port access vlan 2
#
interface GigabitEthernet1/0/6
port access vlan 3
#
nqa entry admin test
type icmp-echo
destination ip 10.1.2.2
frequency 100
reaction 1 checked-element probe-fail threshold-type consecutive 5 action-type trigger-only
#
track 1 nqa entry admin test reaction 1
#
nqa schedule admin test start-time now lifetime forever
#
· Switch B上的配置
#
vlan 2
#
interface Vlan-interface2
ip address 10.1.1.2 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.10
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 authentication-mode simple cipher $c$3$1SjZTNgoayfie8IplIGd+p1lI64QoDs4
#
interface GigabitEthernet1/0/5
port access vlan 2
#
配置备份组发送和接收VRRP报文的认证方式之后,认证字的显示方式(明文或密文)与设备的软件版本有关,此处以密文为例。
表3 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1208系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图3所示,主机所在网络的出口处部署了两台设备。现要求使用VRRP单备份组功能,将这两台设备组成一台虚拟路由器,作为局域网内主机的缺省网关。具体应用需求如下:
· 在正常情况下,由Switch A承担网关功能,转发局域网内的主机发送至外网的流量;
· 当Switch A或其上行链路出现故障时,由Switch B接替Switch A承担网关功能;当Switch A故障恢复后,由Switch A继续承担网关功能;
· 保护VRRP备份组中的设备不受网络中非法VRRP报文的影响。
图3 VRRP与Track、BFD联动监视Master上行链路配置组网图
· 为了使Switch A优先被选举为VRRP备份组的Master设备,需要为其配置较高的优先级;
· 配置VRRP备份组工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 利用BFD技术监视Switch A上行链路的连通情况,当监测到其上行链路不通时,Switch A的优先级会自动降低指定的数额,使备份组内Switch B的优先级高于Switch A,从而实现主备切换;
· 为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间;
· VRRP备份组认证功能可以保证VRRP备份组内的设备仅处理合法的VRRP报文。
本案例要求Switch A上行设备支持BFD功能。
· 同一个VRRP备份组的成员设备,如下配置必须保证完全一致:虚拟路由器的IP地址个数、每个备份组虚拟路由器的IP地址、定时器间隔时间和认证方式。
· 配置Track与BFD联动时,不要将BFD会话探测的本地地址和远端地址配置为VRRP备份组的虚拟IP地址。
(1) 按照图3配置各接口的IP地址
下面以Switch A Vlan-interface 2为例进行介绍,其它接口的配置过程类似,不再一一赘述。
# 配置Switch A Vlan-interface 2的接口地址。
<SwitchA> system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 192.168.0.101 255.255.255.0
[SwitchA-Vlan-interface2] quit
(2) 在Switch A上配置BFD功能
# 配置BFD echo报文的源地址为10.10.10.10。
[SwitchA] bfd echo-source-ip 10.10.10.10
(3) 在Switch A上创建和BFD会话关联的Track项
# 创建和BFD会话关联的Track项1,检测IP地址为1.1.1.2的上行设备是否可达。
[SwitchA] track 1 bfd echo interface vlan-interface 3 remote ip 1.1.1.2 local ip 1.1.1.1
(4) 在Switch A上配置VRRP
# 创建备份组1,配置备份组1的虚拟IP地址为192.168.0.10。
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 192.168.0.10
# 配置Switch A在备份组1中的优先级为110。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
# 设置Switch A工作在抢占方式,抢占延迟时间为5秒。
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
# 设置备份组的认证方式为SIMPLE认证,认证字为hello。
[SwitchA-Vlan-interface2] vrrp vrid 1 authentication-mode simple hello
# 配置备份组1监视Track项1的状态,当Track项状态为Negative时,Switch A的优先级降低20。
[SwitchA-Vlan-interface2] vrrp vrid 1 track 1 reduced 20
[SwitchA-Vlan-interface2] return
(5) 在Switch B上配置VRRP
# 创建备份组1,配置备份组1的虚拟IP地址为192.168.0.10。
<SwitchB> system-view
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 192.168.0.10
# 设置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
# 设置备份组的认证方式为SIMPLE认证,认证字为hello。
[SwitchB-Vlan-interface2] vrrp vrid 1 authentication-mode simple hello
[SwitchB-Vlan-interface2] return
(6) 配置主机
配置局域网内主机的缺省网关为192.168.0.10,具体配置过程略。
# 显示Switch A上备份组的详细信息。
<SwitchA> display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : 192.168.0.10
Virtual MAC : 0000-5e00-0101
Master IP : 192.168.0.101
VRRP Track Information:
Track Object : 1 State : Positive Pri Reduced : 20
# 显示Switch A上Track项1的信息。
<SwitchA> display track 1
Track ID: 1
Status: Positive
Duration: 0 days 0 hours 0 minutes 7 seconds
Notification delay: Positive 0, Negative 0 (in seconds)
Reference object:
BFD session:
Packet type: Echo
Interface : Vlan-interface3
Remote IP : 1.1.1.2
Local IP : 1.1.1.1
# 显示Switch B上备份组的详细信息。
<SwitchB> display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : Simple Key : ******
Virtual IP : 192.168.0.10
Master IP : 192.168.0.101
以上显示信息表示Track项1的状态为Positive时,Switch A为Master,Switch B为Backup。
# 当Switch A监视的上行链路出现故障时,Track项1的状态变为Negative。
<SwitchA> display track 1
Track ID: 1
Status: Negative
Duration: 0 days 0 hours 0 minutes 20 seconds
Notification delay: Positive 0, Negative 0 (in seconds)
Reference object:
BFD session:
Packet type: Echo
Interface : Vlan-interface3
Remote IP : 1.1.1.2
Local IP : 1.1.1.1
# 查看Switch A上备份组的详细信息。
<SwitchA> display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 110 Running Pri : 90
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : Simple Key : ******
Virtual IP : 192.168.0.10
Master IP : 192.168.0.102
VRRP Track Information:
Track Object : 1 State : Negative Pri Reduced : 20
# 显示Switch B上备份组的详细信息。
<SwitchB> display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : 192.168.0.10
Virtual MAC : 0000-5e00-0101
Master IP : 192.168.0.102
以上显示信息表示Switch A通过BFD检测到上行链路不通时,将自己的优先级降低为90,从而保证Switch B抢占成为Master。
· Switch A上的配置
#
bfd echo-source-ip 10.10.10.10
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 192.168.0.101 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.0.10
vrrp vrid 1 priority 110
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 track 1 reduced 20
vrrp vrid 1 authentication-mode simple cipher $c$3$8j5zt3i82EKmOjERTrq8BiL906SviDVp
#
interface Vlan-interface3
ip address 1.1.1.1 255.255.255.0
#
interface GigabitEthernet1/0/5
port access vlan 2
#
interface GigabitEthernet1/0/6
port access vlan 3
#
track 1 bfd echo interface Vlan-interface3 remote ip 1.1.1.2 local ip 1.1.1.1
#
· Switch B上的配置
#
vlan 2
#
interface Vlan-interface2
ip address 192.168.0.102 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.0.10
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 authentication-mode simple cipher $c$3$1SjZTNgoayfie8IplIGd+p1lI64QoDs4
#
interface GigabitEthernet1/0/5
port access vlan 2
#
配置备份组发送和接收VRRP报文的认证方式之后,认证字的显示方式(明文或密文)与设备的软件版本有关,此处以密文为例。
表4 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1208系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图4所示,主机所在网络的出口处部署了两台设备。现要求使用VRRP单备份组功能,将这两台设备组成一台虚拟路由器,作为局域网内主机的缺省网关。具体应用需求如下:
· 在正常情况下,由Switch A承担网关功能,转发局域网内的主机发送至外网的流量;
· 当Switch A出现故障时,由Switch B快速接替Switch A承担网关功能;当Switch A故障恢复后,由Switch A继续承担网关功能;
· 保护VRRP备份组中的设备不受网络中非法VRRP报文的影响。
图4 VRRP与Track、BFD联动实现快速切换配置组网图
· 为了使Switch A优先被选举为VRRP备份组的Master设备,需要为其配置较高的优先级;
· 配置VRRP备份组工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· Switch B利用BFD技术监视Switch A的运行状态,当监测到Switch A发生故障时,Switch B快速从Backup切换为Master状态,从而提高切换速度;
· 为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间;
· VRRP备份组认证功能可以保证VRRP备份组内的设备仅处理合法的VRRP报文。
· 同一个VRRP备份组的成员设备,如下配置必须保证完全一致:虚拟路由器的IP地址个数、每个备份组虚拟路由器的IP地址、定时器间隔时间和认证方式。
· 配置Track与BFD联动时,不要将BFD会话探测的本地地址和远端地址配置为VRRP备份组的虚拟IP地址。
(1) 按照图3配置各接口的IP地址
下面以Switch A Vlan-interface 2为例进行介绍,其它接口的配置过程类似,不再一一赘述。
# 配置Switch A Vlan-interface 2的接口地址。
<SwitchA> system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 192.168.0.101 255.255.255.0
(2) 在Switch A上配置VRRP
# 创建备份组1,并配置备份组1的虚拟IP地址为192.168.0.10。
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 192.168.0.10
# 配置Switch A在备份组1中的优先级为110。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
# 设置Switch A工作在抢占方式,抢占延迟时间为5秒。
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
# 设置备份组的认证方式为SIMPLE认证,认证字为hello。
[SwitchA-Vlan-interface2] vrrp vrid 1 authentication-mode simple hello
[SwitchA-Vlan-interface2] return
(3) 在Switch B上配置BFD功能
# 配置BFD echo报文的源地址为10.10.10.10。
<SwitchB> system-view
[SwitchB] bfd echo-source-ip 10.10.10.10
(4) 在Switch B上创建和BFD会话关联的Track项
# 创建和BFD会话关联的Track项1,检测Switch A是否可达。
[SwitchB] track 1 bfd echo interface vlan-interface 2 remote ip 192.168.0.101 local ip 192.168.0.102
(5) 在Switch B上配置VRRP
# 创建备份组1,并配置备份组1的虚拟IP地址为192.168.0.10。
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 192.168.0.10
# 设置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
# 设置备份组的认证方式为SIMPLE认证,认证字为hello。
[SwitchB-Vlan-interface2] vrrp vrid 1 authentication-mode simple hello
# 配置备份组1监视Track项1的状态,当Track项状态为Negative时,Switch B快速从Backup切换为Master状态。
[SwitchB-Vlan-interface2] vrrp vrid 1 track 1 switchover
[SwitchB-Vlan-interface2] return
(6) 配置主机
配置局域网内主机的缺省网关为192.168.0.10,具体配置过程略。
# 显示Switch A上备份组的详细信息。
<SwitchA> display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : 192.168.0.10
Virtual MAC : 0000-5e00-0101
Master IP : 192.168.0.101
# 显示Switch B上备份组的详细信息。
<SwitchB> display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Ru nning Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : Simple Key : ******
Virtual IP : 192.168.0.10
Master IP : 192.168.0.101
VRRP Track Information:
Track Object : 1 State : Positive Switchover
# 显示Switch B上Track项的信息。
<SwitchB> display track 1
Track ID: 1
Status: Positive
Duration: 0 days 0 hours 2 minutes 22 seconds
Notification delay: Positive 0, Negative 0 (in seconds)
Reference object:
BFD session:
Packet type: Echo
Interface : Vlan-interface2
Remote IP : 192.168.0.101
Local IP : 192.168.0.102
以上显示信息表示Track项状态为Positive时,Switch A为Master,Switch B为Backup。
# 打开Switch B的VRRP状态调试信息开关和BFD事件调试信息开关。
<SwitchB> terminal debugging
<SwitchB> terminal monitor
<SwitchB> debugging vrrp state
<SwitchB> debugging bfd event
# Switch A出现故障时,Switch B上输出如下调试信息。
*Dec 17 14:44:34:142 2012 SwitchB BFD/7/EVENT: Send sess-down Msg, [Src:192.168.0.102,Dst:192.168.0.101,Vlan-interface2,Echo], instance:0, protocol:Track
*Dec 17 14:44:34:144 2012 SwitchB VRRP/7/DebugState: IPv4 Vlan-interface2 | Virtual Router 1 : Backup --> Master reason: The status of the tracked object changed
# 显示Switch B上备份组的详细信息。
<SwitchB> display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : 192.168.0.10
Virtual MAC : 0000-5e00-0101
Master IP : 192.168.0.102
VRRP Track Information:
Track Object : 1 State : Negative Switchover
以上调试信息表示,BFD探测到Switch A出现故障后,立即由Track通知VRRP模块将Switch B的状态切换为Master,不再等待VRRP通告报文的超时时间,从而保证Backup设备能够快速切换为Master。
· Switch A上的配置
#
vlan 2
#
interface Vlan-interface2
ip address 192.168.0.101 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.0.10
vrrp vrid 1 priority 110
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 authentication-mode simple cipher $c$3$Fq7Gw6ux6gf6sjUnaPxfYaJSJ08rxGhc
#
interface GigabitEthernet1/0/5
port access vlan 2
#
· Switch B上的配置
#
bfd echo-source-ip 10.10.10.10
#
vlan 2
#
interface Vlan-interface2
ip address 192.168.0.102 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.0.10
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 track 1 switchover
vrrp vrid 1 authentication-mode simple cipher $c$3$1SjZTNgoayfie8IplIGd+p1lI64QoDs4
#
interface GigabitEthernet1/0/5
port access vlan 2
#
track 1 bfd echo interface vlan-interface2 remote ip 192.168.0.101 local ip 192.168.0.102
#
配置备份组发送和接收VRRP报文的认证方式之后,认证字的显示方式(明文或密文)与设备的软件版本有关,此处以密文为例。
表5 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1208系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图5所示,局域网的出口处部署了两台设备。现要求使用VRRP功能,将这两台设备组成多台虚拟路由器,分别作为不同VLAN内主机的缺省网关。具体应用需求如下:
· 在正常情况下,VLAN 2内的主机通过Switch A访问外部网络,VLAN 3内的主机通过Switch B访问外部网络;
· 当Switch A或Switch B自身出现故障,或其上行接口出现故障时,局域网内的主机可以通过另一台设备继续通信,避免通信中断;当Switch A或Switch B故障恢复后,继续承担网关功能。
图5 多个VRRP备份组负载分担配置组网图
· 用户也可以在Master设备上配置VRRP与Track、NQA(或BFD)的联动,监视其上行链路的状态,避免在Master自身工作正常的情况下因Master上行链路故障造成的通信中断,具体配置方法请参见1.3 VRRP与Track、NQA联动监视Master上行链路典型配置举例;
· 用户可以在Backup设备上配置VRRP与Track、BFD的联动,监视Master的状态,从而提高主备切换速度,具体配置方法请参见1.5 VRRP与Track、BFD联动实现快速切换典型配置举例。
· 为了实现不同VLAN数据的负载分担,需要在Switch A和Switch B上分别创建两个VRRP备份组,并配置VLAN 2内的主机都将备份组1作为网关,VLAN 3内的主机都将备份组2作为网关;
· 为使Switch A优先被选举为VRRP备份组1的Master设备,需要为其在VRRP备份组1中配置较高的优先级;为使Switch B优先被选举为VRRP备份组2的Master设备,需要为其在VRRP备份组2中配置较高的优先级;
· 配置两个VRRP备份组都工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 监视Switch A和Switch B上行接口的状态,当监测到其上行接口故障时,Switch A或Switch B的优先级会自动降低指定的数额,使VRRP备份组1内Switch B的优先级高于Switch A,或VRRP备份组2内Switch A的优先级高于Switch B,从而实现主备切换;
· 为了避免VRRP备份组中的角色频繁发生变化,可以为两个备份组都配置一定的抢占延迟时间。
同一个VRRP备份组的成员设备,如下配置必须保证完全一致:虚拟路由器的IP地址个数、每个备份组虚拟路由器的IP地址、定时器间隔时间和认证方式。
(1) 配置Switch A
# 配置VLAN 4。
<SwitchA> system-view
[SwitchA] vlan 4
[SwitchA-vlan4] port gigabitethernet 1/0/7
[SwitchA-vlan4] quit
[SwitchA] interface vlan-interface 4
[SwitchA-Vlan-interface4] ip address 20.1.1.2 255.255.255.0
[SwitchA-Vlan-interface4] quit
# 配置VLAN 2。
<SwitchA> system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 202.38.160.1 255.255.255.128
# 创建一个备份组1,并配置备份组1的虚拟IP地址为202.38.160.100。
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 202.38.160.100
# 设置Switch A在备份组1中的优先级为110。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
# 设置Switch A工作在抢占方式,抢占延迟时间为5秒。
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
# 设置监视Switch A连接Internet的VLAN接口4。当被监视的接口DOWN掉时,Switch A的优先级会自动降低30,使备份组内Switch B的优先级高于Switch A,从而实现主备切换。
[SwitchA-Vlan-interface2] vrrp vrid 1 track interface vlan-interface 4 reduced 30
[SwitchA-Vlan-interface2] quit
# 配置VLAN 3。
[SwitchA] vlan 3
[SwitchA-vlan3] port gigabitethernet 1/0/6
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ip address 202.38.160.130 255.255.255.128
# 创建一个备份组2,并配置备份组2的虚拟IP地址为202.38.160.200。
[SwitchA-Vlan-interface3] vrrp vrid 2 virtual-ip 202.38.160.200
# 设置Switch A工作在抢占方式,抢占延迟时间为5秒。
[SwitchA-Vlan-interface3] vrrp vrid 2 preempt-mode timer delay 5
(2) 配置Switch B
# 配置VLAN 4。
<SwitchB> system-view
[SwitchB] vlan 4
[SwitchB-vlan4] port gigabitethernet 1/0/7
[SwitchB-vlan4] quit
[SwitchB] interface vlan-interface 4
[SwitchB-Vlan-interface4] ip address 30.1.1.2 255.255.255.0
[SwitchB-Vlan-interface4] quit
# 配置VLAN 2。
<SwitchB> system-view
[SwitchB] vlan 2
[SwitchB-vlan2] port gigabitethernet 1/0/5
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 202.38.160.2 255.255.255.128
# 创建一个备份组1,并配置备份组1的虚拟IP地址为202.38.160.100。
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 202.38.160.100
# 设置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
[SwitchB-Vlan-interface2] quit
# 配置VLAN 3。
[SwitchB] vlan 3
[SwitchB-vlan3] port gigabitethernet 1/0/6
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ip address 202.38.160.131 255.255.255.128
# 创建一个备份组2,并配置备份组2的虚拟IP地址为202.38.160.200。
[SwitchB-Vlan-interface3] vrrp vrid 2 virtual-ip 202.38.160.200
# 设置Switch B在备份组2中的优先级为110。
[SwitchB-Vlan-interface3] vrrp vrid 2 priority 110
# 设置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface3] vrrp vrid 2 preempt-mode timer delay 5
# 设置监视Switch B连接Internet的VLAN接口4。当被监视的接口DOWN掉时,Switch B的优先级会自动降低30,使备份组内Switch A的优先级高于Switch B,从而实现主备切换。
[SwitchB-Vlan-interface3] vrrp vrid 2 track interface vlan-interface 4 reduced 30
(3) 配置主机
配置VLAN 2内主机的缺省网关为202.38.160.100/25,VLAN 3内主机的缺省网关为202.38.160.200/25,具体配置过程略。
可以通过display vrrp verbose命令查看配置后的结果。
# 显示Switch A上备份组的详细信息。
[SwitchA-Vlan-interface3] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : 202.38.160.100
Virtual MAC : 0000-5e00-011e
Master IP : 202.38.160.1
VRRP Track Information:
Track Interface: Vlan4 State : Up Pri Reduced : 30
Interface Vlan-interface3
VRID : 2 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : 202.38.160.200
Master IP : 202.38.160.131
# 显示Switch B上备份组的详细信息。
[SwitchB-Vlan-interface3] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : 202.38.160.100
Master IP : 202.38.160.1
Interface Vlan-interface3
VRID : 2 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : 202.38.160.200
Virtual MAC : 0000-5e00-0120
Master IP : 202.38.160.131
VRRP Track Information:
Track Interface: Vlan4 State : Up Pri Reduced : 30
以上显示信息表示在备份组1中Switch A为Master,Switch B为Backup,缺省网关为202.38.160.100/25的主机通过Switch A访问Internet;备份组2中Switch A为Backup,Switch B为Master,缺省网关为202.38.160.200/25的主机通过Switch B访问Internet。
Switch A出现故障后,再次通过display vrrp verbose命令查看Switch B上备份组的详细信息。
# Switch A出现故障后,显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface3] display vrrp verbose
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : 202.38.160.100
Virtual MAC : 0000-5e00-011e
Master IP : 202.38.160.2
Interface Vlan-interface3
VRID : 2 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : 202.38.160.200
Virtual MAC : 0000-5e00-0120
Master IP : 202.38.160.131
VRRP Track Information:
Track Interface: Vlan4 State : Up Pri Reduced : 30
以上显示信息表示Switch A出现故障后,Switch B成为VRRP备份组1的Master,VLAN 2内的主机发送给外网的报文改为通过Switch B转发。
· Switch A上的配置
#
vlan 2 to 4
#
interface Vlan-interface2
ip address 202.38.160.1 255.255.255.128
vrrp vrid 1 virtual-ip 202.38.160.100
vrrp vrid 1 priority 110
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 track interface Vlan-interface4 reduced 30
#
interface Vlan-interface3
ip address 202.38.160.130 255.255.255.128
vrrp vrid 2 virtual-ip 202.38.160.200
vrrp vrid 2 preempt-mode timer delay 5
#
interface Vlan-interface4
ip address 20.1.1.2 255.255.255.0
#
interface GigabitEthernet1/0/5
port access vlan 2
#
interface GigabitEthernet1/0/6
port access vlan 3
#
interface GigabitEthernet1/0/7
port access vlan 4
#
· Switch B上的配置
#
vlan 2 to 4
#
interface Vlan-interface2
ip address 202.38.160.2 255.255.255.128
vrrp vrid 1 virtual-ip 202.38.160.100
vrrp vrid 1 preempt-mode timer delay 5
#
interface Vlan-interface3
ip address 202.38.160.131 255.255.255.128
vrrp vrid 2 virtual-ip 202.38.160.200
vrrp vrid 2 priority 110
vrrp vrid 2 preempt-mode timer delay 5
vrrp vrid 2 track interface Vlan-interface4 reduced 30
#
interface Vlan-interface4
ip address 30.1.1.2 255.255.255.0
#
interface GigabitEthernet1/0/5
port access vlan 2
#
interface GigabitEthernet1/0/6
port access vlan 3
#
interface GigabitEthernet1/0/7
port access vlan 4
#
表6 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1208系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图6所示,区域A和区域B用户所在网络的出口处部署了两台设备。现要求使用VRRP功能,将这两台设备组成多台虚拟路由器,分别作为不同VLAN内主机的缺省网关。具体应用需求如下:
· 在正常情况下,区域A用户通过接入设备Switch C的GE1/0/1端口将数据发送给网关设备Switch A进行数据转发;区域B用户通过接入设备Switch D的GE1/0/1端口将数据发送给网关设备Switch B进行数据转发;
· 当Switch A或Switch B自身出现故障,或其上行接口出现故障时,局域网中的主机可以通过另一台设备继续通信,避免通信中断;当Switch A或Switch B故障恢复后,继续承担网关功能;
· 当Switch A或Switch B的下线链路出现故障时,局域网中的主机通过接入设备Switch C或Switch D的GE1/0/2端口将数据转发给网关设备继续通信,避免通信中断;当Switch A或Switch B的下线链路故障恢复后,继续由Switch C或Switch D的GE1/0/1端口将数据发送给网关设备。
图6 VRRP与MSTP混合组网图
· 为了实现不同区域中用户数据流的负载分担,需要在Switch A和Switch B上分别创建两个VRRP备份组,并配置二层交换机Switch C连接的主机都将VRRP备份组1作为网关,二层交换机Switch D连接的主机都将VRRP备份组2作为网关;
· 为使Switch A优先被选举为VRRP备份组1的Master设备,需要为其在VRRP备份组1中配置较高的优先级;为使Switch B优先被选举为VRRP备份组2的Master设备,需要为其在VRRP备份组2中配置较高的优先级;
· 配置两个VRRP备份组都工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 监视Switch A或Switch B上行接口的状态,当监测到其上行接口故障时,Switch A或Switch B的优先级会自动降低指定的数额,使VRRP备份组1内Switch B的优先级高于Switch A,或VRRP备份组2内Switch A的优先级高于Switch B,从而实现主备切换;
· 利用MSTP多实例技术避免二层环路。将VLAN 101映射到MSTP实例1中;将VLAN 102映射到MSTP实例2中。保证正常情况下,MSTP实例1中的流量通过Switch C的GE1/0/1端口转发,MSTP实例2中的流量通过Switch D的GE1/0/1端口转发(如图6所示)。
(1) 配置Switch A
# 配置GE1/0/1属于VLAN 101、GE1/0/3属于VLAN 102、GE1/0/2属于VLAN 4092,配置两个网关设备间采用trunk口直连,允许VLAN 101和102的报文通过。
<SwitchA> system-view
[SwitchA] vlan 101
[SwitchA-vlan101] port gigabitethernet 1/0/1
[SwitchA-vlan101] quit
[SwitchA] vlan 102
[SwitchA-vlan102] port gigabitethernet 1/0/3
[SwitchA-vlan102] quit
[SwitchA] vlan 4092
[SwitchA-vlan4092] port gigabitethernet 1/0/2
[SwitchA-vlan4092] quit
[SwitchA] interface gigabitethernet 1/0/4
[SwitchA-GigabitEthernet1/0/4] port link-type trunk
[SwitchA-GigabitEthernet1/0/4] undo port trunk permit vlan 1
[SwitchA-GigabitEthernet1/0/4] port trunk permit vlan 101 to 102
[SwitchA-GigabitEthernet1/0/4] port trunk pvid vlan 101
[SwitchA-GigabitEthernet1/0/4] quit
# 配置上行接口。
[SwitchA] interface gigabitethernet 1/0/2
[SwitchA-GigabitEthernet1/0/2] undo stp enable
[SwitchA-GigabitEthernet1/0/2] quit
[SwitchA] interface vlan-interface 4092
[SwitchA-Vlan-interface4092] ip address 10.1.1.2 24
# 创建VRRP备份组1,配置备份组1优先级为110。
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ip address 10.10.101.2 24
[SwitchA-Vlan-interface101] vrrp vrid 1 virtual-ip 10.10.101.1
[SwitchA-Vlan-interface101] vrrp vrid 1 priority 110
# 配置VRRP备份组1监视上行接口。
[SwitchA-Vlan-interface101] vrrp vrid 1 track interface vlan-interface 4092 reduced 20
[SwitchA-Vlan-interface101] quit
# 创建VRRP备份组2。
[SwitchA] interface vlan-interface 102
[SwitchA-Vlan-interface102] ip address 10.10.102.2 24
[SwitchA-Vlan-interface102] vrrp vrid 1 virtual-ip 10.10.102.1
[SwitchA–Vlan-interface102] quit
# 配置MSTP。
[SwitchA] stp region-configuration
[SwitchA-mst-region] region-name vrrp
[SwitchA-mst-region] instance 1 vlan 101
[SwitchA-mst-region] instance 2 vlan 102
[SwitchA-mst-region] active region-configuration
[SwitchA-mst-region] quit
[SwitchA] stp instance 1 root primary
[SwitchA] stp instance 2 root secondary
[SwitchA] stp enable
(2) 配置Switch B
# 配置GE1/0/1属于VLAN 101、GE1/0/3属于VLAN 102、GE1/0/2属于VLAN 4093,配置两个网关设备间采用trunk口直连,允许VLAN 101和102的报文通过。
<SwitchB> system-view
[SwitchB] vlan 101
[SwitchB-vlan101] port gigabitethernet 1/0/1
[SwitchB-vlan101] quit
[SwitchB] vlan 102
[SwitchB-vlan102] port gigabitethernet 1/0/3
[SwitchB-vlan102] quit
[SwitchB] vlan 4093
[SwitchB-vlan4093] port gigabitethernet 1/0/2
[SwitchB-vlan4093] quit
[SwitchB] interface gigabitethernet 1/0/4
[SwitchB-GigabitEthernet1/0/4] port link-type trunk
[SwitchB-GigabitEthernet1/0/4] undo port trunk permit vlan 1
[SwitchB-GigabitEthernet1/0/4] port trunk permit vlan 101 to 102
[SwitchB-GigabitEthernet1/0/4] port trunk pvid vlan 101
[SwitchB-GigabitEthernet1/0/4] quit
# 配置上行接口。
[SwitchB] interface gigabitethernet 1/0/2
[SwitchB-GigabitEthernet1/0/2] undo stp enable
[SwitchB-GigabitEthernet1/0/2] quit
[SwitchB] interface vlan-interface 4093
[SwitchB-Vlan-interface4093] ip address 10.1.2.2 24
# 创建VRRP备份组1。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ip address 10.10.101.3 24
[SwitchB-Vlan-interface101] vrrp vrid 1 virtual-ip 10.10.101.1
[SwitchB–Vlan-interface101] quit
# 创建VRRP备份组2,配置备份组2优先级为110。
[SwitchB] interface vlan-interface 102
[SwitchB-Vlan-interface102] ip address 10.10.102.3 24
[SwitchB-Vlan-interface102] vrrp vrid 1 virtual-ip 10.10.102.1
[SwitchB-Vlan-interface102] vrrp vrid 1 priority 110
# 配置VRRP备份组2监视上行接口。
[SwitchB-Vlan-interface102] vrrp vrid 1 track interface vlan-interface 4093 reduced 20
[SwitchB-Vlan-interface102] quit
# 配置MSTP。
[SwitchB] stp region-configuration
[SwitchB-mst-region] region-name vrrp
[SwitchB-mst-region] instance 1 vlan 101
[SwitchB-mst-region] instance 2 vlan 102
[SwitchB-mst-region] active region-configuration
[SwitchB-mst-region] quit
[SwitchB] stp instance 2 root primary
[SwitchB] stp instance 1 root secondary
[SwitchB] stp enable
(3) 配置Switch C
# 配置VLAN 101。
<SwitchC> system-view
[SwitchC] vlan 101
[SwitchC-vlan101] port gigabitethernet 1/0/1 to gigabitethernet 1/0/2
[SwitchC-vlan101] quit
# 配置MSTP。
[SwitchC] stp region-configuration
[SwitchC-mst-region] region-name vrrp
[SwitchC-mst-region] instance 1 vlan 101
[SwitchC-mst-region] instance 2 vlan 102
[SwitchC-mst-region] active region-configuration
[SwitchC-mst-region] quit
[SwitchC] stp enable
(4) 配置Switch D
# 配置VLAN 102。
<SwitchD> system-view
[SwitchD] vlan 102
[SwitchD-vlan102] port gigabitethernet 1/0/1 to gigabitethernet 1/0/2
[SwitchD-vlan102] quit
# 配置MSTP。
[SwitchD] stp region-configuration
[SwitchD-mst-region] region-name vrrp
[SwitchD-mst-region] instance 1 vlan 101
[SwitchD-mst-region] instance 2 vlan 102
[SwitchD-mst-region] active region-configuration
[SwitchD-mst-region] quit
[SwitchD] stp enable
(5) 配置主机
配置区域A内主机的缺省网关为10.10.101.1,区域B内主机的缺省网关为10.10.102.1,具体配置过程略。
完成配置后用户可以使用display vrrp verbose命令查看备份组的详细信息;同时可以使用display stp brief命令查看各设备上生成树的简要信息。
· Switch A上的配置
#
vlan 101 to 102
#
vlan 4092
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp instance 1 root primary
stp instance 2 root secondary
stp enable
#
interface Vlan-interface101
ip address 10.10.101.2 255.255.255.0
vrrp vrid 1 virtual-ip 10.10.101.1
vrrp vrid 1 priority 110
vrrp vrid 1 track interface Vlan-interface4092 reduced 20
#
interface Vlan-interface102
ip address 10.10.102.2 255.255.255.0
vrrp vrid 1 virtual-ip 10.10.102.1
#
interface Vlan-interface4092
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet1/0/1
port access vlan 101
#
interface GigabitEthernet1/0/2
port access vlan 4092
stp disable
#
interface GigabitEthernet1/0/3
port access vlan 102
#
interface GigabitEthernet1/0/4
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
#
· Switch B上的配置
#
vlan 101 to 102
#
vlan 4093
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp instance 1 root secondary
stp instance 2 root primary
stp enable
#
interface Vlan-interface101
ip address 10.10.101.3 255.255.255.0
vrrp vrid 1 virtual-ip 10.10.101.1
#
interface Vlan-interface102
ip address 10.10.102.3 255.255.255.0
vrrp vrid 1 virtual-ip 10.10.102.1
vrrp vrid 1 priority 110
vrrp vrid 1 track interface Vlan-interface4093 reduced 20
#
interface Vlan-interface4093
ip address 10.1.2.2 255.255.255.0
#
interface GigabitEthernet1/0/1
port access vlan 101
#
interface GigabitEthernet1/0/2
port access vlan 4093
stp disable
#
interface GigabitEthernet1/0/3
port access vlan 102
#
interface GigabitEthernet1/0/4
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
#
· Switch C上的配置
#
vlan 101
#stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp enable
#
interface GigabitEthernet1/0/1
port access vlan 101
#
interface GigabitEthernet1/0/2
port access vlan 101
#
· Switch D上的配置
#
vlan 102
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp enable
#
interface GigabitEthernet1/0/1
port access vlan 102
#
interface GigabitEthernet1/0/2
port access vlan 102
#
表7 配置适用的产品与软件版本关系
产品 |
软件版本 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图7所示,Host A、Host B和Host C所在网络的出口处部署了三台设备。现要求使用VRRP负载均衡功能,将这三台设备组成一台虚拟路由器,作为Host A、Host B和Host C的缺省网关。具体应用需求如下:
· 在正常情况下,Switch A作为VRRP备份组的Master设备,当Switch A自身出现故障时,Switch B优先接替Switch A作为新的Master设备;
· 在正常情况下,Host A通过Switch A访问外部网络,Host B通过Switch B访问外部网络,Host C通过Switch C访问外部网络;
· 当Switch A、Switch B或Switch C自身或其上行接口出现故障时,Host A、Host B和Host C可以通过其他正常运行的设备继续通信,避免通信中断;当Switch A、Switch B或Switch C故障恢复后,继续承担网关功能。
图7 VRRP负载均衡模式配置组网图
· 为了充分利用网关资源,通过一个VRRP备份组实现负载分担,需要创建工作在负载均衡模式的VRRP备份组;
· 为了使Switch A优先与Switch B和Switch C被选举为VRRP备份组的Master设备,需要为其配置高于Switch B和Switch C的优先级;为了使Switch B优先于Switch C被选举为VRRP备份组的Master设备,需要为其配置高于Switch C的优先级;
· 配置VRRP备份组工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 为了避免VRRP备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间;
· 在Switch A、Switch B和Switch C上配置虚拟转发器通过Track项监视上行接口的状态。当上行接口出现故障时,降低该接口所在设备虚拟转发器的权重,以便其他设备接管该设备的转发任务,避免通信中断。
· VRRP工作在负载均衡模式时,虚拟IP地址不能与VRRP备份组中路由器的接口IP地址相同,即负载均衡模式的VRRP备份组中不能存在IP地址拥有者。
· 缺省情况下,虚拟转发器的权重为255;虚拟转发器的失效下限为10。VF Owner的权重高于或等于失效下限时,它的优先级始终为255,不会根据虚拟转发器的权重改变。因此只有配置的权重降低数额能够保证监视的上行链路出现故障时VF Owner的权重低于失效下限,其他的虚拟转发器才能接替VF Owner成为AVF。
· 同一个VRRP备份组的成员设备,如下配置必须保证完全一致:虚拟路由器的IP地址个数、每个备份组虚拟路由器的IP地址、定时器间隔时间和认证方式。
(1) 配置Switch A
# 配置VLAN3。
<SwitchA> system-view
[SwitchA] vlan 3
[SwitchA-vlan3] port gigabitethernet 1/0/3
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ip address 20.1.1.2 24
[SwitchA-Vlan-interface3] quit
# 配置VLAN2。
<SwitchA> system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
# 配置VRRP工作在负载均衡模式。
[SwitchA] vrrp mode load-balance
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.1。
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 10.1.1.2 24
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.1
# 配置Switch A在备份组1中的优先级为120,高于Switch B的优先级110和Switch C的优先级100,以保证Switch A成为Master。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 120
# 配置Switch A工作在抢占方式,以保证Switch A故障恢复后,能再次抢占成为Master,即只要Switch A正常工作,Switch A就会成为Master。为了避免频繁地进行状态切换,配置抢占延迟时间为5秒。
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
[SwitchA-Vlan-interface2] quit
# 创建和VLAN接口3物理状态关联的Track项1。如果Track项的状态为Negative,则说明Switch A的上行接口出现故障。
[SwitchA] track 1 interface vlan-interface 3
# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Switch A上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Switch A的转发任务。本例中,配置虚拟转发器权重降低数额为250。
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] vrrp vrid 1 weight track 1 reduced 250
(2) 配置Switch B
# 配置VLAN3。
<SwitchB> system-view
[SwitchB] vlan 3
[SwitchB-vlan3] port gigabitethernet 1/0/3
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ip address 30.1.1.2 24
[SwitchB-Vlan-interface3] quit
# 配置VLAN2。
<SwitchB> system-view
[SwitchB] vlan 2
[SwitchB-vlan2] port gigabitethernet 1/0/5
[SwitchB-vlan2] quit
# 配置VRRP工作在负载均衡模式。
[SwitchB] vrrp mode load-balance
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.1。
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 10.1.1.3 24
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.1
# 配置Swtich B在备份组1中的优先级为110,高于Switch C的优先级,以保证Switch A出现故障时,Switch B成为Master。
[SwitchB-Vlan-interface2] vrrp vrid 1 priority 110
# 配置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
[SwitchB-Vlan-interface2] quit
# 创建和VLAN接口3物理状态关联的Track项1。如果Track项的状态为Negative,则说明Switch B的上行接口出现故障。
[SwitchB] track 1 interface vlan-interface 3
# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Switch B上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Switch B的转发任务。本例中,配置虚拟转发器权重降低数额为250。
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] vrrp vrid 1 weight track 1 reduced 250
(3) 配置Switch C
# 配置VLAN3。
<SwitchC> system-view
[SwitchC] vlan 3
[SwitchC-vlan3] port gigabitethernet 1/0/3
[SwitchC-vlan3] quit
[SwitchC] interface vlan-interface 3
[SwitchC-Vlan-interface3] ip address 40.1.1.2 24
[SwitchC-Vlan-interface3] quit
# 配置VLAN2。
<SwitchC> system-view
[SwitchC] vlan 2
[SwitchC-vlan2] port gigabitethernet 1/0/5
[SwitchC-vlan2] quit
# 配置VRRP工作在负载均衡模式。
[SwitchC] vrrp mode load-balance
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.1。
[SwitchC] interface vlan-interface 2
[SwitchC-Vlan-interface2] ip address 10.1.1.4 24
[SwitchC-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.1
# 配置Switch C工作在抢占方式,抢占延迟时间为5秒。
[SwitchC-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5
[SwitchC-Vlan-interface2] quit
# 创建和VLAN接口3物理状态关联的Track项1。如果Track项的状态为Negative,则说明Switch C的上行接口出现故障。
[SwitchC] track 1 interface vlan-interface 3
# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Switch C上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Switch C的转发任务。本例中,配置虚拟转发器权重降低数额为250。
[SwitchC] interface vlan-interface 2
[SwitchC-Vlan-interface2] vrrp vrid 1 weight track 1 reduced 250
配置完成后,在Host A上可以ping通外网。通过display vrrp verbose命令查看配置后的结果。
# 显示Switch A上备份组1的详细信息。
[SwitchA-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 120 Running Pri : 120
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : 10.1.1.1
Member IP List : 10.1.1.2 (Local, Master)
10.1.1.3 (Backup)
10.1.1.4 (Backup)
Forwarder Information: 3 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 01
State : Active
Virtual MAC : 000f-e2ff-0011 (Owner)
Owner ID : 0000-5e01-1101
Priority : 255
Active : local
Forwarder 02
State : Listening
Virtual MAC : 000f-e2ff-0012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 127
Active : 10.1.1.3
Forwarder 03
State : Listening
Virtual MAC : 000f-e2ff-0013 (Learnt)
Owner ID : 0000-5e01-1105
Priority : 127
Active : 10.1.1.4
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
# 显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : 10.1.1.1
Member IP List : 10.1.1.3 (Local, Backup)
10.1.1.2 (Master)
10.1.1.4 (Backup)
Forwarder Information: 3 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 01
State : Listening
Virtual MAC : 000f-e2ff-0011 (Learnt)
Owner ID : 0000-5e01-1101
Priority : 127
Active : 10.1.1.2
Forwarder 02
State : Active
Virtual MAC : 000f-e2ff-0012 (Owner)
Owner ID : 0000-5e01-1103
Priority : 255
Active : local
Forwarder 03
State : Listening
Virtual MAC : 000f-e2ff-0013 (Learnt)
Owner ID : 0000-5e01-1105
Priority : 127
Active : 10.1.1.4
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
# 显示Switch C上备份组1的详细信息。
[SwitchC-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : 10.1.1.1
Member IP List : 10.1.1.4 (Local, Backup)
10.1.1.2 (Master)
10.1.1.3 (Backup)
Forwarder Information: 3 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 01
State : Listening
Virtual MAC : 000f-e2ff-0011 (Learnt)
Owner ID : 0000-5e01-1101
Priority : 127
Active : 10.1.1.2
Forwarder 02
State : Listening
Virtual MAC : 000f-e2ff-0012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 127
Active : 10.1.1.3
Forwarder 03
State : Active
Virtual MAC : 000f-e2ff-0013 (Owner)
Owner ID : 0000-5e01-1105
Priority : 255
Active : local
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
以上显示信息表示在备份组1中Switch A为Master,Switch B和Switch C 为Backup。Switch A、Switch B和Switch C上各自存在一个AVF,并存在作为备份的两个LVF。
# 当Switch A的上行接口(VLAN接口3)出现故障后,通过display vrrp verbose命令查看Switch A上备份组的详细信息。
[SwitchA-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 120 Running Pri : 120
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : 10.1.1.1
Member IP List : 10.1.1.2 (Local, Master)
10.1.1.3 (Backup)
10.1.1.4 (Backup)
Forwarder Information: 3 Forwarders 0 Active
Config Weight : 255
Running Weight : 5
Forwarder 01
State : Initialize
Virtual MAC : 000f-e2ff-0011 (Owner)
Owner ID : 0000-5e01-1101
Priority : 0
Active : 10.1.1.4
Forwarder 02
State : Initialize
Virtual MAC : 000f-e2ff-0012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 0
Active : 10.1.1.3
Forwarder 03
State : Initialize
Virtual MAC : 000f-e2ff-0013 (Learnt)
Owner ID : 0000-5e01-1105
Priority : 0
Active : 10.1.1.4
Forwarder Weight Track Information:
Track Object : 1 State : Negative Weight Reduced : 250
# 通过display vrrp verbose命令查看Switch C上备份组的详细信息。
[SwitchC-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : 10.1.1.1
Member IP List : 10.1.1.4 (Local, Backup)
10.1.1.2 (Master)
10.1.1.3 (Backup)
Forwarder Information: 3 Forwarders 2 Active
Config Weight : 255
Running Weight : 255
Forwarder 01
State : Active
Virtual MAC : 000f-e2ff-0011 (Take Over)
Owner ID : 0000-5e01-1101
Priority : 85
Active : local
Redirect Time : 93 secs
Time-out Time : 1293 secs
Forwarder 02
State : Listening
Virtual MAC : 000f-e2ff-0012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 85
Active : 10.1.1.3
Forwarder 03
State : Active
Virtual MAC : 000f-e2ff-0013 (Owner)
Owner ID : 0000-5e01-1105
Priority : 255
Active : local
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
以上显示信息表示Switch A的上行接口出现故障后,Switch A上虚拟转发器的权重降低为5,低于失效下限。Switch A上所有虚拟转发器的状态均变为Initialized,不能再用于转发。Switch C成为虚拟MAC地址000f-e2ff-0011对应虚拟转发器的AVF,接管Switch A的转发任务。
# Timeout Timer超时后(约1800秒后),查看Switch C上备份组的详细信息。
[SwitchC-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : 10.1.1.1
Member IP List : 10.1.1.4 (Local, Backup)
10.1.1.2 (Master)
10.1.1.3 (Backup)
Forwarder Information: 2 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 02
State : Listening
Virtual MAC : 000f-e2ff-0012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 127
Active : 10.1.1.3
Forwarder 03
State : Active
Virtual MAC : 000f-e2ff-0013 (Owner)
Owner ID : 0000-5e01-1105
Priority : 255
Active : local
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
以上显示信息表示,Timeout Timer超时后,删除虚拟MAC地址000f-e2ff-0011对应的虚拟转发器,不再转发目的MAC地址为该MAC的报文。
# Switch A出现故障后,通过display vrrp verbose命令查看Switch B上备份组的详细信息。
[SwitchB-Vlan-interface2] display vrrp verbose
IPv4 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : 10.1.1.1
Member IP List : 10.1.1.3 (Local, Master)
10.1.1.4 (Backup)
Forwarder Information: 2 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 02
State : Active
Virtual MAC : 000f-e2ff-0012 (Owner)
Owner ID : 0000-5e01-1103
Priority : 255
Active : local
Forwarder 03
State : Listening
Virtual MAC : 000f-e2ff-0013 (Learnt)
Owner ID : 0000-5e01-1105
Priority : 127
Active : 10.1.1.4
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
以上显示信息表示Switch A出现故障后,Switch B的优先级高于Switch C,将抢占成为Master。
l Switch A上的配置
#
vrrp mode load-balance
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 10.1.1.2 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.1
vrrp vrid 1 priority 120
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 weight track 1 reduced 250
#
interface Vlan-interface3
ip address 20.1.1.2 255.255.255.0
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
track 1 interface vlan-interface 3
#
l Switch B上的配置
#
vrrp mode load-balance
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 10.1.1.3 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.1
vrrp vrid 1 priority 110
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 weight track 1 reduced 250
#
interface Vlan-interface3
ip address 30.1.1.2 255.255.255.0
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
track 1 interface vlan-interface 3
#
l Switch C上的配置
#
vrrp mode load-balance
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 10.1.1.4 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.1
vrrp vrid 1 preempt-mode timer delay 5
vrrp vrid 1 weight track 1 reduced 250
#
interface Vlan-interface3
ip address 40.1.1.2 255.255.255.0
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
track 1 interface vlan-interface 3
#
本章介绍使用VRRPv3技术提高网络可靠性的典型配置举例。
表8 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1208系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图8所示,Host A所在网络的出口处部署了两台设备。现要求使用VRRPv3单备份组功能,将这两台设备组成一台虚拟路由器,作为Host A的缺省网关。具体应用需求如下:
· 在正常情况下,由Switch A承担网关功能,转发Host A发送至外网的流量;
· 当Switch A或其上行接口出现故障时,由Switch B接替Switch A承担网关功能;当Switch A故障恢复后,由Switch A继续承担网关功能;
· 保护VRRPv3备份组中的设备不受网络中非法VRRPv3报文的影响。
图8 VRRPv3单备份组配置组网图
· 为了使Switch A优先被选举为VRRPv3备份组的Master设备,需要为其配置较高的优先级;
· 配置VRRPv3备份组工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 监视Switch A上行接口的状态,当监测到其上行接口故障时,Switch A的优先级会自动降低指定的数额,使备份组内Switch B的优先级高于Switch A,从而实现主备切换;
· 为了避免VRRPv3备份组中的角色频繁发生变化,可以配置一定的抢占延迟时间;
· VRRPv3备份组认证功能可以保证VRRPv3备份组内的设备仅处理合法的VRRPv3报文。
(1) 配置Switch A
# 全局使能IPv6。
<SwitchA> system-view
[SwitchA] ipv6
# 配置VLAN 3。
[SwitchA] vlan 3
[SwitchA-vlan3] port gigabitethernet 1/0/3
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ipv6 address 2003::2 64
[SwitchA-Vlan-interface3] quit
# 配置VLAN 2。
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ipv6 address fe80::1 link-local
[SwitchA-Vlan-interface2] ipv6 address 1::1 64
# 创建备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和1::10。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip 1::10
# 配置Switch A在备份组1中的优先级为110。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 priority 110
# 设置备份组的认证方式为SIMPLE,认证字为hello。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 authentication-mode simple hello
# 配置Switch A工作在抢占方式,抢占延迟时间为5秒。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 preempt-mode timer delay 5
# 设置监视Switch A连接Internet的VLAN接口3。当被监视的接口不可用时,Switch A的优先级会自动降低30,使备份组内Switch B的优先级高于Switch A,从而实现主备切换。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 track interface vlan-interface 3 reduced 30
# 配置允许发布RA消息,以便Host A通过RA消息学习到缺省网关地址。
[SwitchA-Vlan-interface2] undo ipv6 nd ra halt
(2) 配置Switch B
# 全局使能IPv6。
<SwitchB> system-view
[SwitchB] ipv6
# 配置VLAN 3。
[SwitchB] vlan 3
[SwitchB-vlan3] port gigabitethernet 1/0/3
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ipv6 address 2004::2 64
[SwitchB-Vlan-interface3] quit
# 配置VLAN 2。
[SwitchB] vlan 2
[SwitchB-vlan2] port gigabitethernet 1/0/5
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ipv6 address fe80::2 link-local
[SwitchB-Vlan-interface2] ipv6 address 1::2 64
# 创建备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和1::10。
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip 1::10
# 设置备份组的认证方式为SIMPLE,认证字为hello。
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 authentication-mode simple hello
# 配置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 preempt-mode timer delay 5
# 配置允许发布RA消息,以便Host A通过RA消息学习到缺省网关地址。
[SwitchB-Vlan-interface2] undo ipv6 nd ra halt
(3) 配置主机
配置Host A的缺省网关为1::10/64,具体配置过程略。
配置完成后,在Host A上可以ping通Host B。通过display vrrp ipv6 verbose命令查看配置后的结果。
# 显示Switch A上备份组1的详细信息。
[SwitchA-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : FE80::10
1::10
Virtual MAC : 0000-5e00-0201
Master IP : FE80::1
VRRP Track Information:
Track Interface: Vlan3 State : Up Pri Reduced : 30
# 显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 3600ms left
Auth Type : Simple Key : ******
Virtual IP : FE80::10
1::10
Master IP : FE80::1
以上显示信息表示在备份组1中Switch A为Master设备,Switch B为Backup设备,Host A发送给Host B的报文通过Switch A转发。
Switch A连接Internet的VLAN接口3不可用时,在Host A上仍然可以ping通Host B。通过display vrrp ipv6 verbose命令查看备份组的信息。
# Switch A的VLAN接口3不可用时,显示Switch A上备份组1的详细信息。
[SwitchA-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Backup
Config Pri : 110 Running Pri : 80
Preempt Mode : Yes Delay Time : 5
Become Master : 3600ms left
Auth Type : Simple Key : ******
Virtual IP : FE80::10
1::10
Master IP : FE80::2
VRRP Track Information:
Track Interface: Vlan3 State : Down Pri Reduced : 30
# Switch A的VLAN接口3不可用时,显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Master
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Auth Type : Simple Key : ******
Virtual IP : FE80::10
1::10
Virtual MAC : 0000-5e00-0201
Master IP : FE80::2
以上显示信息表示Switch A的VLAN接口3不可用时,Switch A的优先级降低为80,成为Backup设备,Switch B成为Master设备,Host A发送给Host B的报文通过Switch B转发。
· Switch A上的配置
#
ipv6
#
vlan 2 to 3
#
interface Vlan-interface2
undo ipv6 nd ra halt
ipv6 address 1::1 64
ipv6 address FE80::1 link-local
vrrp ipv6 vrid 1 virtual-ip FE80::10 link-local
vrrp ipv6 vrid 1 virtual-ip 1::10
vrrp ipv6 vrid 1 priority 110
vrrp ipv6 vrid 1 preempt-mode timer delay 5
vrrp ipv6 vrid 1 track interface Vlan-interface3 reduced 30
vrrp ipv6 vrid 1 authentication-mode simple cipher $c$3$bGi6EvJRLUqCKHO7yY9RlrAhcMFWhyzz
#
interface Vlan-interface3
ipv6 address 2003::2/64
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
· Switch B上的配置
#
ipv6
#
vlan 2 to 3
#
interface Vlan-interface2
undo ipv6 nd ra halt
ipv6 address 1::2 64
ipv6 address FE80::2 link-local
vrrp ipv6 vrid 1 virtual-ip FE80::10 link-local
vrrp ipv6 vrid 1 virtual-ip 1::10
vrrp ipv6 vrid 1 preempt-mode timer delay 5
vrrp ipv6 vrid 1 authentication-mode simple cipher $c$3$IL0Gzf/m1E/Hn8eGeniH+LWKHpeAjCyX
#
interface Vlan-interface3
ipv6 address 2004::2/64
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
表9 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1208系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图9所示,局域网的出口处部署了两台设备。现要求使用VRRP功能,将这两台设备组成多台虚拟路由器,分别作为不同VLAN内主机的缺省网关。具体应用需求如下:
· 在正常情况下,VLAN 2内的主机通过Switch A访问外部网络,VLAN 3内的主机通过Switch B访问外部网络;
· 当Switch A或Switch B自身出现故障,或其上行接口出现故障时,局域网内的主机可以通过另一台设备继续通信,避免通信中断;当Switch A或Switch B故障恢复后,继续承担网关功能。
图9 多个VRRPv3备份组负载分担配置组网图
· 为了实现不同VLAN数据的负载分担,需要在Switch A和Switch B上分别创建两个VRRP v3备份组,并配置VLAN 2内的主机都将备份组1作为网关,VLAN 3内的主机都将备份组2作为网关;
· 为使Switch A优先被选举为VRRP备份组1的Master设备,需要为其在VRRPv3备份组1中配置较高的优先级;为使Switch B优先被选举为VRRPv3备份组2的Master设备,需要为其在VRRPv3备份组2中配置较高的优先级;
· 配置两个VRRPv3备份组都工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 监视Switch A和Switch B上行接口的状态,当监测到其上行接口故障时,Switch A或Switch B的优先级会自动降低指定的数额,使VRRPv3备份组1内Switch B的优先级高于Switch A,或VRRPv3备份组2内Switch A的优先级高于Switch B,从而实现主备切换;
· 为了避免VRRPv3备份组中的角色频繁发生变化,可以为两个备份组都配置一定的抢占延迟时间。
· 在实际组网应用中,一般都使用多备份组。IPv6网络中,主机需要手动配置默认网关才能实现VRRP备份组负载分担的功能。
· 同一个VRRP备份组的成员设备,如下配置必须保证完全一致:虚拟路由器的IP地址个数、每个备份组虚拟路由器的IP地址、定时器间隔时间和认证方式。
(1) 配置Switch A
# 全局使能IPv6。
<SwitchA> system-view
[SwitchA] ipv6
# 配置VLAN 4。
<SwitchA> system-view
[SwitchA] vlan 4
[SwitchA-vlan4] port gigabitethernet 1/0/7
[SwitchA-vlan4] quit
[SwitchA] interface vlan-interface 4
[SwitchA-Vlan-interface4] ipv6 address 2000::2 64
[SwitchA-Vlan-interface4] quit
# 配置VLAN 2。
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ipv6 address fe80::1 link-local
[SwitchA-Vlan-interface2] ipv6 address 1::1 64
# 创建备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和1::10。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip 1::10
# 设置Switch A在备份组1中的优先级为110。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 priority 110
# 设置Switch A工作在抢占方式,抢占延迟时间为5秒。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 preempt-mode timer delay 5
# 设置监视Switch A连接Internet的VLAN接口4。当被监视的接口DOWN掉时,Switch A的优先级会自动降低30,使备份组内Switch B的优先级高于Switch A,从而实现主备切换。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 track interface vlan-interface 4 reduced 30
# 配置允许发布RA消息,以便VLAN 2内主机通过RA消息学习到缺省网关地址。
[SwitchA-Vlan-interface2] undo ipv6 nd ra halt
[SwitchA-Vlan-interface2] quit
# 配置VLAN 3。
[SwitchA] vlan 3
[SwitchA-vlan3] port gigabitethernet 1/0/6
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ipv6 address fe90::1 link-local
[SwitchA-Vlan-interface3] ipv6 address 2::1 64
# 创建备份组2,并配置备份组2的虚拟IPv6地址为FE90::10和2::10。
[SwitchA-Vlan-interface3] vrrp ipv6 vrid 2 virtual-ip fe90::10 link-local
[SwitchA-Vlan-interface3] vrrp ipv6 vrid 2 virtual-ip 2::10
# 设置Switch A工作在抢占方式,抢占延迟时间为5秒。
[SwitchA-Vlan-interface3] vrrp ipv6 vrid 2 preempt-mode timer delay 5
# 配置允许发布RA消息,以便VLAN 3内主机通过RA消息学习到缺省网关地址。
[SwitchA-Vlan-interface3] undo ipv6 nd ra halt
(2) 配置Switch B
# 全局使能IPv6。
<SwitchB> system-view
[SwitchB] ipv6
# 配置VLAN 4。
<SwitchB> system-view
[SwitchB] vlan 4
[SwitchB-vlan4] port gigabitethernet 1/0/7
[SwitchB-vlan4] quit
[SwitchB] interface vlan-interface 4
[SwitchB-Vlan-interface4] ipv6 address 2001::2 64
[SwitchB-Vlan-interface4] quit
# 配置VLAN 2。
[SwitchB-vlan2] port gigabitethernet 1/0/5
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ipv6 address fe80::2 link-local
[SwitchB-Vlan-interface2] ipv6 address 1::2 64
# 创建备份组1,并配置备份组1的虚拟IPv6地址为FE80::10和1::10。
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip 1::10
# 设置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 preempt-mode timer delay 5
# 配置允许发布RA消息,以便VLAN 2内主机通过RA消息学习到缺省网关地址。
[SwitchB-Vlan-interface2] undo ipv6 nd ra halt
[SwitchB-Vlan-interface2] quit
# 配置VLAN 3。
[SwitchB] vlan 3
[SwitchB-vlan3] port gigabitethernet 1/0/6
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ipv6 address fe90::2 link-local
[SwitchB-Vlan-interface3] ipv6 address 2::2 64
# 创建备份组2,并配置备份组2的虚拟IPv6地址为FE90::10和2::10。
[SwitchB-Vlan-interface3] vrrp ipv6 vrid 2 virtual-ip fe90::10 link-local
[SwitchB-Vlan-interface3] vrrp ipv6 vrid 2 virtual-ip 2::10
# 设置Switch B在备份组2中的优先级为110。
[SwitchB-Vlan-interface3] vrrp ipv6 vrid 2 priority 110
# 设置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface3] vrrp ipv6 vrid 2 preempt-mode timer delay 5
# 设置监视Switch B连接Internet的VLAN接口4。当被监视的接口DOWN掉时,Switch B的优先级会自动降低30,使备份组内Switch A的优先级高于Switch B,从而实现主备切换。
[SwitchB-Vlan-interface3] vrrp ipv6 vrid 2 track interface vlan-interface 4 reduced 30
# 配置允许发布RA消息,以便VLAN 3内主机通过RA消息学习到缺省网关地址。
[SwitchB-Vlan-interface3] undo ipv6 nd ra halt
(3) 配置主机
配置VLAN 2内主机的缺省网关为1::10/64,VLAN 3内主机的缺省网关为2::10/64,具体配置过程略。
可以通过display vrrp ipv6 verbose命令查看配置后的结果。
# 显示Switch A上备份组的详细信息。
[SwitchA-Vlan-interface3] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : FE80::10
1::10
Virtual MAC : 0000-5e00-0201
Master IP : FE80::1
VRRP Track Information:
Track Interface: Vlan4 State : Up Pri Reduced : 30
Interface Vlan-interface3
VRID : 2 Adver Timer : 100
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 3600ms left
Auth Type : None
Virtual IP : FE90::10
2::10
Master IP : FE90::2
# 显示Switch B上备份组的详细信息。
[SwitchB-Vlan-interface3] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 3600ms left
Auth Type : None
Virtual IP : FE80::10
1::10
Master IP : FE80::1
Interface Vlan-interface3
VRID : 2 Adver Timer : 100
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : FE90::10
2::10
Virtual MAC : 0000-5e00-0202
Master IP : FE90::2
VRRP Track Information:
Track Interface: Vlan4 State : Up Pri Reduced : 30
以上显示信息表示在备份组1中Switch A为Master设备,Switch B为Backup设备,缺省网关为1::10/64的主机通过Switch A访问Internet;备份组2中Switch A为Backup设备,Switch B为Master设备,缺省网关为2::10/64的主机通过Switch B访问Internet。
Switch A出现故障后,再次通过display vrrp verbose命令查看Switch B上备份组的详细信息。
# Switch A出现故障后,显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface3] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Master
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : FE80::10
1::10
Virtual MAC : 0000-5e00-0201
Master IP : FE80::2
Interface Vlan-interface3
VRID : 2 Adver Timer : 100
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : FE90::10
2::10
Virtual MAC : 0000-5e00-0202
Master IP : FE90::2
VRRP Track Information:
Track Interface: Vlan4 State : Up Pri Reduced : 30
以上显示信息表示Switch A出现故障后,Switch B成为VRRPv3备份组1的Master设备,VLAN 2内的主机发送给外网的报文改为通过Switch B转发。
· Switch A上的配置
#
ipv6
#
vlan 2 to 4
#
interface Vlan-interface2
undo ipv6 nd ra halt
ipv6 address 1::1 64
ipv6 address FE80::1 link-local
vrrp ipv6 vrid 1 virtual-ip FE80::10 link-local
vrrp ipv6 vrid 1 virtual-ip 1::10
vrrp ipv6 vrid 1 priority 110
vrrp ipv6 vrid 1 preempt-mode timer delay 5
vrrp ipv6 vrid 1 track interface Vlan-interface4 reduced 30
#
interface Vlan-interface3
undo ipv6 nd ra halt
ipv6 address 2::1 64
ipv6 address FE90::1 link-local
vrrp ipv6 vrid 2 virtual-ip FE90::10 link-local
vrrp ipv6 vrid 2 virtual-ip 2::10
vrrp ipv6 vrid 2 preempt-mode timer delay 5
#
interface Vlan-interface4
ipv6 address 2000::2/64
#
interface GigabitEthernet1/0/5
port access vlan 2
#
interface GigabitEthernet1/0/6
port access vlan 3
#
interface GigabitEthernet1/0/7
port access vlan 4
#
· Switch B上的配置
#
ipv6
#
vlan 2 to 4
#
interface Vlan-interface2
undo ipv6 nd ra halt
ipv6 address 1::2 64
ipv6 address FE80::2 link-local
vrrp ipv6 vrid 1 virtual-ip FE80::10 link-local
vrrp ipv6 vrid 1 virtual-ip 1::10
vrrp ipv6 vrid 1 preempt-mode timer delay 5
#
interface Vlan-interface3
undo ipv6 nd ra halt
ipv6 address 2::2 64
ipv6 address FE90::2 link-local
vrrp ipv6 vrid 2 virtual-ip FE90::20 link-local
vrrp ipv6 vrid 2 virtual-ip 2::10
vrrp ipv6 vrid 2 priority 110
vrrp ipv6 vrid 2 preempt-mode timer delay 5
vrrp ipv6 vrid 2 track interface Vlan-interface4 reduced 30
#
interface Vlan-interface4
ipv6 address 2001::2/64
#
interface GigabitEthernet1/0/5
port access vlan 2
#
interface GigabitEthernet1/0/6
port access vlan 3
#
interface GigabitEthernet1/0/7
port access vlan 4
#
表10 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1208系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图10所示,区域A和区域B用户所在网络的出口处部署了两台设备。现要求使用VRRPv3功能,将这两台设备组成多台虚拟路由器,分别作为不同VLAN内主机的缺省网关。具体应用需求如下:
· 在正常情况下,区域A用户通过接入设备Switch C的GE1/0/1端口将数据发送给网关设备Switch A进行数据转发;区域B用户通过接入设备Switch D的GE1/0/1端口将数据发送给网关设备Switch B进行数据转发;
· 当Switch A或Switch B自身出现故障,或其上行接口出现故障时,局域网中的主机可以通过另一台设备继续通信,避免通信中断;当Switch A或Switch B故障恢复后,继续承担网关功能;
· 当Switch A或Switch B的下线链路出现故障时,局域网中的主机通过接入设备Switch C或Switch D的GE1/0/2端口将数据转发给网关设备继续通信,避免通信中断;当Switch A或Switch B的下线链路故障恢复后,继续由Switch C或Switch D的GE1/0/1端口将数据发送给网关设备。
图10 VRRPv3多备份组与MSTP混合组网图
· 为了实现不同区域中用户数据流的负载分担,需要在Switch A和Switch B上分别创建两个VRRPv3备份组,并配置二层交换机Switch C连接的主机都将VRRPv3备份组1作为网关,二层交换机Switch D连接的主机都将VRRPv3备份组2作为网关;
· 为使Switch A优先被选举为VRRPv3备份组1的Master设备,需要为其在VRRPv3备份组1中配置较高的优先级;为使Switch B优先被选举为VRRPv3备份组2的Master设备,需要为其在VRRPv3备份组2中配置较高的优先级;
· 配置两个VRRPv3备份组都工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 监视Switch A或Switch B上行接口的状态,当监测到其上行接口故障时,Switch A或Switch B的优先级会自动降低指定的数额,使VRRP备份组1内Switch B的优先级高于Switch A,或VRRP备份组2内Switch A的优先级高于Switch B,从而实现主备切换;
· 利用MSTP多实例技术避免二层环路。将VLAN 101映射到MSTP实例1中;将VLAN 102映射到MSTP实例2中。保证正常情况下,MSTP实例1中的流量通过Switch C的GE1/0/1端口转发,MSTP实例2中的流量通过Switch D的GE1/0/1端口转发(如图10所示)。
(1) 配置Switch A
# 全局使能IPv6。
<SwitchA> system-view
[SwitchA] ipv6
# 配置VLAN 101、VLAN 102和VLAN 4092。两设备间采用trunk口直连。
[SwitchA] vlan 101
[SwitchA-vlan101] port gigabitethernet 1/0/1
[SwitchA-vlan101] quit
[SwitchA] vlan 102
[SwitchA-vlan102] port gigabitethernet 1/0/3
[SwitchA-vlan102] quit
[SwitchA] vlan 4092
[SwitchA-vlan4092] port gigabitethernet 1/0/2
[SwitchA-vlan4092] quit
[SwitchA] interface gigabitethernet 1/0/4
[SwitchA-GigabitEthernet1/0/4] port link-type trunk
[SwitchA-GigabitEthernet1/0/4] undo port trunk permit vlan 1
[SwitchA-GigabitEthernet1/0/4] port trunk permit vlan 101 to 102
[SwitchA-GigabitEthernet1/0/4] port trunk pvid vlan 101
[SwitchA-GigabitEthernet1/0/4] quit
# 配置上行接口。
[SwitchA] interface gigabitethernet 1/0/2
[SwitchA-GigabitEthernet1/0/2] undo stp enable
[SwitchA-GigabitEthernet1/0/2] quit
[SwitchA] interface vlan-interface 4092
[SwitchA-Vlan-interface4092] ipv6 address 2003::2 64
# 创建VRRP备份组1。
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ipv6 address fe80::2 link-local
[SwitchA-Vlan-interface101] ipv6 address 2001::2 64
[SwitchA-Vlan-interface101] vrrp ipv6 vrid 1 virtual-ip FE80::1 link-local
[SwitchA-Vlan-interface101] vrrp ipv6 vrid 1 virtual-ip 2001::1
# 配置备份组1优先级为110。
[SwitchA-Vlan-interface101] vrrp ipv6 vrid 1 priority 110
# 配置监视上行接口。
[SwitchA-Vlan-interface101] vrrp ipv6 vrid 1 track interface vlan-interface 4092 reduced 20
# 配置允许发布RA消息。
[SwitchA-Vlan-interface101] undo ipv6 nd ra halt
[SwitchA-Vlan-interface101] quit
# 创建VRRP备份组2。
[SwitchA] interface vlan-interface 102
[SwitchA-Vlan-interface102] ipv6 address fe90::2 link-local
[SwitchA-Vlan-interface102] ipv6 address 2002::2 64
[SwitchA-Vlan-interface102] vrrp ipv6 vrid 1 virtual-ip FE90::1 link-local
[SwitchA-Vlan-interface102] vrrp ipv6 vrid 1 virtual-ip 2002::1
# 配置允许发布RA消息。
[SwitchA-Vlan-interface102] undo ipv6 nd ra halt
[SwitchA-Vlan-interface102] quit
# 配置MSTP。
[SwitchA] stp region-configuration
[SwitchA-mst-region] region-name vrrp
[SwitchA-mst-region] instance 1 vlan 101
[SwitchA-mst-region] instance 2 vlan 102
[SwitchA-mst-region] active region-configuration
[SwitchA-mst-region] quit
[SwitchA] stp instance 1 root primary
[SwitchA] stp instance 2 root secondary
[SwitchA] stp enable
(2) 配置Switch B
# 全局使能IPv6
<SwitchB> system-view
[SwitchB] ipv6
# 配置VLAN 101、VLAN 102和VLAN 4093。两设备间采用trunk口直连。
[SwitchB] vlan 101
[SwitchB-vlan101] port gigabitethernet 1/0/1
[SwitchB-vlan101] quit
[SwitchB] vlan 102
[SwitchB-vlan102] port gigabitethernet 1/0/3
[SwitchB-vlan102] quit
[SwitchB] vlan 4093
[SwitchB-vlan4093] port gigabitethernet 1/0/2
[SwitchB-vlan4093] quit
[SwitchB] interface gigabitethernet 1/0/4
[SwitchB-GigabitEthernet1/0/4] port link-type trunk
[SwitchB-GigabitEthernet1/0/4] undo port trunk permit vlan 1
[SwitchB-GigabitEthernet1/0/4] port trunk permit vlan 101 to 102
[SwitchB-GigabitEthernet1/0/4] port trunk pvid vlan 101
[SwitchB-GigabitEthernet1/0/4] quit
# 配置上行接口。
[SwitchB] interface gigabitethernet 1/0/2
[SwitchB-GigabitEthernet1/0/2] undo stp enable
[SwitchB-GigabitEthernet1/0/2] quit
[SwitchB] interface vlan-interface 4093
[SwitchB-Vlan-interface4093] ipv6 address 2004::2 64
# 创建VRRP备份组1。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ipv6 address fe80::3 link-local
[SwitchB-Vlan-interface101] ipv6 address 2001::3 64
[SwitchB-Vlan-interface101] vrrp ipv6 vrid 1 virtual-ip FE80::1 link-local
[SwitchB-Vlan-interface101] vrrp ipv6 vrid 1 virtual-ip 2001::1
# 配置允许发布RA消息。
[SwitchB-Vlan-interface101] undo ipv6 nd ra halt
[SwitchB-Vlan-interface101] quit
# 创建VRRP备份组2。
[SwitchB] interface vlan-interface 102
[SwitchB-Vlan-interface102] ipv6 address fe90::3 link-local
[SwitchB-Vlan-interface102] ipv6 address 2002::3 64
[SwitchB-Vlan-interface102] vrrp ipv6 vrid 1 virtual-ip FE90::1 link-local
[SwitchB-Vlan-interface102] vrrp ipv6 vrid 1 virtual-ip 2002::1
# 配置备份组2优先级为110。
[SwitchB-Vlan-interface102] vrrp ipv6 vrid 1 priority 110
# 配置监视上行接口。
[SwitchB-Vlan-interface102] vrrp ipv6 vrid 1 track interface vlan-interface 4093 reduced 20
# 配置允许发布RA消息。
[SwitchB-Vlan-interface102] undo ipv6 nd ra halt
[SwitchB-Vlan-interface102] quit
# 配置MSTP。
[SwitchB] stp region-configuration
[SwitchB-mst-region] region-name vrrp
[SwitchB-mst-region] instance 1 vlan 101
[SwitchB-mst-region] instance 2 vlan 102
[SwitchB-mst-region] active region-configuration
[SwitchB-mst-region] quit
[SwitchB] stp instance 2 root primary
[SwitchB] stp instance 1 root secondary
[SwitchB] stp enable
(3) 配置Switch C
# 配置VLAN 101。
<SwitchC> system-view
[SwitchC] vlan 101
[SwitchC-vlan101] port gigabitethernet 1/0/1 to gigabitethernet 1/0/2
[SwitchC-vlan101] quit
# 配置MSTP。
[SwitchC] stp region-configuration
[SwitchC-mst-region] region-name vrrp
[SwitchC-mst-region] instance 1 vlan 101
[SwitchC-mst-region] instance 2 vlan 102
[SwitchC-mst-region] active region-configuration
[SwitchC-mst-region] quit
[SwitchC] stp enable
(4) 配置Switch D
# 配置VLAN 102。
<SwitchD> system-view
[SwitchD] vlan 102
[SwitchD-vlan102] port gigabitethernet 1/0/1 to gigabitethernet 1/0/2
[SwitchD-vlan102] quit
# 配置MSTP。
[SwitchD] stp region-configuration
[SwitchD-mst-region] region-name vrrp
[SwitchD-mst-region] instance 1 vlan 101
[SwitchD-mst-region] instance 2 vlan 102
[SwitchD-mst-region] active region-configuration
[SwitchD-mst-region] quit
[SwitchD] stp enable
(5) 配置主机
配置区域A内主机的缺省网关为2001::1,区域B内主机的缺省网关为2002::1,具体配置过程略。
完成配置后用户可以使用display vrrp ipv6 verbose命令查看备份组的详细信息;同时可以使用display stp brief命令查看各设备上生成树的简要信息。
· Switch A上的配置
#
ipv6
#
vlan 101 to 102
#
vlan 4092
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp instance 1 root primary
stp instance 2 root secondary
stp enable
#
interface Vlan-interface101
undo ipv6 nd ra halt
ipv6 address 2001::2/64
ipv6 address FE80::2 link-local
vrrp ipv6 vrid 1 virtual-ip FE80::1 link-local
vrrp ipv6 vrid 1 virtual-ip 2001::1
vrrp ipv6 vrid 1 priority 110
vrrp ipv6 vrid 1 track interface Vlan-interface4092 reduced 20
#
interface Vlan-interface102
undo ipv6 nd ra halt
ipv6 address 2002::2 64
ipv6 address FE90::2 link-local
vrrp ipv6 vrid 1 virtual-ip FE90::1 link-local
vrrp ipv6 vrid 1 virtual-ip 2002::1
#
interface Vlan-interface4092
ipv6 address 2003::2/64
#
interface GigabitEthernet1/0/1
port access vlan 101
#
interface GigabitEthernet1/0/2
port access vlan 4092
stp disable
#
interface GigabitEthernet1/0/3
port access vlan 102
#
interface GigabitEthernet1/0/4
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
#
· Switch B上的配置
#
ipv6
#
vlan 101 to 102
#
vlan 4093
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp instance 1 root secondary
stp instance 2 root primary
stp enable
#
interface Vlan-interface101
undo ipv6 nd ra halt
ipv6 address 2001::3 64
ipv6 address FE80::3 link-local
vrrp ipv6 vrid 1 virtual-ip FE80::1 link-local
vrrp ipv6 vrid 1 virtual-ip 2001::1
#
interface Vlan-interface102
undo ipv6 nd ra halt
ipv6 address 2002::3 64
ipv6 address FE90::3 link-local
vrrp ipv6 vrid 2 virtual-ip FE90::1 link-local
vrrp ipv6 vrid 1 virtual-ip 2002::1
vrrp ipv6 vrid 2 priority 110
vrrp ipv6 vrid 1 track interface Vlan-interface4093 reduced 20
#
interface Vlan-interface4093
ipv6 address 2004::2/64
#
interface GigabitEthernet1/0/1
port access vlan 101
#
interface GigabitEthernet1/0/2
port access vlan 4093
stp disable
#
interface GigabitEthernet1/0/3
port access vlan 102
#
interface GigabitEthernet1/0/4
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 101 to 102
port trunk pvid vlan 101
#
· Switch C上的配置
#
vlan 101
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp enable
#
interface GigabitEthernet1/0/1
port access vlan 101
#
interface GigabitEthernet1/0/2
port access vlan 101
#
· Switch D上的配置
#
vlan 102
#
stp region-configuration
region-name vrrp
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
stp enable
#
interface GigabitEthernet1/0/1
port access vlan 102
#
interface GigabitEthernet1/0/2
port access vlan 102
#
表11 配置适用的产品与软件版本关系
产品 |
软件版本 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图11所示,Host A、Host B和Host C所在网络的出口处部署了三台设备。现要求使用VRRPv3负载均衡功能,将这三台设备组成一台虚拟路由器,作为Host A、Host B和Host C的缺省网关。具体应用需求如下:
· 在正常情况下,Switch A作为VRRPv3备份组的Master设备,当Switch A自身出现故障时,Switch B优先接替Switch A作为新的Master设备;
· 在正常情况下,Host A通过Switch A访问外部网络,Host B通过Switch B访问外部网络,Host C通过Switch C访问外部网络;
· 当Switch A、Switch B或Switch C自身或其上行接口出现故障时,Host A、Host B和Host C可以通过其他正常运行的设备继续通信,避免通信中断;当Switch A、Switch B或Switch C故障恢复后,继续承担网关功能。
图11 VRRP负载均衡模式配置组网图
· 为了充分利用网关资源,通过一个VRRPv3备份组实现负载分担,需要创建工作在负载均衡模式的VRRPv3备份组;
· 为了使Switch A优先与Switch B和Switch C被选举为VRRPv3备份组的Master设备,需要为其配置高于Switch B和Switch C的优先级;为了使Switch B优先于Switch C被选举为VRRPv3备份组的Master设备,需要为其配置高于Switch C的优先级;
· 配置VRRPv3备份组工作在抢占模式,以保证原Master设备故障恢复后,能再次抢占成为Master;
· 为了避免VRRPv3中的角色频繁发生变化,可以配置一定的抢占延迟时间;
l 在Switch A、Switch B和Switch C上配置虚拟转发器通过Track项监视上行接口的状态。当上行接口出现故障时,降低该接口所在设备虚拟转发器的权重,以便其他设备接管该设备的转发任务,避免通信中断。
l VRRP工作在负载均衡模式时,虚拟IPv6地址不能与VRRP备份组中路由器的接口IPv6地址相同,即负载均衡模式的VRRP备份组中不能存在IP地址拥有者。
l 缺省情况下,虚拟转发器的权重为255;虚拟转发器的失效下限为10。VF Owner的权重高于或等于失效下限时,它的优先级始终为255,不会根据虚拟转发器的权重改变。因此只有配置的权重降低数额能够保证监视的上行链路出现故障时VF Owner的权重低于失效下限,其他的虚拟转发器才能接替VF Owner成为AVF。
l 同一个VRRP备份组的成员设备,如下配置必须保证完全一致:虚拟路由器的IP地址个数、每个备份组虚拟路由器的IP地址、定时器间隔时间和认证方式。
(1) 配置Switch A
# 全局使能IPv6。
<SwitchA> system-view
[SwitchA] ipv6
# 配置VLAN3。
<SwitchA> system-view
[SwitchA] vlan 3
[SwitchA-vlan3] port gigabitethernet 1/0/3
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ipv6 address 2003::2 64
[SwitchA-Vlan-interface3] quit
# 配置VLAN2。
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
# 配置VRRP工作在负载均衡模式。
[SwitchA] vrrp mode load-balance
# 创建备份组1,并配置备份组1的虚拟IP地址为FE80::10和1::10。
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ipv6 address fe80::1 link-local
[SwitchA-Vlan-interface2] ipv6 address 1::1 64
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip 1::10
# 配置Switch A在备份组1中的优先级为120,高于Switch B的优先级110和Switch C的优先级100,以保证Switch A成为Master。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 priority 120
# 配置Switch A工作在抢占方式,以保证Switch A故障恢复后,能再次抢占成为Master。为了避免频繁地进行状态切换,配置抢占延迟时间为5秒。
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 preempt-mode timer delay 5
# 配置允许发布RA消息,以便1::/64网段内主机通过RA消息学习到缺省网关地址。
[SwitchA-Vlan-interface2] undo ipv6 nd ra halt
[SwitchA-Vlan-interface2] quit
# 创建和VLAN接口3物理状态关联的Track项1。如果Track项的状态为Negative,则说明Switch A的上行接口出现故障。
[SwitchA] track 1 interface vlan-interface 3
# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Switch A上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Switch A的转发任务。本例中,配置虚拟转发器权重降低数额为250。
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] vrrp ipv6 vrid 1 weight track 1 reduced 250
(2) 配置Switch B
# 全局使能IPv6。
<SwitchB> system-view
[SwitchB] ipv6
# 配置VLAN3。
<SwitchB> system-view
[SwitchB] vlan 3
[SwitchB-vlan3] port gigabitethernet 1/0/3
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ipv6 address 2004::2 64
[SwitchB-Vlan-interface3] quit
# 配置VLAN2。
<SwitchB> system-view
[SwitchB] vlan 2
[SwitchB-vlan2] port gigabitethernet 1/0/5
[SwitchB-vlan2] quit
# 配置VRRP工作在负载均衡模式。
[SwitchB] vrrp mode load-balance
# 创建备份组1,并配置备份组1的虚拟IP地址为FE80::10和1::10。
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ipv6 address fe80::2 link-local
[SwitchB-Vlan-interface2] ipv6 address 1::2 64
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip 1::10
# 配置Swtich B在备份组1中的优先级为110,高于Switch C的优先级100,以保证Switch A出现故障时,Switch B成为Master。
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 priority 110
# 配置Switch B工作在抢占方式,抢占延迟时间为5秒。
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 preempt-mode timer delay 5
# 配置允许发布RA消息,以便1::/64网段内主机通过RA消息学习到缺省网关地址。
[SwitchB-Vlan-interface2] undo ipv6 nd ra halt
[SwitchB-Vlan-interface2] quit
# 创建和VLAN接口3物理状态关联的Track项1。如果Track项的状态为Negative,则说明Switch B的上行接口出现故障。
[SwitchB] track 1 interface vlan-interface 3
# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Switch B上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Switch B的转发任务。本例中,配置虚拟转发器权重降低数额为250。
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] vrrp ipv6 vrid 1 weight track 1 reduced 250
(3) 配置Switch C
# 全局使能IPv6。
<SwitchC> system-view
[SwitchC] ipv6
# 配置VLAN3。
<SwitchC> system-view
[SwitchC] vlan 3
[SwitchC-vlan3] port gigabitethernet 1/0/3
[SwitchC-vlan3] quit
[SwitchC] interface vlan-interface 3
[SwitchC-Vlan-interface3] ipv6 address 2005::2 64
[SwitchC-Vlan-interface3] quit
# 配置VLAN2。
<SwitchC> system-view
[SwitchC] vlan 2
[SwitchC-vlan2] port gigabitethernet 1/0/5
[SwitchC-vlan2] quit
# 配置VRRP工作在负载均衡模式。
[SwitchC] vrrp mode load-balance
# 创建备份组1,并配置备份组1的虚拟IP地址为FE80::10和1::10。
[SwitchC] interface vlan-interface 2
[SwitchC-Vlan-interface2] ipv6 address fe80::3 link-local
[SwitchC-Vlan-interface2] ipv6 address 1::3 64
[SwitchC-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip fe80::10 link-local
[SwitchC-Vlan-interface2] vrrp ipv6 vrid 1 virtual-ip 1::10
# 配置Switch C工作在抢占方式,抢占延迟时间为5秒。
[SwitchC-Vlan-interface2] vrrp ipv6 vrid 1 preempt-mode timer delay 5
# 配置允许发布RA消息,以便1::/64网段内主机通过RA消息学习到缺省网关地址。
[SwitchC-Vlan-interface2] undo ipv6 nd ra halt
[SwitchC-Vlan-interface2] quit
# 创建和VLAN接口3物理状态关联的Track项1。如果Track项的状态为Negative,则说明Switch C的上行接口出现故障。
[SwitchC] track 1 interface vlan-interface 3
# 配置虚拟转发器监视Track项1。Track项的状态为Negative时,降低Switch C上虚拟转发器的权重,使其低于失效下限10,即权重降低的数额大于245,以便其他设备接替Switch C的转发任务。本例中,配置虚拟转发器权重降低数额为250。
[SwitchC] interface vlan-interface 2
[SwitchC-Vlan-interface2] vrrp ipv6 vrid 1 weight track 1 reduced 250
配置完成后,在Host A上可以ping通外网。通过display vrrp ipv6 verbose命令查看配置后的结果。
# 显示Switch A上备份组1的详细信息。
[SwitchA-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Master
Config Pri : 120 Running Pri : 120
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : FE80::10
1::10
Member IP List : FE80::1 (Local, Master)
FE80::2 (Backup)
FE80::3 (Backup)
Forwarder Information: 3 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 01
State : Active
Virtual MAC : 000f-e2ff-4011 (Owner)
Owner ID : 0000-5e01-1101
Priority : 255
Active : local
Forwarder 02
State : Listening
Virtual MAC : 000f-e2ff-4012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 127
Active : FE80::2
Forwarder 03
State : Listening
Virtual MAC : 000f-e2ff-4013 (Learnt)
Owner ID : 0000-5e01-1105
Priority : 127
Active : FE80::3
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
# 显示Switch B上备份组1的详细信息。
[SwitchB-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Backup
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : FE80::10
1::10
Member IP List : FE80::2 (Local, Backup)
FE80::1 (Master)
FE80::3 (Backup)
Forwarder Information: 3 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 01
State : Listening
Virtual MAC : 000f-e2ff-4011 (Learnt)
Owner ID : 0000-5e01-1101
Priority : 127
Active : FE80::1
Forwarder 02
State : Active
Virtual MAC : 000f-e2ff-4012 (Owner)
Owner ID : 0000-5e01-1103
Priority : 255
Active : local
Forwarder 03
State : Listening
Virtual MAC : 000f-e2ff-4013 (Learnt)
Owner ID : 0000-5e01-1105
Priority : 127
Active : FE80::3
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
# 显示Switch C上备份组1的详细信息。
[SwitchC-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : FE80::10
1::10
Member IP List : FE80::3 (Local, Backup)
FE80::1 (Master)
FE80::2 (Backup)
Forwarder Information: 3 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 01
State : Listening
Virtual MAC : 000f-e2ff-4011 (Learnt)
Owner ID : 0000-5e01-1101
Priority : 127
Active : FE80::1
Forwarder 02
State : Listening
Virtual MAC : 000f-e2ff-4012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 127
Active : FE80::2
Forwarder 03
State : Active
Virtual MAC : 000f-e2ff-4013 (Owner)
Owner ID : 0000-5e01-1105
Priority : 255
Active : local
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
以上显示信息表示在备份组1中Switch A为Master设备,Switch B和Switch C 为Backup设备。Switch A、Switch B和Switch C上各自存在一个AVF,并存在作为备份的两个LVF。
# 当Switch A的上行接口(VLAN接口3)出现故障后,通过display vrrp ipv6 verbose命令查看Switch A上备份组的详细信息。
[SwitchA-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 120 Running Pri : 120
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : FE80::10
1::10
Member IP List : FE80::1 (Local, Master)
FE80::2 (Backup)
FE80::3 (Backup)
Forwarder Information: 3 Forwarders 0 Active
Config Weight : 255
Running Weight : 5
Forwarder 01
State : Initialize
Virtual MAC : 000f-e2ff-4011 (Owner)
Owner ID : 0000-5e01-1101
Priority : 0
Active : FE80::3
Forwarder 02
State : Initialize
Virtual MAC : 000f-e2ff-4012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 0
Active : FE80::2
Forwarder 03
State : Initialize
Virtual MAC : 000f-e2ff-4013 (Learnt)
Owner ID : 0000-5e01-1105
Priority : 0
Active : FE80::3
Forwarder Weight Track Information:
Track Object : 1 State : Negative Weight Reduced : 250
# 通过display vrrp ipv6 verbose命令查看Switch C上备份组的详细信息。
[SwitchC-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : FE80::10
1::10
Member IP List : FE80::3 (Local, Backup)
FE80::1 (Master)
FE80::2 (Backup)
Forwarder Information: 3 Forwarders 2 Active
Config Weight : 255
Running Weight : 255
Forwarder 01
State : Active
Virtual MAC : 000f-e2ff-4011 (Take Over)
Owner ID : 0000-5e01-1101
Priority : 85
Active : local
Redirect Time : 93 secs
Time-out Time : 1293 secs
Forwarder 02
State : Listening
Virtual MAC : 000f-e2ff-4012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 85
Active : FE80::2
Forwarder 03
State : Active
Virtual MAC : 000f-e2ff-4013 (Owner)
Owner ID : 0000-5e01-1105
Priority : 255
Active : local
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
以上显示信息表示Switch A的上行接口出现故障后,Switch A上虚拟转发器的权重降低为5,低于失效下限。Switch A上所有虚拟转发器的状态均变为Initialized,不能再用于转发。Switch C成为虚拟MAC地址000f-e2ff-0011对应虚拟转发器的AVF,接管Switch A的转发任务。
# Timeout Timer超时后(约1800秒后),查看Switch C上备份组的详细信息。
[SwitchC-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 5
Become Master : 2200ms left
Auth Type : None
Virtual IP : FE80::10
1::10
Member IP List : FE80::3 (Local, Backup)
FE80::1 (Master)
FE80::2 (Backup)
Forwarder Information: 2 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 02
State : Listening
Virtual MAC : 000f-e2ff-4012 (Learnt)
Owner ID : 0000-5e01-1103
Priority : 127
Active : FE80::2
Forwarder 03
State : Active
Virtual MAC : 000f-e2ff-4013 (Owner)
Owner ID : 0000-5e01-1105
Priority : 255
Active : local
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
以上显示信息表示,Timeout Timer超时后,删除虚拟MAC地址000f-e2ff-4011对应的虚拟转发器,不再转发目的MAC地址为该MAC的报文。
# Switch A出现故障后,通过display vrrp ipv6 verbose命令查看Switch B上备份组的详细信息。
[SwitchB-Vlan-interface2] display vrrp ipv6 verbose
IPv6 Standby Information:
Run Mode : Load Balance
Run Method : Virtual MAC
Total number of virtual routers : 1
Interface Vlan-interface2
VRID : 1 Adver Timer : 1
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 5
Auth Type : None
Virtual IP : FE80::10
1::10
Member IP List : FE80::2 (Local, Master)
FE80::3 (Backup)
Forwarder Information: 2 Forwarders 1 Active
Config Weight : 255
Running Weight : 255
Forwarder 02
State : Active
Virtual MAC : 000f-e2ff-4012 (Owner)
Owner ID : 0000-5e01-1103
Priority : 255
Active : local
Forwarder 03
State : Listening
Virtual MAC : 000f-e2ff-4013 (Learnt)
Owner ID : 0000-5e01-1105
Priority : 127
Active : FE80::3
Forwarder Weight Track Information:
Track Object : 1 State : Positive Weight Reduced : 250
以上显示信息表示Switch A出现故障后,Switch B的优先级高于Switch C,将抢占成为Master设备。
l Switch A上的配置
#
ipv6
#
vrrp mode load-balance
#
vlan 2 to 3
#
interface Vlan-interface2
ipv6 address 1::1 64
ipv6 address FE80::1 link-local
undo ipv6 nd ra halt
vrrp ipv6 vrid 1 virtual-ip FE80::10 link-local
vrrp ipv6 vrid 1 virtual-ip 1::10
vrrp ipv6 vrid 1 priority 120
vrrp ipv6 vrid 1 preempt-mode timer delay 5
vrrp ipv6 vrid 1 weight track 1 reduced 250
#
interface Vlan-interface3
ipv6 address 2003::2/64
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
track 1 interface vlan-interface 3
#
l Switch B上的配置
#
ipv6
#
vrrp mode load-balance
#
vlan 2 to 3
#
interface Vlan-interface2
ipv6 address 1::2 64
ipv6 address FE80::2 link-local
undo ipv6 nd ra halt
vrrp ipv6 vrid 1 virtual-ip FE80::10 link-local
vrrp ipv6 vrid 1 virtual-ip 1::10
vrrp ipv6 vrid 1 priority 110
vrrp ipv6 vrid 1 preempt-mode timer delay 5
vrrp ipv6 vrid 1 weight track 1 reduced 250
#
interface Vlan-interface3
ipv6 address 2004::2/64
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
track 1 interface vlan-interface 3
#
l Switch C上的配置
#
ipv6
#
vrrp mode load-balance
#
vlan 2 to 3
#
interface Vlan-interface2
ipv6 address 1::3 64
ipv6 address FE80::3 link-local
undo ipv6 nd ra halt
vrrp ipv6 vrid 1 virtual-ip FE80::10 link-local
vrrp ipv6 vrid 1 virtual-ip 1::10
vrrp ipv6 vrid 1 preempt-mode timer delay 5
vrrp ipv6 vrid 1 weight track 1 reduced 250
#
interface Vlan-interface3
ipv6 address 2005::2/64
#
interface GigabitEthernet1/0/3
port access vlan 3
#
interface GigabitEthernet1/0/5
port access vlan 2
#
track 1 interface vlan-interface 3
#
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!