Centos7系统使用team替换bonding实现链路聚合网卡绑定

参考资料:http://rhelblog.redhat.com/2014/06/23/team-driver/
                 https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/ch-Configure_Network_Teaming.html   

        Centos7之前系统提供给用户的是bonding driver来实现链路聚合,实际上bonding适用于大多数应用。Bonding driver的架构是由内核空间完全控制、管理。
       Team driver又是什么呢?team driver不打算复制bonding driver,实际上它是被设计用一整套不同的设计和不同的方法来实现bonding能做到的事,它的这种更灵活、更高效.
        针对现有的bonding配置,如果想从bonding driver转到team driver,redhat官方还是挺人性化的,提供了一个bond2team的命令行工具。
        实践方法采取直接编辑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.0.1
PREFIX=24
#GATEWAY=192.168.0.254
TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'

#做好备份继续编辑需要绑定的网卡信息,调整prio优先级

vi ifcfg-eth0

DEVICE=eth0
DEVICETYPE=TeamPort
ONBOOT=yes
TEAM_MASTER=team0
TEAM_PORT_CONFIG='{"prio": 100}'

vi ifcfg-eth1

DEVICE=eth1
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: down
instance[link_watch_0]:
name: ethtool
link: down
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
runner:
active port: eth1
此条目发表在Knowledge, Oprating-System分类目录,贴了, 标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注