Cisco Etherchannel

設定時注意事項
1. all bundled ports first must belong to the same VLAN.
(If used as a trunk, bundled ports must be in trunking mode, have the same native VLAN, and pass the same set of VLANs.)
2. Each of the ports should have the same speed and duplex settings before being bundled
3. Bundled ports also must be configured with identical spanning-tree settings.
ps
Configuration changes made on the port-channel interface apply to all physical ports assigned to the portchannel interface.
ps:
support l2 and l3 feature
disable “switchport mode” if in l3 feature 

啟用etherchannel
(config)# interface range < interface-range>
(config-if)#shutdown

(config-if)# channel-protocol < pagp | lacp>

設定pagp channel
(config-if)#channel-group < number> mode < on | < auto | desirable> [non-silent] | passive | active>
各參數說明如下
< number>
Each interface included in a single EtherChannel bundle must be assigned to the same unique channel group number (1 to 64)
on :unconditionally channel, no PAgP or LACP negotiation 
< auto | desirable > [non-silent] :for pagp
auto:(default)
[non-silent]:在desirable和auto modes下,PAgP預設不啟用non-slient
< passive | active > :for lacp
passive:passively listen and wait to be asked 
active:actively ask 
ps:
Some older models, however, offer only PAgP, so the channel-protocol command is not available
ps
verify method
show interfaces < interface> etherchannel
show etherchannel < number> port-channel
show etherchannel < number> summary
ex:
PAgP configuration, 
to use an EtherChannel load-balancing hash of both source and destination port numbers. 
A Gigabit EtherChannel will be built from interfaces Gigabit Ethernet 3/1-4, with the switch actively negotiating a channel. 
The switch should not wait to listen for silent partners
Switch(config)# port-channel load-balance src-dst-port
Switch(config)# interface range gig 3/1-4
Switch(config-if)# shutdown 
Switch(config-if)# channel-protocol pagp
Switch(config-if)# channel-group 1 mode desirable non-silent

…..

[option]
LACP priority 設定

設定switch lacp system-priority
(config)# lacp system-priority < priority>
參數說明如下
< priority> (1 to 65,535; default 32,768)
ps:both switches will have the same system priority (32,768), and the one with the lower MAC address will become the decision maker

設定interface lacp port-priority
(config-if)# lacp port-priority < priority>
prepares extra standby interfaces to replace failed active ones
< priority> (1 to 65,535; default 32,768)
ps:all ports default to 32,768 and the lower port numbers (in interface number order) are used to
select the active ports.

ex
LACP configuration
This switch actively should negotiate the channel and should be the decision maker about the
channel operation
to negotiate a Gigabit EtherChannel using interfaces Gig2/1-4 and 3/1-4.
Interfaces Gig2/5-8 and 3/5-8 are standby states
step1
Switch1(config)# lacp system-priority 100
Switch1(config)# interface range gig 2/1-4 , gig 3/1-4
Switch1(config-if)# shutdown
Switch1(config-if)# channel-protocol lacp
Switch1(config-if)# channel-group 1 mode active
Switch1(config-if)# lacp port-priority 100
Switch1(config-if)# exit
Switch1(config)# interface range gig 2/5-8 , gig 3/5-8
Switch1(config-if)# channel-protocol lacp
Switch1(config-if)# channel-group 1 mode active
step2
Switch2…類似switch1設定
step3
Switch1(config)#int port-channel 1
Switch1(config)#no shutdown
Switch2(config)#int port-channel 1
Switch2(config)#no shutdown 

ps:
設定etherchannel on trunk
ex:
step1
switch1設定如下
switch1(config)# interface range fa0/2-3
swtich1(config-if)# shutdown 
switch1(config-if)# channel-group 1 mode on
switch1(config-if)# interface port-channel 1
switch1(config-if)# switchport trunk encapsulation dot1q
switch1(config-if)# switchport mode trunk
switch2設定如下
switch2(config)# interface range fa0/2-3
switch2(config-if)# shutdown 
switch2(config-if)# channel-group 1 mode on
switch2(config-if)# interface port-channel 1
switch2(config-if)# switchport trunk encapsulation dot1q
switch2(config-if)# switchport mode trunk
step2
switch1(config)#int port-channel 1
switch1(config-if)no shutdown
switch2(config)#int port-channel 1
switch2(config-if)no shutdown
ps:
#show running-config 為例,顯示組態大致如下
[omit]
interface Port-channel1
switchport mode trunk
switchport trunk encapsulation dot1q
no ip address
!
interface FastEthernet0/2
switchport mode trunk
switchport trunk encapsulation dot1q
no ip address
channel-group 1 mode on
!
interface FastEthernet0/3
switchport mode trunk
switchport trunk encapsulation dot1q
no ip address
channel-group 1 mode on
[omit]


L3 EtherChannel設定
1.
Creates a port-channel interface
Switch(config)# interface port-channel < number>
2.
Specifies L3 and assigns an IP address and subnet mask to the EtherChannel
Switch(config-if)# no switchport
Switch(config-if)# ip address < ip > < mask>
3.
Configures the interface as L3 and specifies the port channel and the PAgP mode
Switch(config-if)# interface range < interface range>
Switch(config-if-range)# no switchport
Switch(config-if-range)# channel-group < number > mode < mode>

ex:
Switch(config)# interface port-channel 5
Switch(config-if)# no switchport
Switch(config-if)# ip address 172.10.20.10 255.255.255.0
Switch(config-if)# interface range gigabitethernet0/1 -2 
Switch(config-if-range)# no switchport 
Switch(config-if-range)# channel-group 5 mode desirable
Switch(config-if-range)# end

 …..


定義loadbalance的方法
(config)# port-channel load-balance < method>
method有以下可選,格式為
method: hash input ,hash operation ,switch model
src-ip: Source IP address ,bits ,All models
dst-ip: Destination IP address ,bits ,All models
src-dst-ip: Source and destination IP address ,XOR ,All models (default)
src-mac: Source MAC address ,bits ,All models
dst-mac: Destination MAC address ,bits ,All models
src-dst-mac: Source and destination MAC ,XOR ,All models
src-port: Source port number ,bits ,6500/4500
dst-port: Destination port number ,bits ,6500/4500
src-dst-port: Source and destination port ,XOR ,6500/4500
ps:
The default for the Catalyst 2970 and 3560 is src-mac for Layer 2 switching
ps:
若要平均分攤流量,src-port在每次傳輸都會不一樣,可以使用此method

顯示etherchannel狀態
#show etherchannel port-channel
include:
Load-balancing port index used by hashing algorithm
Time stamps of EtherChannel changes

show Load-balancing hashing algorithm
#show etherchannel load-balance
the switches on either end of an EtherChannel can have different load-balancing methods.
The only drawback to this is that the load balancing will be asymmetric in the two directions across the channel.
ps:
畫面大致如下
Source XOR Destination IP address

…………………………………………………………………………………………………………………………..

find EtherChannel problems way
the whole concept is based on consistent configurations on both ends of the channel
ex:Each must have the same switch mode (access or trunk),native VLAN, trunked VLANs, port speed, port duplex mode, and so on


show EtherChannel neighbors on each port
#show < pagp | lacp> neighbor

show LACP system ID
#show lacp sys-id

verify the EtherChannel state
# show etherchannel brief

Detailed status about each EtherChannel component
#show etherchannel detail

verify the EtherChannel state
# show etherchannel summary
Flags:
D – down P – in port-channel
 I – stand-alone s – suspended
 H – Hot-standby (LACP only)
 R – Layer3 S – Layer2
 u – unsuitable for bundling
 U – in use f – failed to allocate aggregator
 d – default port
Number of channel-groups in use: 1
Number of aggregators: 1
Group,Port-channel,Protocol ,Ports
——+————–+———–+————————————————
1  ,Po1(SU)  ,PAgP ,Fa0/41(P) Fa0/42(P) Fa0/43 Fa0/44(P) Fa0/45(P)
說明如下
flags(SU):正常  
flags(D):處於down的狀態 
flags(P):most of the channel ports, indicating that they are active in the port-channel
flags(I):If a port is connected but not bundled in the channel,it will have an independent

verify the channel negotiation mode
#show etherchannel port
畫面大致如下
Channel-group listing:
———————–
Group: 1
———-
Ports in the group:
——————–
Port: Fa0/41
————
Port state = Up Mstr In-Bndl
Channel group = 1  Mode = Desirable-Sl  Gcchange = 0
Port-channel = Po1 GC = 0x00010001  Pseudo port-channel = Po1
Port index = 0  Load = 0x00  Protocol = PAgP
Flags:
 S – Device is sending Slow hello. C – Device is in Consistent state.
A – Device is in Auto mode. P – Device learns on physical port.
d – PAgP is down.
Timers:
 H – Hello timer is running. Q – Quit timer is running.
S – Switching timer is running. I – Interface timer is running.
Local information:
 Port,Flags,State,Timers,HelloInterval,PartnerCount,PAgPPriority,LearningMethod,GroupIfindex
 Fa0/41,SC,U6/S7,H  ,30s    ,1     ,128    ,Any     ,55
Partner’s information:
 Port,Name,PartnerDeviceID,PartnerPort,PartnerAge,PartnerFlags,GroupCap.
 Fa0/41,FarEnd,00d0.5849.4100,3/1  ,19s    ,SAC   ,11
Age of the port in the current state: 00d:08h:05m:28s
說明:
mode=Desirable-SI表示該介面使用desirable silent mode

display a port’s configuration
#show running-config [interface < interface >| port-channel < number> ]
ps:
Switch#show run interface port-channel 1 為例,畫面大致如下
interface Port-channel1
switchport mode dynamic desirable
ps:
Switch#show run interface gig 0/9 為例,畫面大致如下
interface GigabitEthernet 0/9
switchport mode dynamic desirable
channel-group 2 mode desirable
channel-protocol pagp


shows all active EtherChannel parameters for a single port
#show interface < interface > etherchannel
ps:
Switch#show interfaces gi0/9 etherchannel 為例,畫面大致如下
Port state = Up Mstr In-Bndl
Channel group = 1 Mode = Desirable-Sl Gcchange = 0
Port-channel = Po2 GC = 0x00020001 Pseudo port-channel = Po1
Port index = 0 Load = 0x00
Flags: S – Device is sending Slow hello. C – Device is in Consistent state.
A – Device is in Auto mode. P – Device learns on physical port.
d – PAgP is down.
Timers: H – Hello timer is running. Q – Quit timer is running.
S – Switching timer is running. I – Interface timer is running.
Local information:
Hello Partner PAgP Learning Group
Port Flags State Timers Interval Count Priority Method Ifindex
Gi0/9 SC U6/S7 H 30s 1 128 Any 15
Partner’s information:
Partner Partner Partner Partner Group
Port Name Device ID Port Age Flags Cap.
Gi0/9 DSW122 0005.313e.4780 Gi0/9 18s SC 20001
Age of the port in the current state: 00d:20h:00m:49s

ps:
Some messages look like errors but are part of the normal EtherChannel process
ex:
new port is configured as a member of an existing EtherChannel
message as follows:
4d00h: %EC-5-L3DONTBNDL2: FastEthernet0/2 suspended: incompatible partner port with FastEthernet0/1
description as follows:
When the port first is added to the EtherChannel, it is incompatible because the STP runs on the channel and the new port. After STP takes the new port through its progression of states, the port is automatically added into the EtherChannel

ps:
Fast Ethernet0/3 has a different duplex mode than the other ports in the EtherChannel
message as follows:
4d00h: %EC-5-CANNOT_BUNDLE2: FastEthernet0/3 is not compatible with FastEthernet0/1 and will be suspended (duplex of Fa0/3 is full, Fa0/1 is half)