配置lagg, 实现cisco 2950 与Freebsd 7.0链路聚合笔记
09-02
lagg 支持 IEEE 802.3ad 链路聚合控制协议 (LACP) 和标记协议。 LACP 能够在节点与若干链路聚合组之间协商链路。 每一个链路聚合组 (LAG) 由一组相同速度、以全双工模式运行的网口组成。 流量在 LAG 中的网口之间, 会以总速度最大的原则进行分摊。当物理链路发生变化时, 链路聚合会迅速适应变动形成新的配置。
一、调入lagg内核模块
方法1. 加入内核并重编和加载,我用此方法来实现
device lagg
方法2.以module调入(kldload), 注意调入前先确认lagg.ko模块存在于/boot/kernel/
if_lagg_load="YES"
二、在rc.conf下配置lagg。
假设网卡标识为bge0和bge1
ifconfig_bge0="up"
ifconfig_bge1="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto lacp laggport bge0 laggport bge1 192.168.10.21 netmask 255.255.255.0"
三、cisco 2950下配置channel-protocol和channel-group.
# show run 的有关channel-protocol的内容
interface FastEthernet0/23
channel-group 6 mode active
channel-protocol lacp
!
interface FastEthernet0/24
channel-group 6 mode active
channel-protocol lacp
!
具体配置:
# enable
# conf t
# int fa0/24
# channel-protocol lacp
# channel-group 6 mode active
# exit
# int fa0/23
# channel-protocol lacp
# channel-group 6 mode active
# exit
# exit
# write
四、重启pc, 这样就可以实现FreeBSD 的两个网口作为一个负载均衡和故障转移链路聚合组接到交换机上。
A. FreeBSD上的状态.
#ifconfig
root@s2[~]# ifconfig
bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether 00:0f:20:32:5a:af
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
lagg: laggdev lagg0
bge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether 00:0f:20:32:5a:af
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
lagg: laggdev lagg0
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
inet 127.0.0.1 netmask 0xff000000
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether 00:0f:20:32:5a:af
inet 192.168.10.21 netmask 0xffffff00 broadcast 192.168.10.255
media: Ethernet autoselect
status: active
laggproto lacp
laggport: bge1 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
laggport: bge0 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
B. 在交换机上的状态.
swicth#show lacp 6 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 6 neighbors
Partner's information:
LACP port Oper Port Port
Port Flags Priority Dev ID Age Key Number State
Fa0/23 SA 32768 000f.2032.5aaf 3s 0x86 0x1 0x3D
Fa0/24 SA 32768 000f.2032.5aaf 5s 0x86 0x2 0x3D
swicth#show lacp 6 counters
LACPDUs Marker Marker Response LACPDUs
Port Sent Recv Sent Recv Sent Recv Pkts Err
---------------------------------------------------------------------
Channel group: 6
Fa0/23 2816 2603 0 1 1 0 0 ## 这里可以看到流量是平均分担的.
Fa0/24 2818 2605 0 3 3 0 0