centos7-team

#模式切换 一键切换(慎用)
nmcli connection modify team0 config '{"runner":{"name":"activebackup"}}' &&
systemctl restart network &&
teamdctl nm-team state
team的四种模式
broadcast (广播模式)
activebackup (主备模式)
roundrobin (轮训模式)
loadbalance (负载均衡) LACP
team模式切换
[root@Develop ~]# teamdctl nm-team state
[root@Develop ~]# nmcli connection modify team0 config '{"runner":{"name":"activebackup"}}'
[root@Develop ~]# systemctl restart network

#Network Teaming
nmcli device
nmcli connection show
nmcli connection delete  1/2
nmcli connection show
nmcli connection add type team ifname team0 con-name team0 config '{"runner": {"name":"activebackup"}}' 
nmcli connection modify team0 ipv4.addresses 192.168.231.100/24
nmcli connection modify team0 ipv4.gateway "192.168.1.1"
nmcli connection modify team0 ipv4.dns "192.168.1.1"
nmcli connection modify team0 ipv4.method manual
nmcli connection add type team-slave ifname eno33554992 con-name team0-p1 master team0 config '{"prio": 100}'
nmcli connection add type team-slave ifname eno50332216 con-name team0-p2 master team0 config '{"prio": -10,"sticky": true}'
本次配置中eno33554992为主网卡,设置其优先级为100;eno50332216为辅网卡,设置其优先级为-10,粘滞位为true。
prio:优先级。
数字越大,网卡优先级越高,优先为活跃网卡;若不设置优先级,则默认为0,先接入网络的网卡为活跃网卡,另一块为备份网卡,直至活跃网卡断开连接,备份网卡自动升级为活跃网卡,两块网卡角色互换。
sticky:粘滞位,默认为false;
辅网卡eno50332216中设置了sticky为true,代表如果辅网卡连接状态变为为活跃状态后,无论主网卡连接是否正常,其将会一直保持为活跃状态。
若不设置sticky,在辅网卡为活跃状态时,若主网卡连接恢复正常,则活跃网卡由主网卡接管,辅网卡会变为备份状态。

nmcli connection up team0-p1
nmcli connection up team0-p2
nmcli connection up team0
nmcli connection show --active 
teamnl team0 ports
teamdctl team0 stat
teamdctl team0 config dump

对于各种双网卡绑定配置模式,请参考系统中的示例文件,文件位置:
/usr/share/doc/teamd-xx/example_configs/
#参考
https://blog.51cto.com/zaa47/1925126
posted @ 2020-04-22 18:10  kylingx  阅读(373)  评论(0编辑  收藏  举报