Cisco - Fonctionnement d'un EtherChannel
Alasta 3 Janvier 2015 cisco Cisco HA
Description : Nous allons voir ce qui se cache derrière un EtherChannel Cisco.
Rappel de ce qu’est un EtherChannel :
Un EtherChannel ou aggrégat de lien en Français, permet d’aggréger plusieurs liens physique pour n’en former qu’un logique. Cela permet “d’augmenter la bande passante”.
Fonctionnement de l’EtherChannel :
Schéma de répartition :
On voit bien que les EterChannels ayant un nombre de ports impaires, la répartion n’est pas symétriques.
Description de la répartition :
La répartition s’effectue sur le résultat d’un hash à 8 valeurs possible (0 à 7) qui se dépend de la méthode de load balancing utilisée. Le résultat de ce hash et appelé RBH (Resultat Bundle Hash) qui est propriétaire Cisco.
Nous pouvons voir le résultat directe de la répartition via certaines commandes qui diffèrent d’un modèle à l’autre :
3750# test etherchannel load-balance interface port-channel 1 mac 0000.1111.2222 3333.4444.5555
Would select Gi1/0/1 of Po1
4500-VSS-MEC# show platform software etherchannel port-channel 1 map ip 2.2.2.2 1.1.1.1
Executing the command on VSS member switch role = VSS Active, id = 1
Map port for Ip 2.2.2.2, 1.1.1.1 is Te1/1/1(Po1)
NOTE: Software forwarded traffic will use Te1/1/1(Po1)
Executing the command on VSS member switch role = VSS Standby, id = 2
Map port for Ip 2.2.2.2, 1.1.1.1 is Te2/1/1(Po1)
NOTE: Software forwarded traffic will use Te2/1/1(Po1)
!!!Attention!!! dans un VSS, un etherchannel de type MEC (Multi-chassis EtherChannel) privilégie le port de sortie qui est sur le même switch que le port d’entrée.
Cela a aussi un impact lors de la perte de liens sur un switch, voici un exemple :
6500# remote login switch
Trying Switch ...
Entering CONSOLE for Switch
Type "^C^C^C" to end this session
6500-sp# test etherchannel load-balance interface po1 ip 1.1.1.1 2.2.2.2
Computed RBH: 0x5
Would select Gi2/2 of Po1
Nous allons comprendre comment le port est choisi, il faut juste partir du principe que le RBH nous est fourni (car son algorithme est propriétaire et c’est peut être pas interessant à calculer).
Nous prennons dans un premier temps un EtherChannel sur 2 ports G3/2 et G3/3.
Informations sur l’EtherChannel :
switch#show interface po1 etherchannel
Age of the Port-channel = 1d:1h:11m:11s
Logical slot/port = 14/1 Number of ports = 2
GC = 0x00000000 HotStandBy port = null
Port state = Port-channel Ag-Inuse
Protocol = -
Ports in the Port-channel:
Index Load Port EC state No of bits
------+------+------+------------------+-----------
1 55 Gi3/2 On/FEC 4
0 AA Gi3/3 On/FEC 4
Time since last port bundled: 1d:11h:1m:11s Gi3/2
Time since last port Un-bundled: 1d:11h:11m:11s Gi3/3
Les points à regarder sont, l’association du champ Load et Port et la valeur du champ Load.
Il faut ensuite convertir les valeurs héxadécimales de Load en binaire :
Pour le port G3/2 qui a la Load 55, les bits 6, 4, 2, 0 matchent. Les RBH ayant une valeur de 6, 4, 2, 0 passerons pas le port G3/2.
Pour le port G3/3 qui a la Load AA, les bits 7, 5, 3, 1 matchent. Les RBH ayant une valeur de 7, 5, 3, 1 passerons pas le port G3/3.
On voit aussi que le champ No of bits indique le nombre de bits qui matchent.
Vérifications :
switch#test etherchannel load-balance interface port-channel 1 ip 5.5.5.5 2.2.2.2
Computed RBH: 0x0
Would select Gi3/2 of Po1
switch#test etherchannel load-balance interface port-channel 1 ip 1.1.1.1 2.2.2.6
Computed RBH: 0x1
Would select Gi3/3 of Po1
switch#test etherchannel load-balance interface port-channel 1 ip 10.10.10.4 10.10.10.30
Computed RBH: 0x2
Would select Gi3/2 of Po1
switch#test etherchannel load-balance interface port-channel 1 ip 3.3.3.3 2.2.2.2
Computed RBH: 0x3
Would select Gi3/3 of Po1
switch#test etherchannel load-balance interface port-channel 1 ip 1.1.1.1 2.2.2.3
Computed RBH: 0x4
Would select Gi3/2 of Po1
switch#test etherchannel load-balance interface port-channel 1 ip 1.1.1.1 2.2.2.2
Computed RBH: 0x5
Would select Gi3/3 of Po1
switch#test etherchannel load-balance interface port-channel 1 ip 1.1.1.1 2.2.2.9
Computed RBH: 0x6
Would select Gi3/2 of Po1
switch#test etherchannel load-balance interface port-channel 1 ip 1.1.1.1 2.2.2.8
Computed RBH: 0x7
Would select Gi3/3 of Po1
Exemple avec un EtherChannel de 3 ports :
switch#show interface port-channel 1 etherchannel
Port-channel1 (Primary aggregator)
Age of the Port-channel = 0d:01h:05m:54s
Logical slot/port = 14/1 Number of ports = 3
HotStandBy port = null
Port state = Port-channel Ag-Inuse
Protocol = LACP
Fast-switchover = disabled
Ports in the Port-channel:
Index Load Port EC state No of bits
------+------+------+------------------+-----------
0 49 Gi3/1 Active 3
1 92 Gi3/2 Active 3
2 24 Gi3/3 Active 2
<SNiP>
Convertion du champ Load en binaire :
On voit bien que la répartion est inégale entre les différents port car les ports G3/1 et G3/2 matchent 3 bits alors que le port G3/3 n’en matche que 2 bits.