交换机链路聚合
一、实验目的
1、了解链路聚合技术的使用场合;
2、熟练掌握链路聚合技术的配置。
二、应用环境
两个实验室分别使用一台交换机提供20多个信息点,两个实验室的互通通过一根级联网线。每个实验室的信息点都是百兆到桌面。两个实验室之间的带宽也是100M,如果实验室之间需要大量传输数据,就会明显感觉带宽资源紧张。当楼层之间大量用户都希望以100M传输数据的时候,楼层间的链路就呈现出了独木桥的状态,必然造成网络传输效率下降等后果。
解决这个问题的办法就是提高楼层主交换机之间的连接带宽,实现的办法可以是采用千兆端口替换原来的100M端口进行互联,但这样无疑会增加组网的成本,需要更新端口模块,并且线缆也需要作进一步的升级。另一种相对经济的升级办法就是链路聚合技术。
顾名思义,链路聚合,是将几个链路作聚合处理,这几个链路必须是同时连接两个相同的设备的,这样,当作了链路聚合之后就可以实现几个链路相加的带宽了。比如,我们可以将4个100M链路使用链路聚合作成一个逻辑链路,这样在全双工条件下就可以达到800M的带宽,即将近1000M的带宽。这种方式比较经济,实现也相对容易。
三、实验设备
1、DCS-3926S交换机2台
2、PC机2台
3、Console线1-2根
4、直通网线4-8根
四、实验拓扑
五、实验要求
设备 |
IP |
Mask |
端口 |
交换机A |
192.168.1.11 |
255.255.255.0 |
0/0/1-2 trunking |
交换机B |
192.168.1.12 |
255.255.255.0 |
0/0/3-4 trunking |
PC1 |
192.168.1.101 |
255.255.255.0 |
交换机A0/0/23 |
PC2 |
192.168.1.102 |
255.255.255.0 |
交换机B0/0/24 |
如果链路聚合成功,则PC1可以ping通PC2。
六、实验步骤
第一步:正确连接网线,交换机全部恢复出厂设置,做初始配置,避免广播风暴出现
交换机A:
switch#config
switch(Config)#hostname switchA
switchA(Config)#interface vlan 1
switchA(Config-If-Vlan1)#ip address 192.168.1.11 255.255.255.0
switchA(Config-If-Vlan1)#no shutdown
switchA(Config-If-Vlan1)#exit
switchA(Config)#spanning-tree
MSTP is starting now, please wait...........
MSTP is enabled successfully.
switchA(Config)#
交换机B:
switch#config
switch(Config)#hostname switchB
switchB(Config)#interface vlan 1
switchB(Config-If-Vlan1)#ip address 192.168.1.12 255.255.255.0
switchB(Config-If-Vlan1)#no shutdown
switchB(Config-If-Vlan1)#exit
switchB(Config)#spanning-tree
MSTP is starting now, please wait...........
MSTP is enabled successfully.
switchB(Config)#
第二步:创建port group
交换机A:
switchA(Config)#port-group 1
switchA(Config)#
验证配置:
switchA#show port-group detail
Sorted by the ports in the group 1:
--------------------------------------------
switchA#show port-group brief
Port-group number : 1
Number of ports in port-group : 0Maxports in port-channel = 8
Number of port-channels : 0Max port-channels : 1
switchA#
交换机B
switchB(Config)#port-group 2
switchB(Config)#
第三步:手工生成链路聚合组(第三、四步任选其一操作)
交换机A:
switchA(Config)#interface ethernet 0/0/1-2
switchA(Config-Port-Range)#port-group 1 mode on
switchA(Config-Port-Range)#exit
switchA(Config)#interface port-channel 1
switchA(Config-If-Port-Channel1)#
验证配置:
switchA#show vlan
VLAN NameTypeMediaPorts
---- ------------ ---------- --------- -------------------
1defaultStaticENETEthernet0/0/3Ethernet0/0/4
Ethernet0/0/5Ethernet0/0/6
Ethernet0/0/7Ethernet0/0/8
Ethernet0/0/9Ethernet0/0/10
Ethernet0/0/11Ethernet0/0/12
Ethernet0/0/13Ethernet0/0/14
Ethernet0/0/15Ethernet0/0/16
Ethernet0/0/17Ethernet0/0/18
Ethernet0/0/19Ethernet0/0/20
Ethernet0/0/21Ethernet0/0/22
Ethernet0/0/23Ethernet0/0/24
Port-Channel1
switchA#!port-channel1已经存在
交换机B:
switchB(Config)#int e 0/0/3-4
switchB(Config-Port-Range)#port-group 2 mode on
switchB(Config-Port-Range)#exit
switchB(Config)#interface port-channel 2
switchB(Config-If-Port-Channel2)#
验证配置:
switchB#show port-group brief
Port-group number : 2
Number of ports in port-group : 2Maxports in port-channel = 8
Number of port-channels : 1Max port-channels : 1
switchB#
第四步:LACP动态生成链路聚合组(第三、四步任选其一操作)
switchA(Config)#interface ethernet 0/0/1-2
switchA(Conifg-Port-Range)#port-group 1 mode active
switchA(Config)#interface port-channel 1
switchA(Config-If-Port-Channel1)#
验证配置:
switchA#show vlan
VLAN NameTypeMediaPorts
---- ------------ ---------- --------- -------------------
1defaultStaticENETEthernet0/0/3Ethernet0/0/4
Ethernet0/0/5Ethernet0/0/6
Ethernet0/0/7Ethernet0/0/8
Ethernet0/0/9Ethernet0/0/10
Ethernet0/0/11Ethernet0/0/12
Ethernet0/0/13Ethernet0/0/14
Ethernet0/0/15Ethernet0/0/16
Ethernet0/0/17Ethernet0/0/18
Ethernet0/0/19Ethernet0/0/20
Ethernet0/0/21Ethernet0/0/22
Ethernet0/0/23Ethernet0/0/24
Port-Channel1
switchA#!port-channel1已经存在
交换机B:
switchB(Config)#interface ethernet 0/0/3-4
switchB(Conifg-Port-Range)#port-group 2 mode passive
switchB(Config)#interface port-channel 2
switchB(Config-If-Port-Channel2)#
验证配置:
switchB#show port-group brief
Port-group number : 2
Number of ports in port-group : 2Maxports in port-channel = 8
Number of port-channels : 1Max port-channels : 1
switchB#
第九步:使用ping命令验证
使用PC1 ping PC2
交换机A |
交换机B |
结果 |
原因 |
0/0/1 0/0/2 |
0/0/3 0/0/4 |
通 |
链路聚合组连接正确 |
0/0/1 0/0/2 |
0/0/3 |
通 |
拔掉交换机B端口4的网线,仍然可以通(需要一点时间),此时用show vlan 看看结果,port-channel消失。只有一个端口连接的时候,没有必要再维持一个port-channel了。 |
0/0/1 0/0/2 |
0/0/5 0/0/6 |
通 |
等候一小段时间后,仍然是通的。用show vlan看结果。此时把两台交换机的spanning-tree功能disable掉,这时候使用第三步和第四步的结果会不同。采用第四步的,将会形成环路。 |
七、注意事项和排错
1、为使Port Channel正常工作,Port Channel的成员端口必须具备以下相同的属性:
a)端口均为全双工模式;
b)端口速率相同;
c)端口的类型必须一样,比如同为以太口或同为光纤口;
d)端口同为Access端口并且属于同一个VLAN或同为Trunk端口;
e)如果端口为Trunk端口,则其Allowed VLAN和Native VLAN属性也应该相同。
2、支持任意两个交换机物理端口的汇聚,最大组数为6个,组内最多的端口数为8个。
3、一些命令不能在port-channel上的端口使用,包括:arp,bandwidth,ip,ip-forward等;
4、在使用强制生成端口聚合组时,由于汇聚是手工配置触发的,如果由于端口的VLAN信息不一致导致汇聚失败的话,汇聚组一直会停留在没有汇聚的状态,必须通过往该group增加和删除端口来触发端口再次汇聚,如果VLAN信息还是不一致仍然不能汇聚成功。直到VLAN信息都一致并且有增加和删除端口触发汇聚的情况下端口才能汇聚成功;
5、检查对端交换机的对应端口是否配置端口聚合组,且要查看配置方式是否相同,如果本端是手工方式则对端也应该配置成手工方式,如果本端是LACP动态生成则对端也应该是LACP动态生成,否则端口聚合组不能正常工作;还有一点要注意的是如果两端收发的都是LACP协议,至少有一端是ACTIVE的,否则两端都不会发起LACP数据报;
6、port-channel一旦形成之后,所有对于端口的设置只能在port-channel端口上进行;
7、LACP必须和Security和802.1X的端口互斥,如果端口已经配置上述两种协议,就不允许被起用LACP;
八、配置序列
略
九、课后练习
1、使用4根网线做链路聚合,通过插拔线缆观察结果。
2、把链路聚合组作为交换机之间的trunk链路,实现跨交换机的VLAN。
十、相关配置命令详解
port-group
命令:port-group
no port-group
功能:新建一个port group,并且设置该组的流量分担方式。如果没有指定流量分担方式则为设置默认的流量分担方式。该命令的no操作为删除该group或者恢复该组流量分担的默认值,敲入load-balance表示恢复默认流量分担,否则为删除该组。
参数:
缺省情况:缺省交换机端口不属于Port Channel,不启动LACP协议
命令模式:交换机全局配置模式
举例:新建一个port group,并且采用默认的流量分担方式
Switch(Config)#port-group 1
删除一个port group
Switch(Config)#no port-group 1
命令:port-group
no port-group
功能:将物理端口加入Port Channel,该命令的no操作为将端口从Port Channel中去除
参数:
命令模式:交换机端口配置模式
缺省情况:缺省交换机端口不属于Port Channel,不启动LACP协议
使用指南:如果不存在该组则会先建立该组,然后再将端口加到组中。在一个port-group中所有的端口加入的模式必须一样,以第一个加入该组的端口模式为准。端口以on模式加入一个组是强制性的,所谓强制性的表示本端交换机端口汇聚不依赖对端的信息,只要在组中有2个以上的端口,并且这些端口的vlan信息都一致则组中的端口就能汇聚成功。端口以active和passive方式加入一个组是运行lacp协议的,但两端必须有一个组中的端口是以active方式加入的,如果两端都是passive,端口永远都无法汇聚起来。
举例:在Ethernet0/0/1端口模式下,将本端口以active模式加入port-group 1
Switch(Config-Ethernet0/0/1)#port-group 1 mode active
interface port-channel
命令:interface port-channel
功能:进入汇聚端口配置模式
命令模式:全局配置模式
缺省情况:
使用指南:进入汇聚端口模式下配置时,如果是对gvrp,spanningtree模块做配置则对汇聚端口生效,如果汇聚端口不存在,也就是说在端口没有汇聚起来时先提示错误信息,记录该用户配置操作,当端口真正汇聚起来以后恢复用户刚才对未形成汇聚端口的配置动作,注意只能恢复一次,如果因为某种原因汇聚组被拆散然后又汇聚起来,用户一开始的配置不能被恢复。如果是对其他模块做配置,比如做shutdown, speed配置,则是对该port-channel对应的port-group中的所有成员端口生效,起到一个群配的作用。
举例:进入port-channel1配置模式
Switch(Config)#interface port-channel 1
Switch(Config-If-Port-Channel1)#
show port-group
命令:show port-group [
参数:
命令模式:特权配置模式
使用指南:如果没有指定port-group-number则表示显示所有port-group的信息。
举例:将端口0/0/1和0/0/2加入port-group 1中
1.显示交换机的port-group 1的摘要信息。
Switch#show port-group 1 brief
Port-group number : 1
Number of ports in group : 2Maxports = 8
Number of port-channels : 0Max port-channels : 1
显示内容 |
解释 |
Number of ports in group |
在port-group中的端口数 |
Maxports |
组中最大允许的端口数 |
Number of port-channels |
是否已经汇聚成一个汇聚端口 |
Max port-channels |
Port-group所能形成的最大汇聚端口数 |
2.显示交换机的port-group 1的详细信息。
Switch# show port-group 1 detail
Sorted by the ports in the group 1:
--------------------------------------------
port Ethernet0/0/1 :
both of the port and the agg attributes are not equal
the general information of the port are as follows:
portnumber: 1actor_port_agg_id:0partner_oper_sys:0x000000000000
partner_oper_key: 0x0001actor_oper_port_key: 0x0101
mode of the port: ACTIVElacp_aware: enable
begin: FALSEport_enabled: FALSElacp_ena: FALSEready_n: TRUE
the attributes of the port are as follows:
mac_type: ETH_TYPEspeed_type: ETH_SPEED_10M
duplex_type: FULLport_type: ACCESS
the machine state and port state of the port are as the follow
mux_state: DETCHrcvm_state: P_DISprm_state: NO_PER
actor_oper_port_state:L_A___F_
partner_oper_port_state:_TA___F_
port Ethernet0/0/2 :
both of the port and the agg attributes are not equal
the general information of the port are as follows:
portnumber: 2actor_port_agg_id:0partner_oper_sys:0x000000000000
partner_oper_key: 0x0002actor_oper_port_key: 0x0102
mode of the port: ACTIVElacp_aware: enable
begin: FALSEport_enabled: FALSElacp_ena: TRUEready_n: TRUE
the attributes of the port are as follows:
mac_type: ETH_TYPEspeed_type: ETH_SPEED_100M
duplex_type: FULLport_type: ACCESS
the machine state and port state of the port are as the follow
mux_state: DETCHrcvm_state: P_DISprm_state: NO_PER
actor_oper_port_state:L_A___F_
partner_oper_port_state:_TA___F_
显示内容 |
解释 |
portnumber |
端口号 |
actor_port_agg_id |
该端口加入的channel号,如果由于端口参数与channel的参数不一致导致该端口不能进入channel,显示为0 |
partner_oper_sys |
对端的system ID |
partner_oper_key |
对端的operational key |
actor_oper_port_key |
本端的operational key |
mode of the port |
端口加入组的模式 |
mac_type |
端口的类型,分标准以太网口和光纤分布式数据接口 |
speed_type |
端口的speed类型,分10M和100M口 |
duplex_type |
端口的双工类型,分全双工和半双工 |
port_type |
端口的vlan属性,分access口和trunk口 |
mux_state |
端口绑定状态机的状态 |
rcvm_state |
端口收包状态机的状态 |
prm_state |
端口发包状态机的状态 |
3.显示交换机的port-group 1的显示流量分担信息。
Switch# show port-group 1 load-balance
The loadbalance of the group 1 based on src MAC address.
4.显示交换机的port-group 1的成员端口信息。
Switch# show port-group 1 port
Sorted by the ports in the group 1 :
--------------------------------------------
the portnum is 1
port Ethernet0/0/1 related information:
Actor part
AdministrativeOperational
port number1
port priority0x8000
aggregator id0
port key0x01000x0101
port state
LACP activety.1
LACP timeout..
Aggregation11
Synchronization..
Collecting..
Distributing..
Defaulted11
Expired..
Partner part
AdministrativeOperational
system000000-000000000000-000000
system priority0x80000x8000
key0x00010x0001
port number11
port priority0x80000x8000
port state
LACP activety..
LACP timeout11
Aggregation11
Synchronization..
Collecting..
Distributing..
Defaulted11
Expired..
SelectedUnselected
显示内容 |
解释 |
portnumber |
端口号 |
port priority |
端口优先级 |
system |
system ID |
system priority |
System优先级 |
LACP activety |
端口是否以active模式加入组,如果是置1 |
LACP timeout |
端口超时方式,如果是短超时置1 |
Aggregation |
端口是否可汇聚,如果为0表示该端口为独立端口,不允许参与汇聚 |
Synchronization |
端口是否与对端同步 |
Collecting |
端口绑定状态机状态是否到达collecting状态 |
Distributing |
端口绑定状态机状态是否到达distributing状态 |
Defaulted |
本端端口是否使用默认的对端参数 |
Expired |
端口收包状态机的状态是否处在expire状态 |
Selected |
端口是否已被选择 |
5.显示交换机的port-group 1的汇聚端口信息。
Switch# show port-group 1 port-channel
Port channels in the group 1:
-----------------------------------------------------------
Port-Channel: port-channel1
Number of port : 2Standby port : NULL
Port in the port-channel :
IndexPortMode
------------------------------------------------------
1Ethernet0/0/1active
2Ethernet0/0/2active
显示内容 |
解释 |
Port channels in the group |
如果不存在port-channel,则不会显示以上打印信息。 |
Number of port |
Port-channel中的端口数 |
Standby port |
处于standby状态的端口,standby的端口表示虽然端口满足进入channel的条件,但由于总共进入channel的端口数已经大于最大数,所以将该端口的状态设为standby而不是selected。 |
debug lacp
命令:debug lacp
no debug lacp
功能:打开交换机的lacp的调试开关;本命令的no操作为关闭该调试开关。
命令模式:特权配置模式
缺省情况:缺省关闭交换机的lacp的调试开关。
使用指南:用来打开交换机lacp调试开关,可以显示交换机处理lacp数据包信息。
举例:打开lacp调试开关。
Switch#debug lacp