网络 bonding

来自 Alpine Linux

本文展示了如何将多个以太网接口 bonding (或聚合) 成一个 bond0 接口。

注意: 需要 Alpine Linux v2.4 或更高版本

安装

首先,安装 bonding 软件包。这将为您在 /etc/network/interfaces 文件中提供 bonding 支持。

apk add bonding

如果您想使用 bridge 接口设置 LACP,您还需要安装

apk add bridge

配置

编辑 /etc/network/interfaces 文件

auto bond0
iface bond0 inet static
	address 192.168.0.2
	netmask 255.255.255.0
	gateway 192.168.0.1
	# specify the ethernet interfaces that should be bonded
	bond-slaves eth0 eth1 eth2 eth3

关键字是 bond-slaves,它将使 ifup 将 slaves 添加到 bond0 接口。

参考链接: https://linuxkernel.org.cn/doc/Documentation/networking/bonding.txt


使用 br0 进行 Bonding (LACP)

auto bond0
iface bond0 inet manual
        bond-slaves eth0 eth1
        bond-mode 802.3ad
        bond-xmit-hash-policy layer2+3

auto br0
iface br0 inet dhcp
        bridge-ports bond0
        bridge-stp 0
                hostname alpine