思科模拟器配置-生成树协议与链路聚合负载均衡

1. 生成树基本概念

生成树的定义 :STP就是在具有回路的交换机网络上,生成没有回路的逻辑网络的方法。

STP有两种特殊的网桥:根桥和指定桥。网桥上的端口有不同的角色:根端口、指定端口和阻塞端口。

STP的作用是为了防止环路问题,其实环路问题如果控制好,可以形成冗余链路,起到备用线路的作用,不过一般不用,环路有很多缺陷,如:易读性差,不好控制等。

STP工作原理:
在这里插入图片描述

通俗易懂的讲:

STP协议通过交换机 ID 自动协商 谁为主根交换机,主根交换机跟所有网络相通,而其它交换机连接了根交换机的那个端口也必须相通,而ID小的会被优先down掉端口,从而避免环线带来的广播风暴。
STP可以通过人工干预优先级 谁为主根交换机,从而达到可控性与提高通信效率。

关于生成树协议包结构分析我写在了下面:

https://blog.csdn.net/qq_38626043/article/details/103872383

除了STP协议,现在已经有了RSTP协议(快速生成树协议)与MSTP(多生成树协议,支持vlan生成根)

RSTP:
在这里插入图片描述

MSTP:

在这里插入图片描述

2. 链路聚合

  1. 概念
    也叫做链路汇聚或端口聚合。是将交换机上的多个端口在物理上连接起来,在逻辑上捆绑在一起,形成一个有较大带宽的端口,实现负载均衡,并提供冗余链路

在这里插入图片描述

  1. 链路聚合的工作原理 。
    链路聚合是链路带宽扩展的一个重要途径,符合802.3ad标准。它可以把多个端口的带宽叠加起来.

在这里插入图片描述

  1. 聚合协议

PAgP(Port Aggregation Protocol,端口聚集协议)和LACP(Link Aggregation Control Protocol,链路聚集控制协议)都是用于自动创建链路聚合的。所不同的是,PAgP是思科专有协议,而LACP是IEEE 802.3ad定义的公开标准,这就像ISL和802.1Q一样 。无论是PAgP还是LACP,都是通过在交换机的级联接口之间互相发送数据包来协商创建链路聚合的。交换机接口收到对方的要求建立PAgP或者LACP数据后,如果允许,交换机会动态将物理端口捆绑形成聚合链路。

  1. 聚合条件
  • 端口必须处于相同的VLAN之中或都为TRUNK口(其Allowed Vlan和Native Vlan都应该相同)
  • 端口必须使用相同的网络介质
  • 端口必须都处于全双工工作模式
  • 端口必须是相同传输速率的端口
  • 本端是手工(动态)配置,另外一端也应该是手工(动态)配置

3. 实例

在这里插入图片描述
配置两端IP

S0:

Switch(config)#interface range fastEthernet 0/1-2
Switch(config-if-range)#switchport mode trunk 
Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

Switch(config-if-range)#channel-protocol lacp
Switch(config-if-range)#channel-group 1 mode active 
Creating a port-channel interface Port-channel 1

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

Switch(config-if-range)#
Switch(config)#port-channel load-balance dst-ip

PAgP是只有思科的设备才有,所以一般建议配置LACP。

  • PAgP - 思科专利
  • LACP (IEEE 802.3ad) - 国际通用标准

在交换机查看端口聚合可以使用的协议
其实如果两边都配置active 也是可以的,现在的交换机都比较智能,都能自动识别。

  active   Enable LACP unconditionally						#主动发送LACP报文
  auto    Enable PAgP only if a PAgP device is detected		#被动发送PAgP报文
  desirable  Enable PAgP unconditionally					#主动发送PAgP报文
  on       Enable Etherchannel only							#手动设置,需要两边都设置成on
  passive  Enable LACP only if a LACP device is detected	#被动接收LACP报文

S1:

Switch(config)#interface range fastEthernet 0/1-2
Switch(config-if-range)#switchport mode trunk 
Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

Switch(config-if-range)#channel-protocol lacp
Switch(config-if-range)#channel-group 1 mode passive
Creating a port-channel interface Port-channel 1

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

Switch(config-if-range)#
Switch(config)#port-channel load-balance dst-ip

在这里插入图片描述

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

_abcdef

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值