VRRP与MSTP综合组网配置举例.docx
《VRRP与MSTP综合组网配置举例.docx》由会员分享,可在线阅读,更多相关《VRRP与MSTP综合组网配置举例.docx(40页珍藏版)》请在冰豆网上搜索。
VRRP与MSTP综合组网配置举例
VRRP与MSTP综合组网配置举例
D
与STP相比,MSTP可以实现网络拓扑的快速收敛,也能使不同VLAN的流量沿各自的路径转发,从而为冗余链路提供了更好的负载分担机制。
2 应用场合
2.1 单独使用VRRP的组网方式
图1-2 VRRP为网关提供冗余备份
单独使用VRRP为网关提供冗余备份的组网方式如图1-2所示:
局域网内的主机通过二层交换机接入两台网关设备DeviceA和DeviceB,DeviceA和DeviceB构成一台虚拟路由器,为网关提供冗余备份,以提高网关设备的可靠性。
这种组网方式虽然可以防止网关的单点故障,但是仍然存在以下问题:
∙ 不能防御所有的链路故障。
例如,链路a和链路c同时发生故障时,局域网内的主机将无法与外界通信。
∙ 链路a或链路b出现故障时,即使Master正常工作,也会导致Backup接收不到Master发送的VRRP通告报文,从而错误地认为Master出现故障,进行Master和Backup状态切换。
2.2 VRRP与MSTP配合使用的组网方式
图1-3 VRRP与MSTP配合使用提高网络可靠性
VRRP与MSTP配合使用的组网方式如图1-3所示:
在DeviceA和DeviceB之间增加心跳线(链路e)为下行链路提供冗余备份,并使用MSTP技术阻塞网络中的冗余链路以消除二层环路。
采用这种组网方式,不仅可以为网关设备提供冗余备份,还可以为下行的二层链路提供冗余备份,极大地提高了网络的可靠性。
VRRP与MSTP配合使用的组网方式具有以下优势:
∙ 可以防御多种链路故障。
只要上行链路(链路c和链路d)、下行链路(链路a和链路b)中各有一条可达链路,即可保证通信不会中断。
例如,DeviceA作为Master时,如果链路a和链路c同时出现故障,则通过链路b—链路e—链路d这条路径转发流量;如果链路a和链路d同时出现故障,则通过VRRP监视上行接口或链路功能降低DeviceA的优先级,使得DeviceB成为Master,流量通过链路b—链路c这条路径转发;如果链路a和链路e同时出现故障,则DeviceB接收不到DeviceA的通告报文,使得DeviceB成为Master,流量通过链路b—链路c这条路径转发。
∙ 通过在DeviceA和DeviceB之间增加心跳线,避免链路a或链路b出现故障、网关正常工作时错误地进行Master和Backup状态切换。
在VRRP与MSTP配合使用的组网方式中,心跳线链路e通常为聚合链路,以提高可靠性。
3 配置前提
本文档不严格与具体软、硬件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。
如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
4 配置举例
4.1 组网需求
∙ 局域网中采用VRRP技术进行网关设备的备份,提高网关的可靠性。
当一台网关设备出现故障时,局域网内的主机仍然可以通过另一台网关设备访问外部网络。
∙ 在网关设备工作正常时,区域A用户通过网关设备SwitchA进行数据转发;区域B用户通过网关设备SwitchB进行数据转发,实现流量的负载分担。
∙ 当网关设备的上行链路出现故障时,降低该网关设备的优先级,以避免该网关设备成为Master,导致流量转发中断。
∙ 局域网内进行二层链路的冗余备份,保证网关设备下行链路故障时,流量转发不会中断。
使用MSTP技术避免二层网络中出现环路。
∙ 网关设备通过核心层的出口设备SwitchE与Internet连接。
通常情况下,核心层会部署多台出口设备,以提高网络的可靠性。
为了简化配置过程,本文仅以一台出口设备为例,说明出口设备的配置方法。
多台出口设备时,配置方法与此类似。
图1-4 VRRP与MSTP综合配置组网图
设备
接口
IP地址
设备
接口
IP地址
SwitchA
Vlan-int101
10.1.1.2/24
SwitchB
Vlan-int101
10.1.1.3/24
Vlan-int102
10.2.1.2/24
Vlan-int102
10.2.1.3/24
Vlan-int1000
100.0.0.2/24
Vlan-int2000
200.0.0.2/24
VirtualIP1
10.1.1.1/24
VirtualIP1
10.1.1.1/24
VirtualIP2
10.2.1.1/24
VirtualIP2
10.2.1.1/24
SwitchE
Vlan-int1000
100.0.0.1/24
Vlan-int2000
200.0.0.1/24
Vlan-int3000
30.0.0.1/24
4.2 配置思路
实现上述组网需求,需要进行如下配置:
∙ SwitchA、SwitchB上分别创建两个VRRP备份组。
∙ 配置SwitchA在备份组1内具有更高的优先级,即正常情况下SwitchA作为备份组1的Master设备;配置SwitchB在备份组2内具有更高的优先级,即正常情况下SwitchB作为备份组2的Master设备。
∙ 区域A内的主机将备份组1的虚拟IP地址设置为网关,区域B内的主机将备份组2的虚拟IP地址设置为网关。
从而保证在网关设备工作正常时,区域A用户通过网关设备SwitchA进行数据转发,区域B用户通过网关设备SwitchB进行数据转发,实现流量的负载分担。
∙ SwitchA、SwitchB上分别配置VRRP备份组监视上行接口,当上行接口出现故障时,降低路由器在备份组中的优先级。
∙ SwitchA、SwitchB和二层交换机之间启用MSTP多实例,并在各实例中指定根桥和备份根桥。
∙ 在SwitchA、SwitchB和SwitchE之间配置OSPF路由协议。
SwitchA和SwitchB通过OSPF发布区域A和区域B所在网段的路由,以实现区域A与区域B内主机与外部网络的三层互通。
并在SwitchA和SwitchB上合理配置路由的Cost值,以便内网访问外网、外网访问内网的双向流量通过同一台设备处理。
∙ SwitchA和SwitchB之间的链路采用聚合链路,以提高心跳线的可靠性。
4.3 配置步骤
4.3.1 设备A的配置
# 配置端口Ethernet1/1属于VLAN1000、Ethernet1/3属于VLAN102、Ethernet1/4属于VLAN101。
system-view
[SwitchA]vlan 1000
[SwitchA-vlan1000]portethernet1/1
[SwitchA-vlan1000]quit
[SwitchA]vlan101
[SwitchA-vlan101]portethernet1/4
[SwitchA-vlan101]quit
[SwitchA]vlan102
[SwitchA-vlan102]portethernet1/3
[SwitchA-vlan102]quit
# 创建二层聚合接口1。
[SwitchA]interfacebridge-aggregation1
[SwitchA-Bridge-Aggregation1]quit
# 分别将端口Ethernet1/2和Ethernet1/5加入到聚合组1中。
[SwitchA]interfaceethernet1/2
[SwitchA-Ethernet1/2]portlink-aggregationgroup1
[SwitchA-Ethernet1/2]quit
[SwitchA]interfaceethernet1/5
[SwitchA-Ethernet1/5]portlink-aggregationgroup1
[SwitchA-Ethernet1/5]quit
# 配置二层聚合接口1为Trunk端口,并允许VLAN101和102的报文通过。
[SwitchA]interfacebridge-aggregation1
[SwitchA-Bridge-Aggregation1]portlink-typetrunk
[SwitchA-Bridge-Aggregation1]porttrunkpermitvlan101to102
[SwitchA-Bridge-Aggregation1]undoporttrunkpermitvlan1
[SwitchA-Bridge-Aggregation1]porttrunkpvidvlan101
[SwitchA-Bridge-Aggregation1]quit
# 配置上行接口IP地址。
[SwitchA]interfacevlan-interface1000
[SwitchA-Vlan-interface1000]ipaddress100.0.0.224
[SwitchA-Vlan-interface1000]quit
# 创建Track项1,监视上行接口的物理状态。
[SwitchA]track1interfacevlan-interface1000
# 创建VRRP备份组1,配置SwitchA在备份组1中的优先级为110。
[SwitchA]interfacevlan-interface101
[SwitchA-Vlan-interface101]ipaddress10.1.1.224
[SwitchA-Vlan-interface101]vrrpvrid1virtual-ip10.1.1.1
[SwitchA-Vlan-interface101]vrrpvrid1priority110
# 配置VRRP备份组1监视Track项1的状态。
当Track项状态为Negative(即上行接口的物理状态为down)时,SwitchA在备份组1的优先级降低20,使得SwitchB的优先级高于SwitchA,SwitchB成为Master。
[SwitchA-Vlan-interface101]vrrpvrid1track1reduced20
[SwitchA-Vlan-interface101]quit
# 创建VRRP备份组2。
[SwitchA]interfacevlan-interface102
[SwitchA-Vlan-interface102]ipaddress10.2.1.224
[SwitchA-Vlan-interface102]vrrpvrid1virtual-ip10.2.1.1
[SwitchA–Vlan-interface102]quit
# 配置MSTP。
[SwitchA]stpregion-configuration
[SwitchA-mst-region]region-namevrrp
[SwitchA-mst-region]instance1vlan101
[SwitchA-mst-region]instance2vlan102
[SwitchA-mst-region]activeregion-configuration
[SwitchA-mst-region]quit
[SwitchA]stpinstance1rootprimary
[SwitchA]stpinstance2rootsecondary
[SwitchA]stpenable
# 在上行接口上关闭STP功能。
[SwitchA]interfaceethernet1/1
[SwitchA-Ethernet1/1]undostpenable
[SwitchA-Ethernet1/1]quit
# 配置OSPF发布网段路由。
[SwitchA]ospf
[SwitchA-ospf-1]area0
[SwitchA-ospf-1-area-0.0.0.0]network100.0.0.00.0.0.255
[SwitchA-ospf-1-area-0.0.0.0]network10.1.1.00.0.0.255
[SwitchA-ospf-1-area-0.0.0.0]network10.2.1.00.0.0.255
[SwitchA-ospf-1-area-0.0.0.0]quit
[SwitchA-ospf-1]quit
# 配置接口Vlan-int102的路由Cost值为5,以便外网访问区域B的报文优先通过SwitchB转发。
[SwitchA]interfacevlan-interface102
[SwitchA-Vlan-interface102]ospfcost5
[SwitchA-Vlan-interface102]quit
4.3.2 设备B的配置
# 配置端口Ethernet1/1属于VLAN2000、Ethernet1/3属于VLAN102、Ethernet1/4属于VLAN101。
system-view
[SwitchB]vlan2000
[SwitchB-vlan2000]portethernet1/1
[SwitchB-vlan2000]quit
[SwitchB]vlan101
[SwitchB-vlan101]portethernet1/4
[SwitchB-vlan101]quit
[SwitchB]vlan102
[SwitchB-vlan102]portethernet1/3
[SwitchB-vlan102]quit
# 创建二层聚合接口1。
[SwitchB]interfacebridge-aggregation1
[SwitchB-Bridge-Aggregation1]quit
# 分别将端口Ethernet1/2和Ethernet1/5加入到聚合组1中。
[SwitchB]interfaceethernet1/2
[SwitchB-Ethernet1/2]portlink-aggregationgroup1
[SwitchB-Ethernet1/2]quit
[SwitchB]interfaceethernet1/5
[SwitchB-Ethernet1/5]portlink-aggregationgroup1
[SwitchB-Ethernet1/5]quit
# 配置二层聚合接口1为Trunk端口,并允许VLAN101和102的报文通过。
[SwitchB]interfacebridge-aggregation1
[SwitchB-Bridge-Aggregation1]portlink-typetrunk
[SwitchB-Bridge-Aggregation1]porttrunkpermitvlan101to102
[SwitchB-Bridge-Aggregation1]undoporttrunkpermitvlan1
[SwitchB-Bridge-Aggregation1]porttrunkpvidvlan101
[SwitchB-Bridge-Aggregation1]quit
# 配置上行接口IP地址。
[SwitchB]interfacevlan-interface2000
[SwitchB-Vlan-interface2000]ipaddress200.0.0.224
[SwitchB-Vlan-interface2000]quit
# 创建Track项1,监视上行接口的物理状态。
[SwitchB]track1interfacevlan-interface2000
# 创建VRRP备份组1。
[SwitchB]interfacevlan-interface101
[SwitchB-Vlan-interface101]ipaddress10.1.1.324
[SwitchB-Vlan-interface101]vrrpvrid1virtual-ip10.1.1.1
[SwitchB–Vlan-interface101]quit
# 创建VRRP备份组2,配置SwitchB在备份组2中的优先级为110。
[SwitchB]interfacevlan-interface102
[SwitchB-Vlan-interface102]ipaddress10.2.1.324
[SwitchB-Vlan-interface102]vrrpvrid1virtual-ip10.2.1.1
[SwitchB-Vlan-interface102]vrrpvrid1priority110
# 配置VRRP备份组2监视Track项1的状态。
当Track项状态为Negative(即上行接口的物理状态为down)时,SwitchB在备份组2的优先级降低20,使得SwitchA的优先级高于SwitchB,SwitchA成为Master。
[SwitchB-Vlan-interface102]vrrpvrid1track1reduced20
[SwitchB-Vlan-interface102]quit
# 配置MSTP。
[SwitchB]stpregion-configuration
[SwitchB-mst-region]region-namevrrp
[SwitchB-mst-region]instance1vlan101
[SwitchB-mst-region]instance2vlan102
[SwitchB-mst-region]activeregion-configuration
[SwitchB-mst-region]quit
[SwitchB]stpinstance2rootprimary
[SwitchB]stpinstance1rootsecondary
[SwitchB]stpenable
# 在上行接口上关闭STP功能。
[SwitchB]interfaceethernet1/1
[SwitchB-Ethernet1/1]undostpenable
[SwitchB-Ethernet1/1]quit
# 配置OSPF发布网段路由。
[SwitchB]ospf
[SwitchB-ospf-1]area0
[SwitchB-ospf-1-area-0.0.0.0]network200.0.0.00.0.0.255
[SwitchB-ospf-1-area-0.0.0.0]network10.1.1.00.0.0.255
[SwitchB-ospf-1-area-0.0.0.0]network10.2.1.00.0.0.255
[SwitchB-ospf-1-area-0.0.0.0]quit
[SwitchB-ospf-1]quit
# 配置接口Vlan-int101的路由Cost值为5,以便外网访问区域A的报文优先通过SwitchA转发。
[SwitchB]interfacevlan-interface101
[SwitchB-Vlan-interface102]ospfcost5
[SwitchB-Vlan-interface102]quit
4.3.3 设备C的配置
# 配置VLAN101。
system-view
[SwitchC]vlan101
[SwitchC-vlan101]portethernet1/1toethernet1/3
[SwitchC-vlan101]quit
# 配置MSTP。
[SwitchC]stpregion-configuration
[SwitchC-mst-region]region-namevrrp
[SwitchC-mst-region]instance1vlan101
[SwitchC-mst-region]instance2vlan102
[SwitchC-mst-region]activeregion-configuration
[SwitchC-mst-region]quit
[SwitchC]stpenable
4.3.4 设备D的配置
# 配置VLAN102。
system-view
[SwitchD]vlan102
[SwitchD-vlan102]portethernet1/1toethernet1/3
[SwitchD-vlan102]quit
# 配置MSTP。
[SwitchD]stpregion-configuration
[SwitchD-mst-region]region-namevrrp
[SwitchD-mst-region]instance1vlan101
[SwitchD-mst-region]instance2vlan102
[SwitchD-mst-region]activeregion-configuration
[SwitchD-mst-region]quit
[SwitchD]stpenable
4.3.5 设备E的配置
# 配置VLAN1000。
system-view
[SwitchE]vlan1000
[SwitchE-vlan1000]portethernet1/1
[SwitchE-vlan1000]quit
# 配置接口Vlan-int1000的IP地址。
[SwitchE]interfacevlan-interface1000
[SwitchE-Vlan-interface1000]ipaddress100.0.0.124
[SwitchE-Vlan-interface1000]