STP生成树(二)

一、STP基础配置

1、STP端口状态

Disable端口不仅不转发BPDU报文,也不转发用户流量。端口为DOWN
Blocking端口仅仅接收并处理BPDU,不转发用户流量。不学习MAC地址。如果max age (默认20s) 计时器到期时该接口任没有收到BPDU则切换到Listening状态。
Listening不接收也不转发用户流量,接收并且发送BPDU,不学习MAC地址确定端口角色,将进行选举动作。
Learning不接收也不转发用户流量,接收并且发送BPDU,学习MAC地址
Forwarding接收并转发帧,接收并且发送BPDU,学习MAC地址

Listening到learning要15s选举,learning到forwarding要15s学习mac地址。
TCN是拓补产生变化才发出,通知根网桥,更新mac地址从300s便为15s,只携带协议、版本、TYPE、标志。

二、基础配置

●指定生成树协议类型(STP/RSTP/MSTP) :[SW] stp mode { stp | rstp| mstp }——缺省是MSTP
●配置交换机优先级:[SW] stp priority pri——缺省是32768
●指定交换机成为根桥: [SW] stp root primary
●指定交换机成为次根桥:[SW] stp root secondary
启用生成树:[SW] stp enable

二、了解MSTP

●MSTP兼容STB和RSTP,通过多实例能实现对业务流量和用户流量的隔离,同时还提供了数据转发的多个冗余路径,在数据转发过程中实现VL AN数据的负载均衡。
●在MSTP中,你可以将若干个VL .AN映射到一个实例(instance) ,MSTP将为每个instance运行一-棵生成树, 可以基于instance设置优先级、端口路径开销等参数。

三、MSTP基础配置

MSTP配置示例:
在这里插入图片描述
缺省配置为MSTP所以未作修改,如果缺省配置不是MSTP,[SW]stp mode mstp可修改协议类型

'R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.10.254 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.20.254 24
[R1-GigabitEthernet0/0/1]int loopback 0
[R1-LoopBack0]ip add 1.1.1.1 32
SW1
[SW1]vlan b 10 20
[SW1]int e0/0/2
[SW1-Ethernet0/0/2]port hybrid pvid vlan 10
[SW1-Ethernet0/0/2]port hybrid untagged vlan 10 20
[SW1-Ethernet0/0/2]int e0/0/1
[SW1-Ethernet0/0/1]port hybrid untagged vlan 10 20
[SW1-Ethernet0/0/1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t 
[SW1-GigabitEthernet0/0/1]p t a v a

[SW1]stp region-configuration          #进入mstp配置视图
[SW1-mst-region]region-name wuhao      #MSTP域名为wuhao(域内交换机的设置域名为同一名字)
[SW1-mst-region]instance 1 vlan 10     #配置VLAN到实例的映射
[SW1-mst-region]instance 2 vlan 20     #配置VLAN到实例的映射
[SW1-mst-region]active region-configuration  #激活MS T域的配置
[SW1]stp instance 1 root primary      #或者stp instance 1 priority 0
[SW1]stp instance 2 root secondary    #或者stp instance 2 priority 4096
SW2
[SW2]vlan b 10 20
[SW2]int e0/0/2
[SW2-Ethernet0/0/2]port hybrid pvid vlan 20
[SW2-Ethernet0/0/2]port hybrid untagged vlan 10 20
[SW2-Ethernet0/0/2]int e0/0/1
[SW2-Ethernet0/0/1]port hybrid untagged vlan 10 20
[SW2-Ethernet0/0/1]int g0/0/1
[SW2-GigabitEthernet0/0/1]p l t
[SW2-GigabitEthernet0/0/1]p t a v a

[SW2]stp region-configuration
[SW2-mst-region]region-name wuhao
[SW2-mst-region]instance 1 vlan 20
[SW2-mst-region]instance 2 vlan 10
[SW2-mst-region]active region-configuration
[SW2]stp instance 2 root primary
[SW2]stp instance 1 root secondary
SW3
[SW3]vlan b 10 20
[SW3]int e0/0/1
[SW3-Ethernet0/0/1]port hybrid pvid vlan 10
[SW3-Ethernet0/0/1]port hybrid untagged vlan 10 20
[SW3-Ethernet0/0/1]int e0/0/3
[SW3-Ethernet0/0/3]port hybrid pvid vlan 10
[SW3-Ethernet0/0/3]port hybrid untagged vlan 10 20
[SW3-Ethernet0/0/3]int e0/0/2
[SW3-Ethernet0/0/2]port hybrid pvid vlan 20
[SW3-Ethernet0/0/2]port hybrid untagged vlan 10 20
[SW3-Ethernet0/0/2]int e0/0/4
[SW3-Ethernet0/0/4]port hybrid pvid vlan 20
[SW3-Ethernet0/0/4]port hybrid untagged vlan 10 20

[SW3]stp region-configuration
[SW3-mst-region]region-name wuhao
[SW3-mst-region]instance 1 vlan 10
[SW3-mst-region]instance 2 vlan 20
[SW3-mst-region]active region-configuration '

PC1ping通结果
在这里插入图片描述
PC2ping通结果
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值