(2)在使用roundrobin模式必须要在交换机上做以太通道,不然会出现网络无法连通。
# 使用nmcli命令操作,创建team接口team0,同时设置teaming模式为roundrobin
nmcli con add type team con-name team0 ifname team0 config '{"runner":{"name": "roundrobin"}}'
# 给接口team0设置ip地址
nmcli con modify team0 ipv4.address '192.168.95.129/24' ipv4.gateway '192.168.95.2' ipv4.dns '114.114.114.114'
# 设置为手动模式,取消DHCP
nmcli con modify team0 ipv4.method manual
# 查看并删除两张物理网卡的连接
nmcli con sh
nmcli con del "系统 ens33" "系统 ens37"
# 将两张物理网卡加入到team中
nmcli con add type team-slave con-name team0-port1 ifname ens33 master team0
nmcli con add type team-slave con-name team0-port2 ifname ens37 master team0
# 查看team0的状态
teamdctl team0 st
#在做链路聚合的时候,所要使用到的物理网卡不能独立存在连接,也就是在nmcli con sh查看时,不能独立存在,否则就无法绑定到team模式中。
测试:两张网卡同时在线,现在down掉其中一张网卡
nmcli con del team0-port1
使用activebackup模式配置
恢复初始状态:[root@localhost ~]# nmcli con del team0 team0-port2
# 添加逻辑网卡team0,并启用activebackup模式
nmcli con add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}'
# 绑定ip
nmcli con modify team0 ipv4.address '192.168.95.129/24' ipv4.gateway '192.168.95.2' ipv4.dns '114.114.114.114'
nmcli con modify team0 ipv4.method manual
# 添加物理网卡到activebackup模式
nmcli con add type team-slave con-name team0-port1 ifname ens33 master team0
nmcli con add type team-slave con-name team0-port2 ifname ens37 master team0
#重启网络服务
systemctl restart network
测试:通过down掉活动网卡测试网络是否仍然处于连通状态