i目录1特性简介·························································································································1 1.1VRRP简介···················································································································1 1.2MSTP简介···················································································································1 2应用场合·························································································································2 2.1单独使用VRRP的组网方式······························································································2 2.2VRRP与MSTP配合使用的组网方式···················································································3 3配置前提·························································································································4 4配置举例·························································································································4 4.1组网需求······················································································································4 4.2配置思路······················································································································5 4.3配置步骤······················································································································6 4.3.1设备A的配置········································································································6 4.3.2设备B的配置········································································································8 4.3.3设备C的配置········································································································9 4.3.4设备D的配置······································································································10 4.3.5设备E的配置······································································································10 4.3.6主机的配置········································································································11 4.4验证配置····················································································································11 4.5配置文件····················································································································20 5相关资料·······················································································································25 11特性简介1.1VRRP简介VRRP用来为网关设备提供冗余备份。如图1-1所示,VRRP将可以承担网关功能的一组设备加入到备份组中,形成一台虚拟路由器,局域网内的主机将此虚拟路由器设置为缺省网关。VRRP根据优先级从备份组中选举出一台网关设备作为Master,负责转发局域网内主机与外部通信的流量,其他网关设备作为Backup。当Master出现故障后,VRRP重新选举新的Master,保证流量转发不会中断。图1-1虚拟路由器示意图VRRP可以监视上行接口或链路的状态。当路由器的上行接口或链路出现故障时,该路由器主动降低自己的优先级,使得备份组内其它路由器的优先级高于这个路由器,以避免这个路由器成为Master,导致流量转发失败。1.2MSTP简介MSTP是在STP的基础上发展而来的,用于在局域网中消除数据链路层的物理环路。作为一种二层管理协议,MSTP通过选择性地阻塞网络中的冗余链路来消除二层环路,将环路网络结构修剪成无环路的树型网络结构,从而防止报文在环路网络中不断增生和无限循环,避免设备由于重复接收相同报文而造成报文处理能力的下降;同时,它还具备链路备份的功能。与STP相比,MSTP可以实现网络拓扑的快速收敛,也能使不同VLAN的流量沿各自的路径转发,从而为冗余链路提供了更好的负载分担机制。22应用场合2.1单独使用VRRP的组网方式图1-2VRRP为网关提供冗余备份单独使用VRRP为网关提供冗余备份的组网方式如图1-2所示:局域网内的主机通过二层交换机接入两台网关设备DeviceA和DeviceB,DeviceA和DeviceB构成一台虚拟路由器,为网关提供冗余备份,以提高网关设备的可靠性。这种组网方式虽然可以防止网关的单点故障,但是仍然存在以下问题:•不能防御所有的链路故障。例如,链路a和链路c同时发生故障时,局域网内的主机将无法与外界通信。•链路a或链路b出现故障时,即使Master正常工作,也会导致Backup接收不到Master发送的VRRP通告报文,从而错误地认为Master出现故障,进行Master和Backup状态切换。InternetDeviceADeviceBHostAHostBSwitchCVirtualrouterLinkaLinkbLinkcLinkd32.2VRRP与MSTP配合使用的组网方式图1-3VRRP与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通常为聚合链路,以提高可靠性。InternetDeviceADeviceBHostAHostBSwitchCVirtualrouterLinkaLinkbLinkcLinkdLinkeMSTP43配置前提本文档不严格与具体软、硬件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。4配置举例4.1组网需求•局域网中采用VRRP技术进行网关设备的备份,提高网关的可靠性。当一台网关设备出现故障时,局域网内的主机仍然可以通过另一台网关设备访问外部网络。•在网关设备工作正常时,区域A用户通过网关设备SwitchA进行数据转发;区域B用户通过网关设备SwitchB进行数据转发,实现流量的负载分担。•当网关设备的上行链路出现故障时,降低该网关设备的优先级,以避免该网关设备成为Master,导致流量转发中断。•局域网内进行二层链路的冗余备份,保证网关设备下行链路故障时,流量转发不会中断。使用MSTP技术避免二层网络中出现环路。•网关设备通过核心层的出口设备SwitchE与Internet连接。通常情况下,核心层会部署多台出口设备,以提高网络的可靠性。为了简化配置过程,本文仅以一台出口设备为例,说明出口设备的配置方法。多台出口设备时,配置方法与此类似。5图1-4VRRP与MSTP综合配置组网图设备接口IP地址设备接口IP地址SwitchAVlan-int10110.1.1.2/24SwitchBVlan-int10110.1.1.3/24Vlan-int10210.2.1.2/24Vlan-int10210.2.1.3/24Vlan-int1000100.0.0.2/24Vlan-int2000200.0.0.2/24VirtualIP110.1.1.1/24VirtualIP110.1.1.1/24VirtualIP210.2.1.1/24VirtualIP210.2.1.1/24SwitchEVlan-int1000100.0.0.1/24Vlan-int2000200.0.0.1/24Vlan-int300030.0.0.1/244.2配置思路实现上述组网需