LinuxEye - Linux系统教程

LinuxEye - Linux系统教程

当前位置: 主页 > Linux教程 >

RHEL7 Teaming网卡绑定实践

时间:2015-12-01 10:01来源:http://wsgzao.github.io/post/t 编辑:linuxeye 点击:
为了提高网络容错或吞吐量,一般服务器都会采取多网卡绑定的策略,在RHEL6中使用的是Bonding,而RHEL7提供了一项新的实现技术Teaming,具体原理和对比列表大家可以参考扩展阅读中的R
为了提高网络容错或吞吐量,一般服务器都会采取多网卡绑定的策略,在RHEL6中使用的是Bonding,而RHEL7提供了一项新的实现技术Teaming,具体原理和对比列表大家可以参考扩展阅读中的RedHat官方博客。配置Teaming有两种方式,第一种是使用nmclii命令,第二种是直接修改配置文件,如果大家有更好的方法也欢迎分享。

实践方法采取直接编辑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

------分隔线----------------------------
标签:Teaming
栏目列表
推荐内容