生成树协议是一种二层管理协议,它通过有选择性地阻塞网络冗余链路来达到消除网络二层环路的目的,同时具备链路的备份功能。

每个VLAN都生成一棵树是一种比较直接,而且最简单的解决方法。它能够保证每一个VLAN都不存在环路。但是由于种种原因,以这种方式工作的生成树协议并没有形成标准,而是各个厂商各有一套,尤其是以Cisco的VLAN生成树PVST(Per VLAN Spanning Tree)为代表。

SW1,SW2,SW3同一的配置。  SW1为例

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname SW1SW1(config)#interface range fastEthernet 0/23-24SW1(config-if-range)#switchport mode trunk SW1(config-if-range)#endSW1#show interfaces trunk
Port        Mode         Encapsulation  Status        Native vlan
Fa0/23      on           802.1q         trunking      1
Fa0/24      on           802.1q         trunking      1Port        Vlans allowed on trunk
Fa0/23      1-1005
Fa0/24      1-1005Port        Vlans allowed and active in management domain
Fa0/23      1
Fa0/24      1Port        Vlans in spanning tree forwarding state and not pruned
Fa0/23      none
Fa0/24      noneSW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.SW1(config)#vlan 2
SW1(config-vlan)#name caiwu
SW1(config-vlan)#vlan 3
SW1(config-vlan)#name itSW1(config)#endSW1#show vlan brief VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4Fa0/5, Fa0/6, Fa0/7, Fa0/8Fa0/9, Fa0/10, Fa0/11, Fa0/12Fa0/13, Fa0/14, Fa0/15, Fa0/16Fa0/17, Fa0/18, Fa0/19, Fa0/20Fa0/21, Fa0/22, Gig0/1, Gig0/2
2    caiwu                            active
3    it                               active
1002 fddi-default                     active
1003 token-ring-default               active
1004 fddinet-default                  active
1005 trnet-default 

SW3 划分VLAN 配置

SW3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.SW3(config)#interface range fastEthernet 0/1-2SW3(config-if-range)#switchport mode  access SW3(config-if-range)#switchport access vlan 2SW3(config-if-range)#interface range fastEthernet 0/3-4SW3(config-if-range)#switchport mode  access SW3(config-if-range)#switchport access vlan 3
SW3(config-if-range)#endSW3#show vlan brief VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/5, Fa0/6, Fa0/7, Fa0/8Fa0/9, Fa0/10, Fa0/11, Fa0/12Fa0/13, Fa0/14, Fa0/15, Fa0/16Fa0/17, Fa0/18, Fa0/19, Fa0/20Fa0/21, Fa0/22, Gig0/1, Gig0/2
2    caiwu                            active    Fa0/1, Fa0/2
3    it                               active    Fa0/3, Fa0/4
1002 fddi-default                     active
1003 token-ring-default               active
1004 fddinet-default                  active
1005 trnet-default                    active
SW3#

查看

BID:优先级+MAC (MAC地址数字越小,为根桥)

SW1SW1#show version 63488K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address       : 0001.9766.27A9
Motherboard assembly number     : 73-9832-06
Power supply part number        : 341-0097-02
Motherboard serial number       : FOC103248MJ
Power supply serial number      : DCA102133JA
Model revision number           : B0
Motherboard revision number     : C0
Model number                    : WS-C2960-24TT
System serial number            : FOC1033Z1EYSW2SW2#show version 63488K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address       : 0003.E44D.7A96
Motherboard assembly number     : 73-9832-06
Power supply part number        : 341-0097-02
Motherboard serial number       : FOC103248MJ
Power supply serial number      : DCA102133JA
Model revision number           : B0
Motherboard revision number     : C0
Model number                    : WS-C2960-24TT
System serial number            : FOC1033Z1EYSW3SW3#show version
63488K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address       : 00D0.97CD.098A
Motherboard assembly number     : 73-9832-06
Power supply part number        : 341-0097-02
Motherboard serial number       : FOC103248MJ
Power supply serial number      : DCA102133JA
Model revision number           : B0
Motherboard revision number     : C0
Model number                    : WS-C2960-24TT
System serial number            : FOC1033Z1EY

SW1

SW1#show spanning-tree
VLAN0001Spanning tree enabled protocol ieeeRoot ID    Priority    32769Address     0001.9766.27A9This bridge is the rootHello Time  2 sec  Max Age 20 sec  Forward Delay 15 secBridge ID  Priority    32769  (priority 32768 sys-id-ext 1)Address     0001.9766.27A9Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secAging Time  20Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23           Desg FWD 19        128.23   P2p
Fa0/24           Desg FWD 19        128.24   P2pVLAN0002Spanning tree enabled protocol ieeeRoot ID    Priority    32770Address     0001.9766.27A9 This bridge is the rootHello Time  2 sec  Max Age 20 sec  Forward Delay 15 secBridge ID  Priority    32770  (priority 32768 sys-id-ext 2)Address     0001.9766.27A9Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secAging Time  20Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23           Desg FWD 19        128.23   P2p
Fa0/24           Desg FWD 19        128.24   P2pVLAN0003Spanning tree enabled protocol ieeeRoot ID    Priority    32771Address     0001.9766.27A9This bridge is the rootHello Time  2 sec  Max Age 20 sec  Forward Delay 15 secBridge ID  Priority    32771  (priority 32768 sys-id-ext 3)Address     0001.9766.27A9Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secAging Time  20Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23           Desg FWD 19        128.23   P2p
Fa0/24           Desg FWD 19        128.24   P2p

SW1 SW2 SW3 配置快速STP

SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#sp
SW1(config)#spanning-tree mode ?pvst        Per-Vlan spanning tree moderapid-pvst  Per-Vlan rapid spanning tree modeSW1(config)#spanning-tree mode rapid-pvst 

根 负载均衡 配置。  默认(4096)倍数     primary -4096-4096  ...   secondary -4096

SW1成为VLAN2的根,VLAN3的备份根

SW2成为VLAN3的根,  VLAB2的备份根

SW1

SW1(config)#spanning-tree vlan 2 priority ?<0-61440>  bridge priority in increments of 4096#可以使用思科的宏命令
SW1(config)#spanning-tree vlan 2 root primary SW1(config)#spanning-tree vlan 3 root secondary SW1#show running-config
Building configuration...Current configuration : 1197 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname SW1
!
!
!
!
!
spanning-tree mode rapid-pvst
spanning-tree extend system-id
spanning-tree vlan 2 priority 24576
spanning-tree vlan 3 priority 28672
!
interface FastEthernet0/1
!

SW2

SW2>en
SW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.SW2(config)#spanning-tree vlan 3 root ?primary    Configure this switch as primary root for this spanning tree#相反
SW2(config)#spanning-tree vlan 3 root primary SW2(config)#spanning-tree vlan 2 root secondary SW2#show running-config
Building configuration...Current configuration : 1197 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname SW2
!
!
!
!
!
spanning-tree mode rapid-pvst
spanning-tree extend system-id
spanning-tree vlan 3 priority 24576
spanning-tree vlan 2 priority 28672

查看是否配置正确

SW1

SW1# show spanning-tree
VLAN0001Spanning tree enabled protocol rstpRoot ID    Priority    32769Address     0001.9766.27A9This bridge is the rootHello Time  2 sec  Max Age 20 sec  Forward Delay 15 secBridge ID  Priority    32769  (priority 32768 sys-id-ext 1)Address     0001.9766.27A9Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secAging Time  20Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23           Desg FWD 19        128.23   P2p
Fa0/24           Desg FWD 19        128.24   P2pVLAN0002Spanning tree enabled protocol rstpRoot ID    Priority    24578Address     0001.9766.27A9This bridge is the rootHello Time  2 sec  Max Age 20 sec  Forward Delay 15 secBridge ID  Priority    24578  (priority 24576 sys-id-ext 2)Address     0001.9766.27A9Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secAging Time  20Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23           Desg FWD 19        128.23   P2p
Fa0/24           Desg FWD 19        128.24   P2pVLAN0003Spanning tree enabled protocol rstpRoot ID    Priority    24579Address     0003.E44D.7A96Cost        19Port        23(FastEthernet0/23)Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secBridge ID  Priority    28675  (priority 28672 sys-id-ext 3)Address     0001.9766.27A9Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secAging Time  20Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23           Root FWD 19        128.23   P2p
Fa0/24           Desg FWD 19        128.24   P2p

SW2

SW2# show spanning-tree
VLAN0001Spanning tree enabled protocol rstpRoot ID    Priority    32769Address     0001.9766.27A9Cost        19Port        23(FastEthernet0/23)Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secBridge ID  Priority    32769  (priority 32768 sys-id-ext 1)Address     0003.E44D.7A96Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secAging Time  20Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23           Root FWD 19        128.23   P2p
Fa0/24           Desg FWD 19        128.24   P2pVLAN0002Spanning tree enabled protocol rstpRoot ID    Priority    24578Address     0001.9766.27A9Cost        19Port        23(FastEthernet0/23)Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secBridge ID  Priority    28674  (priority 28672 sys-id-ext 2)Address     0003.E44D.7A96Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secAging Time  20Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23           Root FWD 19        128.23   P2p
Fa0/24           Desg FWD 19        128.24   P2pVLAN0003Spanning tree enabled protocol rstpRoot ID    Priority    24579Address     0003.E44D.7A96 This bridge is the rootHello Time  2 sec  Max Age 20 sec  Forward Delay 15 secBridge ID  Priority    24579  (priority 24576 sys-id-ext 3)Address     0003.E44D.7A96Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 secAging Time  20Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23           Desg FWD 19        128.23   P2p
Fa0/24           Desg FWD 19        128.24   P2p

转载于:https://www.cnblogs.com/peter1007/p/9404885.html

配置STP、RSTP以及负载均衡相关推荐

  1. linux nginx 安装stream,Centos7-64bit-编译安装配置Nginx stream四层负载均衡 动态加载

    Centos7-64bit-编译安装配置Nginx stream四层负载均衡 动态加载 2018-08-10 17:12 分享人:老牛 yum install screen -y && ...

  2. Caddy - Web服务器的新秀 高性能 配置简单 动态代理 负载均衡

    Caddy - Web服务器的新秀 高性能 配置简单 动态代理 负载均衡 据Netcraft今年5月份放出了一篇统计文章中,Apache.Nginx和微软的IIS分别以45.61%.20.22%和7. ...

  3. Windos环境用Nginx配置反向代理和负载均衡

    Windos环境用Nginx配置反向代理和负载均衡 引言:在前后端分离架构下,难免会遇到跨域问题.目前的解决方案大致有JSONP,反向代理,CORS这三种方式.JSONP兼容性良好,最大的缺点是只支持 ...

  4. Tomcat安装、配置、优化及负载均衡详解

    博客园 首页 新随笔 联系 管理 订阅 随笔- 31  文章- 0  评论- 25  Tomcat安装.配置.优化及负载均衡详解 一.常见JavaWeb服务器      1.WebLogic:是BEA ...

  5. eNSP配置基于VRRP的负载均衡出口链路

    实验目的 为实现双出口的流量负载均衡,可以为不同的计算机指定不同的网关,使内部流量能通过不同的出口路由器进行转发.网关可以使用多个VRRP组来实现,并通过设置VRRP组中不同路由器的优先级,可使不同的 ...

  6. SpringBoot2/SpringBoot/Java动态数据源配置、动态连接池配置、多数据源负载均衡

    Java动态数据源配置.动态连接池配置.多数据源负载均衡 大家好,今天给大家推荐一个自产的连接池插件.废话不多说,本文接口分为以下主题: 1. 插件开发背景: 2. 插件提供的能力: 3. 插件的使用 ...

  7. nginx 负载均衡配置_LINUX系统nginx负载均衡配置

    1. 下载nginxhttp://nginx.org/en/download.html,选择Stable version 2. 解压至/usr/local目录,生成nginx-1.16.1 3. 安装 ...

  8. Nginx 配置TCP和UDP负载均衡

    前言 Nginx除了以前常用的HTTP负载均衡外,Nginx增加基于TCP协议实现的负载均衡方法. HTTP负载均衡,也就是我们通常所有"七层负载均衡",工作在第七层"应 ...

  9. nginx 配置反向代理和负载均衡

    Nginx的配置文件: nginx安装目录/conf/nginx.conf 重新加载配置文件 ./nginx -s reload 配置虚拟主机 一个server就是一台虚拟主机 server {lis ...

  10. nginx配置反向代理和负载均衡完结篇

    具体安装配置参考之前的文章 https://blog.csdn.net/weixin_44001965/article/details/102723855 文章目录 一,nginx操作的常用命令 ng ...

最新文章

  1. CCNA实验解析——VLAN间的路由的配置
  2. java可存储100个整数的数组_定义一个一维整数数组,其中储存1000个1至100以内的整数,并统计出整数出现的次数(Java写出来)...
  3. LeetCode 面试题 03 数组中重复的数字
  4. WAS集群系列(5):集群搭建:步骤3:安装IHS软件
  5. 洛谷P1273 有线电视网
  6. JS学习总结(11)—— JSON
  7. 4linux--------操作系统介绍 - 项目前导必备------全栈式开发40
  8. 计算机网络nic,NIC,什么是NIC,NIC介绍--电子百科词库--科通芯城,IC及其他电子元器件交易型电商平台100%正品保证...
  9. ps抠图基础篇:最常用的四种抠图方法
  10. scrapy 去重 dont_filter=False
  11. imx6ul-正点原子-imx6ul学习笔记(5)
  12. 苹果手机上的python编程软件-Python编程软件有哪些?
  13. 字体反爬虫处理猫眼(数字)
  14. CISCO banner MOTD, Login的区别
  15. 如何阅读《深入理解计算机系统》
  16. WPF TextBlock自定义内容_se7en3_新浪博客
  17. 杭电1856——并差集
  18. 骂人的到底是些什么人
  19. sql文字转换全拼_取汉字全拼的SQL函数
  20. python找不到第三方安装库

热门文章

  1. 再看电商 - 黄若 摘录
  2. MyBatis 持久化框架快速使用入门(Xml配置版)
  3. Cglib 代码生成库使用快速入门
  4. java.awt Robot 自动化测试 与 KeyEvent 常用按键
  5. 小D课堂 - 零基础入门SpringBoot2.X到实战_第4节 Springboot2.0单元测试进阶实战和自定义异常处理_18、SpringBoot测试进阶高级篇之MockMvc讲解...
  6. Vuejs2.0学习之二(Render函数,createElement,vm.$slots,函数化组件,模板编译,JSX)...
  7. 树莓派使用无线网卡上网相关命令
  8. U盘做启动盘后,如何恢复原始容量
  9. 美国数据不佳美元仍跳升,只因欧元区问题更多
  10. MariaDB修改端口号