ENSP中MSTP配置
一、拓扑图:
二、需求分析:
(1)在S1、S2、S3创建VLAN 10、VLAN 20。
(2)配置ACCESS接口,将PC1、PC3、PC5划分进VLAN 10,将PC2、PC4、PC6划分进VLAN 20,配置TRUNK接口。
(3)在三台交换机配置MSTP,域名为huawei,版本号为2,VLAN 10关联instance 1、VLAN 20关联instance 2。
(4)使用root primay和root secondary命令配置根桥和备份根桥。使instance 1阻塞S3的G0/0/2接口,使instance 2阻塞S2的G0/0/1接口。即PC1访问PC5经由S1-S2-S3访问;PC2访问PC6经由S1-S3访问,实现流量负载均衡。
(5)将连接S2-S3链路开销值针对instance 1 和 instance 2设置为10000(缺省为20000).
(6)将S1连接PC1接口设置为边缘端口。将S1连接PC1和PC2端口关闭再开启,使用dis stp brief观察接口状态。
三、VLAN划分:
PC | VLAN | IP |
PC1 | VLAN10 | 192.168.10.11/24 |
PC2 | VLAN20 | 192.168.20.12/24 |
PC3 | VLAN10 | 192.168.10.13/24 |
PC4 | VLAN20 | 192.168.20.14/24 |
PC5 | VLAN10 | 192.168.10.15/24 |
PC6 | VLAN20 | 192.168.20.16/24 |
四、配置VLAN:
SW1:
///创建VLAN
vlan batch 10 20
interface GigabitEthernet0/0/1
///配置接口为trunk模式
port link-type trunk
///允许通过的VLAN
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
///配置接口为access模式
port link-type access
///只允许通过此VLAN
port default vlan 10
interface GigabitEthernet0/0/4
port link-type access
port default vlan 20
quit
SW2:
vlan batch 10 20
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
quit
SW3:
vlan batch 10 20
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
quit
五、配置MSTP:
SW1:
///进入MST域视图
stp region-configuration
///配置MST域的域名
region-name huawei
///配置MST域的修订级别
revision-level 2
///配置实例和VLAN的映射关系
instance 1 vlan 10
instance 2 vlan 20
///激活
active region-configuration
quit
SW2:
stp region-configuration
region-name huawei
revision-level 2
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
quit
SW3:
stp region-configuration
region-name huawei
revision-level 2
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
quit
六、配置根桥和备份根桥:
SW1:
///配置当前交换模块作为指定MSTI的备份根交换机。
stp instance 1 root secondary
stp instance 2 root secondary
PC1访问PC5经由S1-S2-S3访问,需要将S2配置为instance1的根桥,当S2为根桥时,instance1便会优先S2,所以配置stp instance 1 root primary即可
SW2:
///配置当前交换模块作为指定MSTI的根交换机
stp instance 1 root primary
PC1 ping PC5,对S2的G0/0/1接口进行抓包:
PC2访问PC6经由S1-S3访问,需要将S3配置为instance2的根桥,当S3为根桥时,instance2便会优先S3,配置stp instance 2 root primary即可
SW3:
stp instance 2 root primary
PC2 ping PC6,对S3的G0/0/2接口进行抓包:
七、配置开销:
SW2:
interface GigabitEthernet0/0/2
///配置端口的路径开销值
stp instance 1 cost 10000
stp instance 2 cost 10000
SW3:
interface GigabitEthernet0/0/1
stp instance 1 cost 10000
stp instance 2 cost 10000
八、设置边缘端口:
SW1:
interface GigabitEthernet0/0/3
///配置当前端口为边缘端口
stp edged-port enable