nmcli 通过 bond.options 设置 lacp_rate 参数配置 lacp 超时频率,fast(1秒发送,3秒超时)或 slow(30秒发送,90秒超时),需内核支持 bonding 模块、nm≥1.26,并确保物理网卡与交换机配置一致。

Linux 中 nmcli 本身不直接提供配置 LACP 超时频率(即 lacp-rate)的独立参数,但可通过 bond 接口的底层参数在创建或修改连接时一并设置。关键在于:LACP 超时行为由 lacp-rate 控制,它决定 LACPDU 发送周期(fast=1秒,slow=30秒),进而影响超时判定(超时时间 = 发送周期 × 3)。
确认支持与前提
- 系统内核已加载 `bonding` 模块(运行lsmod | grep bonding 验证)
- NetworkManager 版本 ≥ 1.26(推荐 ≥ 1.40),确保完整支持 `802.3ad` 参数
- 物理网卡速率、双工模式、交换机端口配置必须一致(如均为 1Gbps 全双工)
- 交换机侧已启用 LACP(如 Cisco 的 channel-group X mode active)
配置 LACP 超时频率(fast 或 slow)
在创建 bond 连接时,通过 bond.options 指定 lacp_rate 参数:
- 设为
fast:LACPDU 每秒发送一次,超时时间为 3 秒(快速故障检测) - 设为
slow:LACPDU 每 30 秒发送一次,超时时间为 90 秒(降低控制报文开销)
示例命令(创建 fast 模式 bond0):
nmcli connection add type bond con-name bond0 ifname bond0 mode 802.3ad bond.options "lacp_rate=fast,transmit_hash_policy=layer3+4,mii_mon=100"
若已存在 bond 连接,可修改:
nmcli connection modify bond0 bond.options "lacp_rate=fast,transmit_hash_policy=layer3+4,mii_mon=100"
绑定物理网卡并启用
将网卡(如 enp3s0、enp4s0)作为从属接口加入 bond:
nmcli connection add type ethernet con-name enp3s0 ifname enp3s0 master bond0<br>nmcli connection add type ethernet con-name enp4s0 ifname enp4s0 master bond0
配置 IP 并激活:
nmcli connection modify bond0 ipv4.addresses 192.168.10.50/24 ipv4.gateway 192.168.10.1 ipv4.method manual ipv6.method disabled<br>nmcli connection down enp3s0 enp4s0<br>nmcli connection up bond0
验证 LACP 频率是否生效
检查 bond 接口当前参数:
cat /proc/net/bonding/bond0
输出中应包含:
-
LACP rate: fast或LACP rate: slow -
Aggregator selection policy (ad_select): stable(默认) -
Slave Interface: enp3s0后显示Aggregator ID: 1且状态为Active或Standby
也可用 ip link show bond0 和 ethtool bond0 辅助确认聚合状态。











