lagg支持IEEE802.3ad链路聚合控制协议(LACP)和标记协议。LACP能够在节点与若干链路聚合组之间协商链路。每一个链路聚合组(LAG)由一组相同速度、以全双工模式运行的网口组成。流量在LAG中的网口之间,会以总速度最大的原则进行分摊。当物理链路发生变化时,链路聚合会迅速适应变动形成新的配置。
一、调入lagg内核模块
方法1.加入内核并重编和加载,我用此方法来实现
devicelagg
方法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="laggprotolacplaggportbge0laggportbge1192.168.10.21netmask255.255.255.0"
三、cisco2950下配置channel-protocol和channel-group.
#showrun的有关channel-protocol的内容
interfaceFastEthernet0/23
channel-group6modeactive
channel-protocollacp
!
interfaceFastEthernet0/24
channel-group6modeactive
channel-protocollacp
!
具体配置:
#enable
#conft
#intfa0/24
#channel-protocollacp
#channel-group6modeactive
#exit
#intfa0/23
#channel-protocollacp
#channel-group6modeactive
#exit
#exit
#write
四、重启pc,这样就可以实现FreeBSD的两个网口作为一个负载均衡和故障转移链路聚合组接到交换机上。
A.FreeBSD上的状态.
#ifconfig
root@s2[~]#ifconfig
bge0:flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>metric0mtu1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether00:0f:20:32:5a:af
media:Ethernetautoselect(100baseTX<full-duplex>)
status:active
lagg:laggdevlagg0
bge1:flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>metric0mtu1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether00:0f:20:32:5a:af
media:Ethernetautoselect(100baseTX<full-duplex>)
status:active
lagg:laggdevlagg0
lo0:flags=8049<UP,LOOPBACK,RUNNING,MULTICAST>metric0mtu16384
inet127.0.0.1netmask0xff000000
lagg0:flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>metric0mtu1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether00:0f:20:32:5a:af
inet192.168.10.21netmask0xffffff00broadcast192.168.10.255
media:Ethernetautoselect
status:active
laggprotolacp
laggport:bge1flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
laggport:bge0flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
B.在交换机上的状态.
swicth#showlacp6neighbor
Flags:S-DeviceisrequestingSlowLACPDUs
F-DeviceisrequestingFastLACPDUs
A-DeviceisinActivemodeP-DeviceisinPassivemode
Channelgroup6neighbors
Partner'sinformation:
LACPportOperPortPort
PortFlagsPriorityDevIDAgeKeyNumberState
Fa0/23SA32768000f.2032.5aaf3s0x860x10x3D
Fa0/24SA32768000f.2032.5aaf5s0x860x20x3D
swicth#showlacp6counters
LACPDUsMarkerMarkerResponseLACPDUs
PortSentRecvSentRecvSentRecvPktsErr
---------------------------------------------------------------------
Channelgroup:6
Fa0/232816260301100##这里可以看到流量是平均分担的.
Fa0/242818260503300