协议介绍
多生成树协议(MSTP)简介:
多生成树(MST)使用修正的快速生成树(RSTP)协议,叫做多生成树协议(MSTP)
MSTP(Multiple Spanning Tree Protocol,多生成树协议)
将环路网络修剪成为一个无环的树型网络,避免报文在环路网络中的增生和无限循环,同时还提供了数据转发的多个冗余路径,在数据转发过程中实现VLAN 数据的负载均衡。MSTP 兼容STP 和RSTP,并且可以弥补STP 和RSTP 的缺陷。它既可以快速收敛,也能使不同VLAN 的流量沿各自的路径分发,从而为冗余链路提供了更好的负载分担机制。
虚拟路由冗余协议(VRRP)简介:
VRRP是一种选择协议,它可以把一个虚拟路由器的责任动态分配到局域网上的 VRRP 路由器中的一台。控制虚拟路由器 IP 地址的 VRRP 路由器称为主路由器,它负责转发数据包到这些虚拟 IP 地址。一旦主路由器不可用,这种选择过程就提供了动态的故障转移机制,这就允许虚拟路由器的 IP 地址可以作为终端主机的默认第一跳路由器。是一种LAN接入设备备份协议。一个局域网络内的所有主机都设置缺省网关,这样主机发出的目的地址不在本网段的报文将被通过缺省网关发往三层交换机,从而实现了主机和外部网络的通信。
VRRP是一种路由容错协议,也可以叫做备份路由协议。一个局域网络内的所有主机都设置缺省路由,当网内主机发出的目的地址不在本网段时,报文将被通过缺省路由发往外部路由器,从而实现了主机与外部网络的通信。当缺省路由器down掉(即端口关闭)之后,内部主机将无法与外部通信,如果路由器设置了VRRP时,那么这时,虚拟路由将启用备份路由器,从而实现全网通信。
在VRRP协议中,有两组重要的概念:VRRP路由器和虚拟路由器,主控路由器和备份路由器。VRRP路由器是指运行VRRP的路由器,是物理实体;虚拟路由器是指VRRP协议创建的,是逻辑概念。一组VRRP路由器协同工作,共同构成一台虚拟路由器。该虚拟路由器对外表现为一个具有唯一固定的IP地址和MAC地址的逻辑路由器。处于同一个VRRP组中的路由器具有两种互斥的角色:主控路由器和备份路由器,一个VRRP组中有且只有一台处于主控角色的路由器,可以有一个或者多个处于备份角色的路由器VRRP协议从路由器组中选出一台作为主控路由器,负责ARP解析和转发IP数据包,组中的其他路由器作为备份的角色并处于待命状态,当由于某种原因主控路由器发生故障时,其中的一台备份路由器能在瞬间的时延后升级为主控路由器,由于此切换非常迅速而且不用改变IP地址和MAC地址,故对终端使用者系统是透明的。
“MSTP+VRRP”实验网络拓扑
实验目的:
1、保证PC1,PC2均可访问111.111.111.111地址。
2、PC1访问走CORE1进行数据转发,PC2访问走CORE2进行数据转发。
一、实验配置
(1)R1路由器配置:
#
sysname R1
#
interface GigabitEthernet0/0/0
ip address 192.168.56.5 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 11.1.1.1 255.255.255.252
#
interface GigabitEthernet2/0/1
ip address 12.1.1.1 255.255.255.252
#
interface LoopBack0
ip address 111.111.111.111 255.255.255.255
#
ospf 1
import-route direct
area 0.0.0.0
network 11.1.1.0 0.0.0.3
network 12.1.1.0 0.0.0.3
#
(2)CORE1交换机配置:
sysname CORE1
#
vlan batch 10 to 11 20 23
#
stp instance 1 root primary
stp instance 2 root secondary
#
stp region-configuration
region-name LAOWU
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 110
#
interface Vlanif11
ip address 11.1.1.2 255.255.255.252
#
interface Vlanif20
ip address 192.168.20.1 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254
#
interface Vlanif23
ip address 23.1.1.1 255.255.255.252
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 11
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/23
eth-trunk 1
#
interface GigabitEthernet0/0/24
eth-trunk 1
#
ospf 1
import-route direct
area 0.0.0.0
network 11.1.1.0 0.0.0.3
network 23.1.1.0 0.0.0.3
#
(3)CORE2交换机配置:
sysname CORE2
#
vlan batch 10 12 20 23
#
stp instance 1 root secondary
stp instance 2 root primary
#
stp region-configuration
region-name LAOWU
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
interface Vlanif10
ip address 192.168.10.2 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
#
interface Vlanif12
ip address 12.1.1.2 255.255.255.252
#
interface Vlanif20
ip address 192.168.20.2 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254
vrrp vrid 2 priority 110
#
interface Vlanif23
ip address 23.1.1.2 255.255.255.252
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 12
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/23
eth-trunk 1
#
interface GigabitEthernet0/0/24
eth-trunk 1
#
ospf 1
import-route direct
area 0.0.0.0
network 12.1.1.0 0.0.0.3
network 23.1.1.0 0.0.0.3
#
(4)SW1交换机配置:
sysname SW1
#
vlan batch 10 20
#
stp region-configuration
region-name LAOWU
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 20
#
(5)PC1主机配置:
(6)PC2主机配置:
二、结果验证
(1)PC1访问111.111.111.111连通情况以及路由情况:
(2)PC2访问111.111.111.111连通情况以及路由情况:
长按二维码
关注更多精彩
原文始发于微信公众号(老五说网络):双核心通过MSTP+VRRP实验冗余
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论