HOWTO lacp RHEL5 with Cisco Switch?

lacp 全名是 Link Aggregation Control Protocol. 它是 IEEE 標準規格 802.3ad. 可以將上許多不同的實體連接埠(port)邏輯的共同結合在一起, 視為一條線路. 作這樣的設定好處有. 可做到failover, 還有加速. (話雖如此我還沒感受到它加速的威力. 還不知到怎麼測試).

首先你要先組態(config) Cisco Switch.
1. 關掉你要設定的 ports

# configure terminal 
# interface range GigabitEthernet 1/0/1-2
# shutdown

2. 設定你要合併的 ports, 在這裡我多設定VLAN 500.

#  switchport access vlan 500
# switchport trunk encapsulation dot1q
# switchport trunk native vlan 500
# switchport trunk allowed vlan 500
# switchport mode trunk
# switchport nonegotiate
# speed 1000
# channel-group 1 mode active

3. 檢查你剛剛的設定

# show running-config 
(omit)
!
interface Port-channel1
 switchport access vlan 500
 switchport trunk encapsulation dot1q
 switchport trunk native vlan 500
 switchport trunk allowed vlan 500
 switchport mode trunk
 switchport nonegotiate
!
interface GigabitEthernet1/0/1
 description tonnerre-inside1
 switchport access vlan 500
 switchport trunk encapsulation dot1q
 switchport trunk native vlan 500
 switchport trunk allowed vlan 500
 switchport mode trunk
 switchport nonegotiate
 speed 1000
 channel-group 1 mode active
!
interface GigabitEthernet1/0/2
 description tonnerre-inside2
 switchport access vlan 500
 switchport trunk encapsulation dot1q
 switchport trunk native vlan 500
 switchport trunk allowed vlan 500
 switchport mode trunk
 switchport nonegotiate
 speed 1000
 channel-group 1 mode active
! 
(omit)

4. 設定spanning-tree 模式為 pvst (這我還不太清楚為什麼?)

# configure terminal 
# spanning-tree mode pvst 

5. 啓用剛剛關掉的那些 ports

# configure terminal 
# interface range GigabitEthernet 1/0/1-2
# no shutdown

6. 檢查 lacp 狀態

# show lacp internal
Flags:  S - Device is requesting Slow LACPDUs 
        F - Device is requesting Fast LACPDUs
        A - Device is in Active mode       P - Device is in Passive mode     

Channel group 1
                            LACP port     Admin     Oper    Port        Port
Port      Flags   State     Priority      Key       Key     Number      State
Gi1/0/1   SA      bndl      32768         0x1       0x1     0x15        0x3D  
Gi1/0/2   SA      bndl      32768         0x1       0x1     0x16        0x3D 

# show lacp neighbor 
Flags:  S - Device is requesting Slow LACPDUs 
        F - Device is requesting Fast LACPDUs
        A - Device is in Active mode       P - Device is in Passive mode     

Channel group 1 neighbors

Partner's information:

                  LACP port                        Admin  Oper   Port    Port
Port      Flags   Priority  Dev ID          Age    key    Key    Number  State
Gi1/0/1   FA      32768     0017.xxxx.xxxx   0s    0x0    0x64   0x15    0x3D  
Gi1/0/2   FA      32768     0017.xxxx.xxxx   0s    0x0    0x64   0x16    0x3D  

在RHEL5的設定如下 :
1. 編輯 eth0, eth1

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no

# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no

2. 建立 bond0.

# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=10.1.0.0
NETMASK=255.255.0.0
IPADDR=10.1.1.241
USERCTL=no

3. 設定 bond0 module

# vi /etc/modprobe.conf 
alias bond0 bonding
options bond0 mode=4 miimon=100 lacp_rate=1

mode=0 (balance-rr)
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.

mode=1 (active-backup)
Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond’s MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.

mode=3 (broadcast)
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.

mode=4 (802.3ad)
IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.

4. 重新啓動網路

# service network restart

5. 檢查lacp狀態

# cat /proc/net/bonding/bond0 
Ethernet Channel Bonding Driver: v3.2.4 (January 28, 2008)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

802.3ad info
LACP rate: fast
Active Aggregator Info:
        Aggregator ID: 1
        Number of ports: 2
        Actor Key: 17
        Partner Key: 2
        Partner Mac Address: 00:1c:f9:xx:xx:xx

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:1e:c9:xx:xx:xx
Aggregator ID: 1

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:1e:c9:xx:xx:xx
Aggregator ID: 1

這樣就完成了. 我還有很多不懂的地方.還需要慢慢學習. 🙂

Comments are closed.