欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CCNP-Spanning-Tree

程序员文章站 2024-02-17 10:40:34
...

2018-8-15

Spanning-Tree

CAMPUS NETWORK  交换网

校园网的四个部分:

  1. 核心网络
  2. 数据中心
  3. BRANCH 分支机构
  4. TELEWORKER 远程拨号

多层交换机:具有数据包转发功能或具有路由功能的交换机

LOW LATENCY    HIGH SPEED    SCALABILITY

交换网  三层

接入:ACCESS:Workgroup access

汇聚:DITRIBUTION:Policy-Based Connectivity

核心:CORE:high-speed switching

802.1q

生成树的作用:在冗余线路上防环

Spanning-tree的端口状态

Bloacking:max age=20s  到LISTENING 状态, 当网络中所指定端口于根端口选出后将BLOCKING STATE 转为LISTENING STATE,最大20s

Listening

Learning                   forward delay=15s转发延时

Forwarding

交换机中对比MAC地址(桥)BRIDGE-ID   优先级+MAC地址

选出根后决定spanning-tree cost

802.1w

生成树种类:

Rapid spanning tree protocol(RSTP)基于IEEE 802.1W

三个状态,端口切换速度快,(CST通常5个过程,RSTP3个过程)

CST common spanning tree ===IEEE 802.1D

所有的控制数据流量都在本帧VLAN中传输

MST:multiple spanning tree protocol

一个生成树对多个VLAN,吧逻辑架构相似的VLAN放到一个生成树实例下,多个架构相似的VLAN拥有同样的生成树

一个生成树===多个VLAN

Per-VLAN spanning tree=PVST+ === per-vlan 802.1D

相较于普通的RSTP CST来说,无论有多少的VLAN生成树的结构都不改变,根桥永远都是固定的一台设备

PSVT+

对于每一个VLAN(一个VLAN既一个独立的逻辑架构)都有自己的生成树结构。此时SW1可以为VLAN10的根桥,SW2可以为VLAN20的根桥,基于VLAN独立的生成树结构

RAPID PVST+ ===PER-VLAN   IEEE 802.1w(思科默认)

PVST+的升级版,将快速收敛的特性加入到了PVST+中

 

SW3#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0001.63CB.9E21
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0090.2BC0.094C
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20

Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Altn BLK 19 128.1 P2p
Fa0/3 Desg FWD 19 128.3 P2p
Fa0/2 Root FWD 19 128.2 P2p
Fa0/4 Desg FWD 19 128.4 P2p

BRIDGE ID最小的作为根桥 

优先级+VLAN-ID都相同的情况下,选择MAC地址最小的设备作为某个VLAN的根桥

SW3(config-if)#do show sp
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0001.63CB.9E21
             Cost        19
             Port        2(FastEthernet0/2)
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     0090.2BC0.094C
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Altn BLK 19        128.1    P2p
Fa0/3            Desg FWD 19        128.3    P2p
Fa0/2            Root FWD 19        128.2    P2p
Fa0/4            Desg FWD 19        128.4    P2p

VLAN0010
  Spanning tree enabled protocol ieee
  Root ID    Priority    32778
             Address     0090.2BC0.094C
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     0090.2BC0.094C
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/2            Desg FWD 19        128.2    P2p

VLAN0020
  Spanning tree enabled protocol ieee
  Root ID    Priority    32788
             Address     0090.2BC0.094C
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)
             Address     0090.2BC0.094C
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg LRN 19        128.1    P2p
Fa0/2            Desg LRN 19        128.2    P2p

VLAN0030
  Spanning tree enabled protocol ieee
  Root ID    Priority    32798
             Address     0090.2BC0.094C
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32798  (priority 32768 sys-id-ext 30)
             Address     0090.2BC0.094C
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg LRN 19        128.1    P2p
Fa0/2            Desg LRN 19        128.2    P2p

VLAN0040
  Spanning tree enabled protocol ieee
  Root ID    Priority    32808
             Address     0090.2BC0.094C
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32808  (priority 32768 sys-id-ext 40)
             Address     0090.2BC0.094C
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg LSN 19        128.1    P2p
Fa0/2            Desg LSN 19        128.2    P2p

桥ID必须为4096倍数

SW3(config)#spanning-tree vlan 10 priority ?
  <0-61440>  bridge priority in increments of 4096

VLAN 20优先级设为最高 

SW3(config)#spanning-tree vlan 20 root primary 
SW1(config)#spanning-tree vlan 20 root secondary 

 

非根桥选择一个根端口

接收根桥发送的BPDU

管理/控制平面流量

  1. 距离根桥COST值最小(接口带宽越大,则COST越小)
  2. 比较上游转发BPDU的交换机的桥ID,原则小。
  3. 比较端口ID(prot-ID)
Switch(config-if)#spanning-tree vlan 10 port-priority 
  <0-61440>  bridge priority in increments of 4096

Prot-ID=接口优先级+端口号

默认优先级为128

选择对端笑的PROT-ID的接口为根端口

 

指定端口:每条连接交换机的物理线路上的两个端口之一,必有一个指定端口转发/发送BPDU

  1. 根桥的所有端口都是指定端口 需要发送BPDU
  2. 比较到达根桥的COST值,越小越优先
  3. COST值相同,比较接口所在网桥的桥ID,越小越优先

MST配置

SW1(config)#spanning-tree mode mst
SW1(config)#spanning-tree mst configuration   //配置MST
SW1(config)#name CCIE
SW1(config)#revision 1
SW1(config)#instance 1 vlan 10,20

SW1(config)#spanning-tree mst 1 root primary  //1为主根
SW1(config)#spanning-tree mst 2 root secondary