网络组Network Team

网络组Network Team

网络组team:是将多个网卡聚合在一起,从而实现容错和提高吞吐量

1 创建网络组接口

nmcli connection add type team con-name TEAMname ifname INTname [config JSON]

TEAMname 指定连接名,INname指定接口名,

JSON指定runner方式,格式为:'{“runner”:{“name”:”METHOD”}}’

METHOD 可以是broadcast、roundrobin、activebackup、loadbalance、lacp

(1)创建网络接口组team0

[root@centos7 ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"loadbalance"}}'
Connection 'team0' (e70483a1-2688-4eb2-9466-8e732360291d) successfully added.

(2)给网路组team0配置IP地址

[root@centos7 ~]# nmcli connection modify team0 ipv4.method manual ipv4.addresses 200.200.200.200/24 gw4 200.200.200.1

2 创建port接口(SLAVE)

既就是生成组TEAM组成员的配置文件。

注意:这个配置文件和网卡配置文件是相互独立的。

nmcli connection add type team-slave con-name SLAVEname ifname INname master TEAMname

SLAVEname 指定连接名,INTname指定网络接口名(相当于指定要加入网络组的网卡名),TEAMnmae指定所属网络组。

若连接名不指定,默认为team-slave-IFACE

创建接口组

这里使用ens34、ens38两块网卡

[root@centos7 ~]# nmcli connection add con-name team0-ens34 type team-slave ifname ens34 master team0
Connection 'team0-ens34' (a481fb6d-bf61-413d-a2c7-289966bee1a7) successfully added.
[root@centos7 ~]# nmcli connection add con-name team0-ens38 type team-slave ifname ens38 master team0
Connection 'team0-ens38' (758d0eba-1625-46b2-b539-1d853a45be6b) successfully added.

3 启用网络组

启用网络组:nmcli connection up team0

启用组成员:nmcli connection up SLAVEname

[root@centos7 ~]# nmcli connection up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/20)
[root@centos7 ~]# nmcli connection up team0-ens34
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/23)
[root@centos7 ~]# nmcli connection up team0-ens38
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/24)

4 查看网络组状态

teamdctl TEAMname state

[root@centos7 ~]# teamdctl team0 state
setup:
runner: loadbalance
ports:
ens34
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
ens38
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0

5 网络组配置文件

(1)MASTER配置文件

[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-team0
DEVICE=team0
TEAM_CONFIG="{"runner":{"name":"loadbalance"}}"
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=team0
UUID=e70483a1-2688-4eb2-9466-8e732360291d
ONBOOT=yes
DEVICETYPE=Team
IPADDR=200.200.200.200
PREFIX=24
GATEWAY=200.200.200.1

(2)组成员(SLAVE)配置文件

[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-team0-ens34
NAME=team0-ens34
UUID=a481fb6d-bf61-413d-a2c7-289966bee1a7
DEVICE=ens34
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort

6 删除网络组

(1)断开连接

[root@centos7 ~]# nmcli connection down team0
Connection 'team0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)

查看下状态

[root@centos7 ~]# teamdctl team0 state
Device "team0" does not exist
[root@centos7 ~]# nmcli connection show
NAME UUID TYPE DEVICE
ens33 be9d1f2f-20e0-4282-9cb5-0da4c8b0fc7c 802-3-ethernet ens33
virbr0 8b1532d4-d99b-4201-8163-44d733302230 bridge virbr0
team0 e70483a1-2688-4eb2-9466-8e732360291d team --
team0-ens34 a481fb6d-bf61-413d-a2c7-289966bee1a7 802-3-ethernet --
team0-ens38 758d0eba-1625-46b2-b539-1d853a45be6b 802-3-ethernet --

可以看到已经关闭成功

(2)删除TEAM组成员

[root@centos7 ~]# nmcli connection delete team0-ens34
Connection 'team0-ens34' (a481fb6d-bf61-413d-a2c7-289966bee1a7) successfully deleted.
[root@centos7 ~]# nmcli connection delete team0-ens38
Connection 'team0-ens38' (758d0eba-1625-46b2-b539-1d853a45be6b) successfully deleted.

(3)删除TEAM组

[root@centos7 ~]# nmcli connection delete team0
Connection 'team0' (e70483a1-2688-4eb2-9466-8e732360291d) successfully deleted.

查看一下

[root@centos7 ~]# nmcli connection show
NAME UUID TYPE DEVICE
ens33 be9d1f2f-20e0-4282-9cb5-0da4c8b0fc7c 802-3-ethernet ens33
virbr0 8b1532d4-d99b-4201-8163-44d733302230 bridge virbr0

已经看不到team0 相关的内容,说明删除成功

原创文章,作者:linux is not unix,如若转载,请注明出处:http://www.178linux.com/74910

(0)
linux is not unixlinux is not unix
上一篇 2017-05-07 15:53
下一篇 2017-05-07 16:00

相关推荐

  • Find命令的使用

    Find命令的基本用法 在Linux系统中find命令是一个强大文件查找类工具,它支持根据文件名,权限,文件大小,访问以及修改时间查找,使用方法如下: find [option] [查找起始路径] [查找条件] [处理动作] 起始路径:指定查找文件或目录的路径,默认为当前目录 查找条件:可根据文件名,权限,文件大小以及从属关系查找文件 处理动作:动查找到的文…

    Linux干货 2017-08-28
  • 互联网安全之sudo使用指南

    一、前言 sudo是什么? sudo是系统管理指令;由于root用户权限过大,在实际生产过程中很少使用root用户直接登录系统,而是使用普通用户登录系统;但是如果普通用户要对系统进行日常维护操作时需要su到root用户,为了提高安全性,可以使用sudo授权某一用户在某一主机以某一用户身份运行某些命令;从而减少root用户密码知晓人,提高系统安全性。 &nbs…

    2015-06-23
  • 数据库简介和简单操作

    数据库 数据库是数据的汇集,它以一定的形式存储在存储介质上 数据库的发展史 萌芽阶段:文件系统,使用磁盘文件来存储数据 初级阶段:第一代数据库,出现了网状模型、层次模型的数据库 中级阶段:第二代数据库,关系型数据库和结构化查询语言 高级阶段:新一代数据库,“关系-对象”型数据库 数据库管理系统和文件管理系统 文件管理系统的缺点是: 编写应用程序不方便 数据冗…

    2017-12-04
  • 【福利招聘】 Base 上海 拍拍货(红杉领投,靠谱金融公司) 共5人

    公司简介 拍拍贷成立于2007年6月,全称为“上海拍拍贷金融信息服务有限公司”,总部位于国际金融中心上海,是中国首批网络信息借贷平台。 拍拍贷是一家由工商部门特批,获批“金融信息服务”的经营范围,得到政府认可的互联网金融平台。拍拍贷用先进的理念和创新的技术建立一个安全、高效、透明的互联网金融平台,规范个人贷款行为,让借入这改善生产生活,让借出者增加投资渠道。…

    Linux干货 2016-12-05
  • Linux系统基础命令

    Linux下一些基本常用命令:   1、Lscpu:显示CPU架构详细信息; [root@centos6 ~]#lscpu 2、Cat:查看合并文件到标准输出; [root@centos6 ~]#cat file    Tac:显示的文本与cat显示的文本相反; 3、Who:显示都有那些用户登录到了系统; [root@…

    Linux干货 2016-07-26
  • 730作业

    1、将/etc/issue文件中的内容转换为大写后保存至/tmp/issue.out文件中 [root@local ~]# cat /etc/issue |tr "[[:lower:]]" "[[:upper:]]" > /tmp/i…

    Linux干货 2016-08-02