Think before you speak, read before you think.

C2960S交换机汇聚

by

in

这里的汇聚要达到的目的:交换机之间可以扩展带宽,同时增强可用性。C2960S是二层交换机。实现汇聚的两个协议

Link Aggregation Control Protocol (LACP) 和 Port Aggregation Protocol (PAgP)

LACP是IEEE 802.3ad中规定的协议,所以具有通用性,所以linux又网卡绑定时,需要选择Mode 4 (802.3ad),这样交换机与服务器之间就能增加带宽。

而PAgP是思科自己的汇聚协议,它适用于思科产品之间的连接。

一句话,服务器与交换机,只能用LACP才有汇聚效果,而交换机与交换机既可以是LACP,也可以是PAgP,同时要注意,互相连接的端口之间协议要统一。不管是LACP还是PAgP,组成的新的虚拟通道在思科里叫做etherchannel。

下面是将1/0/1与1/0/2汇聚,前提进入enable模式,

配置LACP

Switch#configure terminal
Switch(config)#interface range gigabitEthernet 1/0/1 - 2
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#channel-group 1 mode active
Switch(config-if-range)#end

配置PAgP

Switch#configure terminal
Switch(config)#interface range gigabitEthernet 1/0/1 - 2
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#channel-group 1 mode desirable
Switch(config-if-range)#end

几个有用的查看命令

show running-config查看当前配置信息

interface GigabitEthernet1/0/1
 switchport mode trunk
 spanning-tree portfast
 channel-group 1 mode active
 !
 interface GigabitEthernet1/0/2
 switchport mode trunk
 spanning-tree portfast
 channel-group 1 mode active

show ip interfaces brief 显示interfaces的状态

Port-channel1          unassigned      YES unset  up               up

show spanning-tree 查看生成树,如果汇聚成功会只显示

Po1                 Desg FWD 3         128.224  P2p

更改port-channel的负载均衡的方式为src-mac

Switch#configure terminal
Switch(config)#port-channel load-balance src-mac

可选的方式有:

dst-ip Dst IP Addr
dst-mac Dst Mac Addr
src-dst-ip Src XOR Dst IP Addr
src-dst-mac Src XOR Dst Mac Addr
src-ip Src IP Addr
src-mac Src Mac Addr

查看etherchannel负载均衡的方式:

Switch#show etherchannel load-balance
EtherChannel Load-Balancing Configuration:
src-mac

查看interfaces的trunk状态

Switch#show interfaces trunk

Port Mode Encapsulation Status Native vlan
 Po1 on 802.1q trunking 1
 Po3 on 802.1q trunking 1
 Po4 on 802.1q trunking 1
Port Vlans allowed on trunk
 Po1 1-4094
 Po3 1-4094
 Po4 1-4094
Port Vlans allowed and active in management domain
 Po1 1
 Po3 1
 Po4 1
Port Vlans in spanning tree forwarding state and not pruned
 Po1 1
 Po3 1
 Po4 1

查看ether channel状态

Switch#show etherchannel summary

Flags: D - down P - bundled in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator

M - not in use, minimum links not met
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 4
Number of aggregators: 4

Group Port-channel Protocol Ports
------+-------------+-----------+--------------------------------------------
1 Po1(SU) PAgP Gi1/0/1(P) Gi1/0/2(P)
2 Po2(SD) LACP Gi1/0/3(D) Gi1/0/4(D)
3 Po3(SU) LACP Gi1/0/5(P) Gi1/0/6(P)
4 Po4(SD) LACP Gi1/0/7(D) Gi1/0/8(D)

可以看到正在运行的是第一个PAgP,第3LACP

参考:

http://www.cisco.com/en/US/docs/switches/lan/catalyst2960/software/release/12.2_55_se/configuration/guide/swethchl.html#wpxref12539

服务器 bond0  mode0 交换机做 etherchannel 使交换机 show logging 没有 flapping.

在 configure terminal 下,做好 port-channel

switch(config)#interface port-channel 2
switch(config-if)#switchport mode access
switch(config-if)#switchport access vlan 6

将 gi 口加入到 port-channel,这里用的 mode 是 on

switch(config-if)#int range gi 1/0/10 - 13
switch(config-if-range)#channel-group 2 mode on

默认是 no shutdown ,这样以后会有几十秒的中断,然后查看 etherchannel

2 Po2(SU) - Gi1/0/10(P) Gi1/0/11(P) Gi1/0/12(P)
 Gi1/0/13(P)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *