实践方法采取直接编辑ifcfg配置activebackup主备模式,其它方法原理类似比如 nmcli/nmtui #查看LOWER_UP网卡,准备双网卡teaming测试 ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000 link/ether 52:54:00:d5:f7:d4 brd ff:ff:ff:ff:ff:ff 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000 link/ether 52:54:00:d8:04:70 brd ff:ff:ff:ff:ff:ff #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.11.1 PREFIX=24 #GATEWAY=192.168.11.254 TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' #做好备份继续编辑需要绑定的网卡信息,调整prio优先级 vi ifcfg-eth0 DEVICE=eth0 #HWADDR=D4:85:64:01:46:9E DEVICETYPE=TeamPort ONBOOT=yes TEAM_MASTER=team0 TEAM_PORT_CONFIG='{"prio": 100}' vi ifcfg-eth1 DEVICE=eth1 #HWADDR=D4:85:64:01:46:9F DEVICETYPE=TeamPort ONBOOT=yes TEAM_MASTER=team0 TEAM_PORT_CONFIG='{"prio": 99}' #重启网络 systemctl restart network #检查端口状态 teamnl team0 ports 1: eth0: up 1000Mbit FD 2: eth1: up 1000Mbit FD #检查teaming状态 teamdctl team0 state setup: runner: activebackup ports: eth0 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up eth1 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up runner: active port: eth0 #手动断开其中一条链路验证主备模式切换是否正常 ip link set eth1 down teamdctl team0 state setup: runner: activebackup ports: eth0 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up eth1 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up runner: active port: eth1 转载请保留固定链接: https://linuxeye.com/Linux/teaming.html |