一台物理机有,有两块网卡,分别为 ens33 和 ens38,实现虚拟网卡 team0,ip 地址为 192.168.88.123,主备轮询的链路聚合模式。
安装 teamd
查看当前系统有没有 team0 聚合链路
创建聚合链路 team0,设置工作模式 activebackup
1
| nmcli con add type team con-name team0 ifname team0 autoconnect yes config '{"runner":{"name":"activebackup"}}'
|
修改 team0 的 IP 地址
1
| nmcli con modify team0 ipv4.method manual ipv4.addresses 192.168.88.123/24 ipv4.gateway 192.168.88.2 ipv4.dns 114.114.114.114
|
把物理网卡加入到 team0
1
2
3
4
5
| # 把 ens33 加入到 team0
nmcli con add type team-slave con-name team0-1 ifname ens33 master team0
# 把 ens38 加入到 team0
nmcli con add type team-slave con-name team0-2 ifname ens38 master team0
|
查看链路聚合状态,重启网络服务
1
2
3
4
5
| teamdctl team0 state
nmcli con down link1
nmcli con up team0
|
验证
模拟 ens33 网卡损坏
1
2
| ifconfig ens33 down
teamdctl team0 state
|
重启网络
1
| systemctl restart network
|