目录
vrrp及mstp多生成树拓扑图
IP地址规划表
介绍说明
• 3.1. MSTP简介
• 3.2. VRRP简介
4.1. 核心交换机1命令配置详情
4.2. 核心交换机2命令配置详情
4.3. 接入交换机1命令配置详情
4.4. 接入交换机2命令配置详情
5.1. sw1分析总结
5.2. sw2分析总结
5.3. 步骤总结
MSTP(多生成树协议)是在STP的基础上发展而来的,用于在局域网中消除数据链路层的物理环路,作为一种二层协议,MSTP通过选择性的阻塞网络中的冗余链路来消除二层环路,将环路网络结构修剪无环路的树型网络结构,从而防止在环路网络中不断增生和无限循环,避免设备由于重复接收相同报文造成报文处理能力的下降;同时,它还具备链路备份的能力。与STP相比,MSTP可以实现网络拓扑的快速收敛,也能使不同VLAN的流量沿各自的路径转发,从而为冗余链路提供了更好的负载分担机制。
• 3.2. VRRP简介
VRRP用来为网关设备提供冗余备份。VRRP将可以承担网关功能的一组设备加入到备份组中,形成一台虚拟路由器,局域网内的主机将此虚拟路由器设置为缺省网关。VRRP根据优先级从备份组中选举一台网关设备作为Master,负责转发局域网内主机与外部通信的流量,其他网关设备作为Backup。当Master出现故障后,VRRP重新选举新的Master,保证流量转发不会中断。
4.1. 核心交换机1命令配置详情
En
Conf t
//进入配置模式
Hostname sw1
//修改主机名sw1
Exit
Vlan 10
Exit
//创建vlan10
Vlan 20
Exit
//创建vlan20
Vlan 30
Exit
//创建vlan30
Vlan 1000
Exit
//创建vlan1000
Int vlan 1000
//进入vlan1000
Ip address 10.0.0.252 255.255.255.0
//配置vlan1000的IP地址
exit
Int vlan 10
//进入vlan10
Ip address 192.168.1.252 255.255.255.0
//配置vlan10的IP地址
Eixt
Int valn 20
//进入vlan20
Ip address 192.168.2.252 255.255.255.0
//配置vlan20的IP地址
Eixt
Int vlan 30
//进入vlan30
Ip address 192.168.3.252 255.255.255.0
//配置vlan30的IP地址
Exit
Int loopback1
Ip address 1.1.1.1 255.255.255.255
//创建loopback1和loopback1的地址
Exit
Int gei_1/3
Switchport mode trunk
Switchport trunk vlan 10 ,20 ,30,1000
Exit
//给接口gei_1/3添加trunk口类型
interface smartgroup 1
exit
interface gei_1/1
smartgroup 1 mode on
interface gei_1/2
smartgroup 1 mode on
exit
interface smartgroup 1
switchport mode trunk
switchport trunk vlan 10, 20, 30 ,1000
//创建聚合组1形成一个逻辑接口,把gei_1/1-2加入聚合组
Int gei_1/4
Switchport mode trunk
Switchport trunk vlan 10,20, 30, 1000
//给接口gei_1/4加trunk口类型
Interface vlan 10
Vrrp 1 ip 192.168.1.254
vrrp 1 priority 254
Interface vlan 20
Vrrp 1 ip 192.168.2.254
vrrp 1 priority 254
interface vlan 1000
vrrp 1 ip 10.0.0.254
vrrp 1 priority 254
interface vlan 30
vrrp 1 ip 192.168.3.254
vrrp 1 priority 254
//创建vlan10,20,30,1000的vrrp,优先级都为254
spanning-tree enable
spanning-tree mode mstp
spanning-tree mstp configuration
name instance1
revision 1
instance 1 vlans 10,20,30,1000
spanning-tree mst instance 1 priority 4096
//创建多生成树mstp实例1,实例1的优先级4096
exit
conf t
ip route 2.2.2.2 255.255.255.255 192.168.1.253
exit
//引入路由,指向核心2交换机
4.2. 核心交换机2命令配置详情
En
Conf t
//进入配置模式
Hostname sw2
//修改主机名sw2
Exit
Vlan 10
Exit
//创建vlan10
Vlan 20
Exit
//创建vlan20
Vlan 30
Exit
//创建vlan30
Vlan 1000
Exit
//创建vlan1000
Int vlan 1000
//进入vlan1000
Ip address 10.0.0.253 255.255.255.0
//配置vlan1000的IP地址
exit
Int vlan 10
//进入vlan10
Ip address 192.168.1.253 255.255.255.0
//配置vlan10的IP地址
Eixt
Int valn 20
//进入vlan20
Ip address 192.168.2.253 255.255.255.0
//配置vlan20的IP地址
Eixt
Int vlan 30
//进入vlan30
Ip address 192.168.3.253 255.255.255.0
//配置vlan30的IP地址
Exit
Int loopback1
Ip address 2.2.2.2 255.255.255.255
//创建loopback1和loopback1的地址
Exit
Int gei_1/3
Switchport mode trunk
Switchport trunk vlan 10 ,20 ,30,1000
Exit
//给接口gei_1/3添加trunk口类型
interface smartgroup 1
exit
interface gei_1/1
smartgroup 1 mode on
interface gei_1/2
smartgroup 1 mode on
exit
interface smartgroup 1
switchport mode trunk
switchport trunk vlan 10, 20, 30 ,1000
//创建聚合组1形成一个逻辑接口,把gei_1/1-2加入聚合组
Int gei_1/4
Switchport mode trunk
Switchport trunk vlan 10,20, 30, 1000
//给接口gei_1/4加trunk口类型
Interface vlan 10
Vrrp 1 ip 192.168.1.254
Interface vlan 20
Vrrp 1 ip 192.168.2.254
interface vlan 1000
vrrp 1 ip 10.0.0.254
interface vlan 30
vrrp 1 ip 192.168.3.254
//创建vlan10,20,30,1000的vrrp,优先级默认
spanning-tree enable
spanning-tree mode mstp
spanning-tree mstp configuration
name instance 0
revision 1
instance 0 vlans 10,20,30,1000
//创建多生成树mstp实例0,默认优先级
conf t
ip route 1.1.1.1 255.255.255.255 192.168.1.252
exit
//引入路由,指向核心1交换机
4.3. 接入交换机1命令配置详情
En
Set vlan 10 enable
Set vlan 20 enable
Set vlan 30 enable
Set vlan 1000 enable
//创建vlan 10,20,30,1000
Set vlan 10 add port 23-24 tag
Set vlan 20 add port 23-24 tag
Set vlan 30 add port 23-24 tag
Set vlan1000 add port 23-24 tag
//vlan10,20,30,1000添加上行接口23,24
Set vlan 10 add port 1-5 untag
Set vlan 20 add port 6-10 untag
//vlan10,20添加物理接口1-5,6-10
Set port 1-5 pvid 10
Set port 6-10 pvid 20
//相应的接口打上标签
Config route
Set ipport 0 enable
Set ipport 0 vlan 1000
Set ipport 0 ipaddress 10.0.0.1 255.255.255.0
Iproute 0.0.0.0 0.0.0.0 10.0.0.254
Exit
//开启三层接口,创建管理vlan
Spanning-tree enable
Spanning-tree mode mstp
Spanning-tree mst configuration
Name instance1
Revision 1
Instance 1 vlans 10,20,30,1000
//创建多生成树
Exit
Write
4.4. 接入交换机2命令配置详情
En
Set vlan 30 enable
Set vlan 10 enable
Set vlan 20 enable
Set vlan 1000 enable
//创建vlan10,20,30,1000
Set vlan 30 add port 23-24 tag
Set vlan 10 add port 23-24 tag
Set vlan 20 add port 23-24 tag
Set vlan 1000 add port 23-24 tag
//vlan10,20,30,1000添加上行接口23,24
Set vlan 10 add port 1-5 untag
Set vlan 30 add port 6-10 untag
//vlan10,30添加物理接口1-5,6-10
Set port 1-5 pvid 10
Set port 6-10 pvid 30
//相应的接口打上标签
Config route
Set ipport 0 enable
Set ipport 0 vlan 1000
Set ipport 0 ipaddress 10.0.0.2 255.255.255.0
Iproute 0.0.0.0 0.0.0.0 10.0.0.254
Exit
//开启三层接口,创建管理vlan
Spanning-tree enable
Spanning-tree mode mstp
Spanning-tree mst configuration
Name instance1
Revision 1
Instance 1 vlans 10,20,30,1000
//创建多生成树
Exit
Write
//进行show接口,可以查看当前接口的简要信息
sw1#show spanning-tree instance 1
MST01
Spanning tree enabled protocol MSTP
RegRootID: Priority 4097; Address 0c12.62b2.3d54
Hello-Time 2 sec; Max-Age 20 sec
Forward-Delay 15 sec;
BridgeID: Priority 4097; Address 0c12.62b2.3d54
Hello-Time 2 sec; Max-Age 20 sec
Forward-Delay 15 sec; Max-Hops 20
Message-Age 0 sec; RemainHops 20
gei_1/3 128.2 20000 Forward Master p2p MSTP
smartgroup1 128.1 10000 Forward Designated p2p MSTP
//进行show生成树实例,查看接口多生成树状态,角色是主还是备。
show vrrp brief
Interface total: 4, Group total: 4, Master total: 4
Interface Grp Ver Pri Time Own Pre State Master-addr Group-addr
vlan1000 1 2 254 3.007 N Y Master 10.0.0.252 10.0.0.254
vlan30 1 2 254 3.007 N Y Master 192.168.3.252 192.168.3.254
vlan20 1 2 254 3.007 N Y Master 192.168.2.252 192.168.2.254
vlan10 1 2 254 3.007 N Y Master 192.168.1.252 192.168.1.254
//进行show vrrp的简要信息
sw1#show interface brief
Interface portattribute mode BW(Mbits) Admin Phy Prot Description
gei_1/1 electric Duplex/full 1000 up up up none
gei_1/2 electric Duplex/full 1000 up up up none
gei_1/3 electric Duplex/full 1000 up up up none
gei_1/4 electric Duplex/full 1000 up down down none
gei_1/5 electric Duplex/full 1000 up down down none
gei_1/6 electric Duplex/full 1000 up down down none
gei_1/7 electric Duplex/full 1000 up down down none
gei_1/8 electric Duplex/full 1000 up down down none
gei_1/9 electric Duplex/full 1000 up down down none
gei_1/10 electric Duplex/full 1000 up down down none
//进行show接口的,可查看接口的情况信息
5.2. sw2分析总结
sw2#show vrrp brief
Interface total: 3, Group total: 3, Master total: 0
Interface Grp Ver Pri Time Own Pre State Master-addr Group-addr
vlan1000 1 2 100 3.609 N Y Backup 10.0.0.252 10.0.0.254
vlan30 1 2 100 3.609 N Y Backup 192.168.3.252 192.168.3.254
vlan10 1 2 100 3.609 N Y Backup 192.168.1.252 192.168.1.254
//进行show vrrp的简要信息
sw2#show spanning-tree instance 0
MST00
Spanning tree enabled protocol MSTP
Root ID: Priority 32768; Address 0019.c631.e1f8
Hello-Time 2 sec; Max-Age 20 sec
Forward-Delay 15 sec;
RegRootID: Priority 32768; Address 0c12.62b2.3d54
gei_1/4 128.2 20000 Discard Alternate p2p MSTP
smartgroup1 128.1 10000 Forward Root p2p MSTP
//进行show生成树实例,查看接口多生成树状态,角色是主还是备。
sw2#show interface brief
Interface portattribute mode BW(Mbits) Admin Phy Prot Description
gei_1/1 electric Duplex/full 1000 up up up none
gei_1/2 electric Duplex/full 1000 up up up none
gei_1/3 electric Duplex/full 1000 up down down none
gei_1/4 electric Duplex/full 1000 up up up none
gei_1/5 electric Duplex/full 1000 up down down none
gei_1/6 electric Duplex/full 1000 up down down none
gei_1/7 electric Duplex/full 1000 up down down none
gei_1/8 electric Duplex/full 1000 up down down none
gei_1/9 electric Duplex/full 1000 up down down none
gei_1/10 electric Duplex/full 1000 up down down none
//进行show接口,可查看接口情况信息
5.3. 步骤总结
MSTP+VRRP配置步骤
1、配置交换机的基本配置,例如接口信息、主机名等
2、配置交换机聚合链路为samartgroup1
3、配置主VRRP ID、虚拟IP、优先级,然后设置备VRRP的虚拟IP、优先级(此处的优先级一定要比主设备的低)
4、配置MSTP,进入MSTP配置接口、配置name、实例映射、激活,退出后设置主备
5、配置完成