1. 先创建聚合链路配置文件
注:con-name自定义队名,ifname自定义物理网卡名,这里是聚合所以没有指向哪个物理网卡名,加队员时可选指定的物理网卡名。
# nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}'
2. 设置配置文件(指定IP、网关等)
# nmcli connection modify team0 ipv4.method static ipv4.addresses 192.168.10.100 ipv4.gateway 192.168.10.2/24 ipv4.dns
192.168.10.2 connection.autoconnect yes
3. 添加网卡(master)
# nmcli connection add type team-slave con-name team0-port1 ifname ens37 master team0
# nmcli connection add type team-slave con-name team0-port2 ifname eno2 master team0
# nmcli connection show //添加好上面三项可以查看一下
NAME UUID TYPE DEVICE
team0 869bfc18-0b03-4c59-bc9c-d3d902b25f61 team team0
team0-port1 68c16875-cd0a-4a7d-9029-100bff46189d ethernet --
team0-port2 edba3e9e-f4d3-430b-9a91-38561170876e ethernet --
4. 启动和查看聚合链路
nmcli connection up team0
nmcli connection up team0-port1
nmcli connection up team0-port2
# teamdctl team0 state
setup:
runner: activebackup
ports:
ens37
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: ens37
5. 测试
--物理机上可以断网线口测试。
--虚拟机可以用下面ifconfig、ifdown、ifup来测试