思科pvst实现流量负载均衡

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了思科pvst实现流量负载均衡相关的知识,希望对你有一定的参考价值。

技术分享图片
1、根据拓扑配置PC地址为192.168.1.1-192.168.1.4
2、配置下方的交换机
交换机创建vlan 10 20
Switch(config)#vlan 10
Switch(config)#vlan 20
把交换机相连的接口改成trunk
Switch(config)#Interface range f0/1-2
Switch(config-if)Switchport mode trunk
Switch(config-if)exit
接口划入vlan
Switch(config)#interface f0/3
Switch(config-if)#switchport access vlan 10
Switch(config-if)#interface f0/4
Switch(config-if)#switchport access vlan 20
Switch(config-if)#
2、配置左上方的交换机
交换机创建vlan 10 20
Switch(config)#vlan 10
Switch(config)#vlan 20
把交换机相连的接口改成trunk
Switch(config)#Interface range f0/1-2
Switch(config-if)Switchport mode trunk
Switch(config-if)exit
接口划入vlan
Switch(config)#interface f0/3
Switch(config-if)#switchport access vlan 10
Switch(config-if)#interface f0/4
Switch(config-if)#switchport access vlan 20
配置此交换机为vlan 10的根,vlan 20的备份
witch(config)#spanning-tree vlan 10 root primary
Switch(config)#spanning-tree vlan 20 root secondary

4、右上方的交换机配置
交换机创建vlan 10 20
Switch(config)#vlan 10
Switch(config)#vlan 20
把交换机相连的接口改成trunk
Switch(config)#Interface range f0/1-2
Switch(config-if)Switchport mode trunk
Switch(config-if)exit
配置此交换机为vlan 20的根,vlan 10的备份
switch(config)#spanning-tree vlan 20 root primary
Switch(config)#spanning-tree vlan 10 root secondary

5、可以用show spanning-tree
Switch#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 000A.F37D.977E
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 000D.BD52.1362
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 Root FWD 19 128.2 P2p

VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address 000D.BD52.1362
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 24586 (priority 24576 sys-id-ext 10)
Address 000D.BD52.1362
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
Fa0/3 Desg FWD 19 128.3 P2p

VLAN0020
Spanning tree enabled protocol ieee
Root ID Priority 24596
Address 000A.F37D.977E
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 28692 (priority 28672 sys-id-ext 20)
Address 000D.BD52.1362
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 Root FWD 19 128.2 P2p
Fa0/4 Desg FWD 19 128.4 P2p

可以抓包看VLAN10和VLAN20 的流量走向,VLAN10 走左边,VLAN20 走右边

以上是关于思科pvst实现流量负载均衡的主要内容,如果未能解决你的问题,请参考以下文章

STP的算法与PVST+实现负载均衡

生成树协议(STP)原理与配置PVST+实现负载均衡

思科路由器PBR(策略路由)结合IP SLA实现双线备份和负载均衡

TCP长连接下,流量负载均衡的做法

负载均衡续:万亿流量场景下的负载均衡实践

负载均衡实现方式