#安裝必需的包:
yum install teamd -y
#停止NetworkManager
systemctl stop NetworkManager
systemctl disable NetworkManager
#Creating a Network Team Using ifcfg Files
cd /etc/sysconfig/network-scripts/
vi ifcfg-team0
DEVICE=team0
DEVICETYPE=Team
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.10.110
PREFIX=24
GATEWAY=192.168.10.254
TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'
#做好備份繼續編輯需要綁定的網卡信息,調整prio優先級
# cat ifcfg-eno1
DEVICETYPE=TeamPort
TEAM_MASTER=team0
TEAM_PORT_CONFIG='{"prio":100}'
NAME=eno1
DEVICE=eno1
ONBOOT=yes
# cat ifcfg-eno2
DEVICETYPE=TeamPort
TEAM_MASTER=team0
TEAM_PORT_CONFIG='{"prio":99}'
NAME=eno2
DEVICE=eno2
ONBOOT=yes
#重啓網絡
systemctl restart network
#檢查端口狀態
teamnl team0 ports
1: eth0: up 1000Mbit FD
2: eth1: up 1000Mbit FD
#檢查teaming狀態
teamdctl team0 state
setup:
runner: activebackup
ports:
eno1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
eno2
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
runner:
active port: eno1
#手動斷開其中一條鏈路驗證主備模式切換是否正常
ip link set eno1 down
teamdctl team0 state
setup:
runner: activebackup
ports:
eno1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
eno2
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
runner:
active port: eno2