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

每个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 SW1 SW1(config)#interface range fastEthernet /- SW1(config-if-range)#switchport mode trunk SW1(config-if-range)#end SW1#show interfaces trunk
Port Mode Encapsulation Status Native vlan
Fa0/ on .1q trunking
Fa0/ on .1q trunking Port Vlans allowed on trunk
Fa0/ -
Fa0/ - Port Vlans allowed and active in management domain
Fa0/
Fa0/ Port Vlans in spanning tree forwarding state and not pruned
Fa0/ none
Fa0/ none SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z. SW1(config)#vlan
SW1(config-vlan)#name caiwu
SW1(config-vlan)#vlan
SW1(config-vlan)#name it SW1(config)#end SW1#show vlan brief VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
default active Fa0/, Fa0/, Fa0/, Fa0/
Fa0/, Fa0/, Fa0/, Fa0/
Fa0/, Fa0/, Fa0/, Fa0/
Fa0/, Fa0/, Fa0/, Fa0/
Fa0/, Fa0/, Fa0/, Fa0/
Fa0/, Fa0/, Gig0/, Gig0/
caiwu active
it active
fddi-default active
token-ring-default active
fddinet-default active
trnet-default

SW3 划分VLAN 配置

SW3#conf t
Enter configuration commands, one per line. End with CNTL/Z. SW3(config)#interface range fastEthernet /- SW3(config-if-range)#switchport mode access SW3(config-if-range)#switchport access vlan SW3(config-if-range)#interface range fastEthernet /- SW3(config-if-range)#switchport mode access SW3(config-if-range)#switchport access vlan
SW3(config-if-range)#end SW3#show vlan brief VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
default active Fa0/, Fa0/, Fa0/, Fa0/
Fa0/, Fa0/, Fa0/, Fa0/
Fa0/, Fa0/, Fa0/, Fa0/
Fa0/, Fa0/, Fa0/, Fa0/
Fa0/, Fa0/, Gig0/, Gig0/
caiwu active Fa0/, Fa0/
it active Fa0/, Fa0/
fddi-default active
token-ring-default active
fddinet-default active
trnet-default active
SW3#

查看

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

SW1

SW1#show version 

63488K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address : 0001.9766.27A9
Motherboard assembly number : --
Power supply part number : --
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 SW2 SW2#show version 63488K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address : .E44D.7A96
Motherboard assembly number : --
Power supply part number : --
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 SW3 SW3#show version
63488K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address : 00D0.97CD.098A
Motherboard assembly number : --
Power supply part number : --
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
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority
Address 0001.9766.27A9
This bridge is the root
Hello Time sec Max Age sec Forward Delay sec Bridge ID Priority (priority sys-id-ext )
Address 0001.9766.27A9
Hello Time sec Max Age sec Forward Delay sec
Aging Time Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/ Desg FWD 128.23 P2p
Fa0/ Desg FWD 128.24 P2p VLAN0002
Spanning tree enabled protocol ieee
Root ID Priority
Address 0001.9766.27A9
This bridge is the root
Hello Time sec Max Age sec Forward Delay sec Bridge ID Priority (priority sys-id-ext )
Address 0001.9766.27A9
Hello Time sec Max Age sec Forward Delay sec
Aging Time Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/ Desg FWD 128.23 P2p
Fa0/ Desg FWD 128.24 P2p VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority
Address 0001.9766.27A9
This bridge is the root
Hello Time sec Max Age sec Forward Delay sec Bridge ID Priority (priority sys-id-ext )
Address 0001.9766.27A9
Hello Time sec Max Age sec Forward Delay sec
Aging Time Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/ Desg FWD 128.23 P2p
Fa0/ Desg FWD 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 mode
rapid-pvst Per-Vlan rapid spanning tree mode SW1(config)#spanning-tree mode rapid-pvst

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

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

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

SW1

SW1(config)#spanning-tree vlan  priority ?
<-> bridge priority in increments of #可以使用思科的宏命令
SW1(config)#spanning-tree vlan root primary SW1(config)#spanning-tree vlan root secondary SW1#show running-config
Building configuration... Current configuration : 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/
!

SW2

SW2>en
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z. SW2(config)#spanning-tree vlan root ?
primary Configure this switch as primary root for this spanning tree #相反
SW2(config)#spanning-tree vlan root primary SW2(config)#spanning-tree vlan root secondary SW2#show running-config
Building configuration... Current configuration : 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
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority
Address 0001.9766.27A9
This bridge is the root
Hello Time sec Max Age sec Forward Delay sec Bridge ID Priority (priority sys-id-ext )
Address 0001.9766.27A9
Hello Time sec Max Age sec Forward Delay sec
Aging Time Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/ Desg FWD 128.23 P2p
Fa0/ Desg FWD 128.24 P2p VLAN0002
Spanning tree enabled protocol rstp
Root ID Priority
Address 0001.9766.27A9
This bridge is the root
Hello Time sec Max Age sec Forward Delay sec Bridge ID Priority (priority sys-id-ext )
Address 0001.9766.27A9
Hello Time sec Max Age sec Forward Delay sec
Aging Time Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/ Desg FWD 128.23 P2p
Fa0/ Desg FWD 128.24 P2p VLAN0003
Spanning tree enabled protocol rstp
Root ID Priority
Address .E44D.7A96
Cost
Port (FastEthernet0/)
Hello Time sec Max Age sec Forward Delay sec Bridge ID Priority (priority sys-id-ext )
Address 0001.9766.27A9
Hello Time sec Max Age sec Forward Delay sec
Aging Time Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/ Root FWD 128.23 P2p
Fa0/ Desg FWD 128.24 P2p

SW2

SW2# show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority
Address 0001.9766.27A9
Cost
Port (FastEthernet0/)
Hello Time sec Max Age sec Forward Delay sec Bridge ID Priority (priority sys-id-ext )
Address .E44D.7A96
Hello Time sec Max Age sec Forward Delay sec
Aging Time Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/ Root FWD 128.23 P2p
Fa0/ Desg FWD 128.24 P2p VLAN0002
Spanning tree enabled protocol rstp
Root ID Priority
Address 0001.9766.27A9
Cost
Port (FastEthernet0/)
Hello Time sec Max Age sec Forward Delay sec Bridge ID Priority (priority sys-id-ext )
Address .E44D.7A96
Hello Time sec Max Age sec Forward Delay sec
Aging Time Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/ Root FWD 128.23 P2p
Fa0/ Desg FWD 128.24 P2p VLAN0003
Spanning tree enabled protocol rstp
Root ID Priority
Address .E44D.7A96
This bridge is the root
Hello Time sec Max Age sec Forward Delay sec Bridge ID Priority (priority sys-id-ext )
Address .E44D.7A96
Hello Time sec Max Age sec Forward Delay sec
Aging Time Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/ Desg FWD 128.23 P2p
Fa0/ Desg FWD 128.24 P2p

配置STP、RSTP以及负载均衡的更多相关文章

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

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

  2. Tomcat:利用Apache配置反向代理、负载均衡

    本篇主要介绍apache配置反向代理,介绍了两种情况:第一种是,只使用apache配置反向代理:第二种是,apache与应用服务器(tomcat)结合,配置反向代理,同时了配置了负载均衡. 准备工作 ...

  3. apache+jetty 配置web jsp服务器负载均衡

    首先,查找中文资料,貌似很少,有一个网友写了点,但是1版本过老,2有些地方有错误. 经过我自己摸索,记录一下.这个图很简洁明了 第一阶段 ,配置jetty 首先从 http://download.ec ...

  4. 运维小知识之nginx---nginx配置Jboss集群负载均衡

      codyl 2016-01-26 00:53:00 浏览385 评论0 负载均衡 转自 运维小知识之nginx---nginx配置Jboss集群负载均衡-博客-云栖社区-阿里云https://yq ...

  5. [笔记]nginx配置反向代理和负载均衡

    1.nginx配置文件:源码安装情况下,nginx.conf在解压后的安装包内.yum安装,一般情况下,一部分在/etc/nginx/nginx.conf中,一部分在/etc/nginx/conf.d ...

  6. Ngigx+Tomcat配置动静分离,负载均衡

    由于公司使用过Ngnix,对于刚接触Nginx来说,感觉有些好奇,于是研究了下. 本人在windows下使用的版本是nginx-1.8.1: 1. 启动Ngnix 双击nginx-1.8.1文件夹中n ...

  7. 广州项目实施步骤II_练习配置HaProxy的重定向负载均衡

    CentOS6.4 配置Haproxy   Haproxy下载地址:http://pan.baidu.com/share/link?shareid=1787182295&uk=18290183 ...

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

    一.常见JavaWeb服务器      1.WebLogic:是BEA公司的产品.WebSphereAS:是IBM公司的产品.JBossAS:红帽公司的产品,可以自行了解      2.Tomcat服 ...

  9. Ubuntu下配置 keepalived+nginx+tomcat 负载均衡

    本文力图阐述在 Ubuntu Server 环境下使用 Keepalived + Nginx + Tomcat 搭建高可用负载均衡环境的操作步骤和简约配置,这里不涉及性能调优.先说一下他们各自扮演的角 ...

随机推荐

  1. 查看JVM内存使用状况

    1.jps:查看本地正在运行的java进程和进程ID(pid) 2.jinfo pid,查看指定pid的所有JVM信息 1)jinfo -flags pid 查询虚拟机运行参数信息. 2)jinfo ...

  2. 菜鸟使用MySQL存储过程and临时表,供新手参考,请高手斧正

    因为公司最近的一个项目,第一次用到了MySQL(5.10版本),之前听传说MySQL很厉害的样子,因为开源而神奇,但是现在用起来, 感觉并不好啊!我知道是我水平太down,呜呜呜,请各路神仙略施小技, ...

  3. html中form表单的使用方法和介绍

    from表单的使用方法 一.表单赏析 二.了解表单功能:用于搜集不同类型的用户输入的内容 有了表单,网页的内容可以由用户自己创建,那么对于网页来说,我们既是网页创建都者,也是网页的消费者. 三.常用的 ...

  4. React-Error

    1. react创建一个单页应用,官网给的命令是ngx create-react-app my-project 2. window上表示,安装失败 3.解放办法:npm install -g crea ...

  5. 刷seed有感

    今天又把seed刷了一遍 昨天去了基佬他们公司.第一次去他们公司.米虫科技,在重庆算是一家中型公司吧. 他去公司加班写一个游戏的封面,第一次感觉ui的不给设计图真的很坑.一个页面所有东西 自己凭感觉写 ...

  6. java求0~100的质数(素数)

    质数的概念: 简单的来说就是一个数从2开始取模到(求余数)自身的值,如果取模后余数一直不等于0那么这个数就是质数(素数). 如 7     7%2    7%3    7%4    7%5   7%6 ...

  7. node.js http接口调试时请求串行特性分析

    缘起: 产品业务上有个类数据库服务的请求时间比较长(类似mysql的sql查询),为了优化减少并发时的请求数,做了一个并发时共用请求的优化. 通过单元测试后,想通过手动模拟看下效果,发现优化一直不能生 ...

  8. POJ - 2777——Count Color(懒标记线段树二进制)

    Count Color Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 53639   Accepted: 16153 Des ...

  9. error: 'retain' is unavailable: not available in automatic reference counting. 解决办法

    报错原因是 项目使用的是ARC,但是有非ARC代码. 项目中要混合使用ARC和非ARC. 解决: target -> Build Phases -> Compile Sources 双击报 ...

  10. egret 简单的四方向的a星寻路,在wing中可以直接跑

    /** * main类中加载场景 * 创建游戏场景 * Create a game scene */ private createGameScene() { MtwGame.Instance.init ...