网络组Network Teaming,组networkteaming

亚洲城ca88手机版官网

网络组Network Teaming,组networkteaming

网络组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

[[email protected]
~]# 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地址

[[email protected]
~]# 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两块网卡

[[email protected]
~]# nmcli connection add con-name team0-ens34 type team-slave ifname
ens34 master team0

Connection ‘team0-ens34’ (a481fb6d-bf61-413d-a2c7-289966bee1a7)
successfully added.

[[email protected]
~]# 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

[[email protected]
~]# nmcli connection up team0

Connection successfully activated (master waiting for slaves) (D-Bus
active path: /org/freedesktop/NetworkManager/ActiveConnection/20)

[[email protected]
~]# nmcli connection up team0-ens34

Connection successfully activated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/23)

[[email protected]
~]# nmcli connection up team0-ens38

Connection successfully activated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/24)

4 查看网络组状态

teamdctl TEAMname state

[[email protected]
~]# 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配置文件

[[email protected]
~]# 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)配置文件

[[email protected]
~]# 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)断开连接

[[email protected]
~]# nmcli connection down team0

Connection ‘team0’ successfully deactivated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/7)

查看下状态

[[email protected]
~]# teamdctl team0 state

Device “team0” does not exist

[[email protected]
~]# 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组成员

[[email protected]
~]# nmcli connection delete team0-ens34

Connection ‘team0-ens34’ (a481fb6d-bf61-413d-a2c7-289966bee1a7)
successfully deleted.

[[email protected]
~]# nmcli connection delete team0-ens38

Connection ‘team0-ens38’ (758d0eba-1625-46b2-b539-1d853a45be6b)
successfully deleted.

(3)删除TEAM组

[[email protected]
~]# nmcli connection delete team0

Connection ‘team0’ (e70483a1-2688-4eb2-9466-8e732360291d) successfully
deleted.

查看一下

[[email protected]
~]# 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 相关的内容,说明删除成功

Teaming,组networkteaming
网络组team:是将多个网卡聚合在一起,从而实现容错和提高吞吐量 1
创建网络组接口 nmcli connection add t…

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

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

1 创建网络组接口

1 创建网络组接口

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

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

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

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

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

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

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

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

(1)创建网络接口组team0

(1)创建网络接口组team0

[root@centos7 ~]# nmcli connection add type team con-name team0
ifname team0 config ‘{“runner”:{“name”:”loadbalance”}}’

[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.

Connection ‘team0’ (e70483a1-2688-4eb2-9466-8e732360291d) successfully
added.

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

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

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

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

2 创建port接口(SLAVE)

2 创建port接口(SLAVE)

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

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

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

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

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

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

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

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

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

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

创建接口组

创建接口组

    这里使用ens34、ens38两块网卡

    这里使用ens34、ens38两块网卡

[root@centos7 ~]# nmcli connection add con-name team0-ens34 type
team-slave ifname ens34 master team0

[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.

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

[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.

Connection ‘team0-ens38’ (758d0eba-1625-46b2-b539-1d853a45be6b)
successfully added.

3 启用网络组

3 启用网络组

启用网络组:nmcli connection up team0

启用网络组:nmcli connection up team0

启用组成员:nmcli connection up SLAVEname

启用组成员:nmcli connection up SLAVEname

[root@centos7 ~]# nmcli connection up team0

[root@centos7 ~]# nmcli connection up team0

Connection successfully activated (master waiting for slaves) (D-Bus
active path: /org/freedesktop/NetworkManager/ActiveConnection/20)

Connection successfully activated (master waiting for slaves) (D-Bus
active path: /org/freedesktop/NetworkManager/ActiveConnection/20)

[root@centos7 ~]# nmcli connection up team0-ens34

[root@centos7 ~]# nmcli connection up team0-ens34

Connection successfully activated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/23)

Connection successfully activated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/23)

[root@centos7 ~]# nmcli connection up team0-ens38

[root@centos7 ~]# nmcli connection up team0-ens38

Connection successfully activated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/24)

Connection successfully activated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/24)

4 查看网络组状态

4 查看网络组状态

teamdctl TEAMname state

teamdctl TEAMname state

[root@centos7 ~]# teamdctl team0 state

[root@centos7 ~]# teamdctl team0 state

setup:

setup:

runner: loadbalance

runner: loadbalance

ports:

ports:

ens34

ens34

link watches:

link watches:

link summary: up

link summary: up

instance[link_watch_0]:

instance[link_watch_0]:

name: ethtool

name: ethtool

link: up

link: up

down count: 0

down count: 0

ens38

ens38

link watches:

link watches:

link summary: up

link summary: up

instance[link_watch_0]:

instance[link_watch_0]:

name: ethtool

name: ethtool

link: up

link: up

down count: 0

down count: 0

5 网络组配置文件

5 网络组配置文件

(1)MASTER配置文件

(1)MASTER配置文件

[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-team0

[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-team0

DEVICE=team0

DEVICE=team0

TEAM_CONFIG=”{\”runner\”:{\”name\”:\”loadbalance\”}}”

TEAM_CONFIG=”{\”runner\”:{\”name\”:\”loadbalance\”}}”

BOOTPROTO=none

BOOTPROTO=none

DEFROUTE=yes

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV4_FAILURE_FATAL=no

NAME=team0

NAME=team0

UUID=e70483a1-2688-4eb2-9466-8e732360291d

UUID=e70483a1-2688-4eb2-9466-8e732360291d

ONBOOT=yes

ONBOOT=yes

DEVICETYPE=Team

DEVICETYPE=Team

IPADDR=200.200.200.200

IPADDR=200.200.200.200

PREFIX=24

PREFIX=24

GATEWAY=200.200.200.1

GATEWAY=200.200.200.1

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

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

[root@centos7 ~]# cat
/etc/sysconfig/network-scripts/ifcfg-team0-ens34

[root@centos7 ~]# cat
/etc/sysconfig/network-scripts/ifcfg-team0-ens34

NAME=team0-ens34

NAME=team0-ens34

UUID=a481fb6d-bf61-413d-a2c7-289966bee1a7

UUID=a481fb6d-bf61-413d-a2c7-289966bee1a7

DEVICE=ens34

DEVICE=ens34

ONBOOT=yes

ONBOOT=yes

TEAM_MASTER=team0

TEAM_MASTER=team0

DEVICETYPE=TeamPort

DEVICETYPE=TeamPort

6 删除网络组

6 删除网络组

(1)断开连接

(1)断开连接

[root@centos7 ~]# nmcli connection down team0

[root@centos7 ~]# nmcli connection down team0

Connection ‘team0’ successfully deactivated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/7)

Connection ‘team0’ successfully deactivated (D-Bus active path:
/org/freedesktop/NetworkManager/ActiveConnection/7)

查看下状态

查看下状态

[root@centos7 ~]# teamdctl team0 state

[root@centos7 ~]# teamdctl team0 state

Device “team0” does not exist

Device “team0” does not exist

[root@centos7 ~]# nmcli connection show

[root@centos7 ~]# nmcli connection show

NAME UUID TYPE DEVICE

NAME UUID TYPE DEVICE

ens33 be9d1f2f-20e0-4282-9cb5-0da4c8b0fc7c 802-3-ethernet ens33

ens33 be9d1f2f-20e0-4282-9cb5-0da4c8b0fc7c 802-3-ethernet ens33

virbr0 8b1532d4-d99b-4201-8163-44d733302230 bridge virbr0

virbr0 8b1532d4-d99b-4201-8163-44d733302230 bridge virbr0

team0 e70483a1-2688-4eb2-9466-8e732360291d team —

team0 e70483a1-2688-4eb2-9466-8e732360291d team —

team0-ens34 a481fb6d-bf61-413d-a2c7-289966bee1a7 802-3-ethernet —

team0-ens34 a481fb6d-bf61-413d-a2c7-289966bee1a7 802-3-ethernet —

team0-ens38 758d0eba-1625-46b2-b539-1d853a45be6b 802-3-ethernet —

team0-ens38 758d0eba-1625-46b2-b539-1d853a45be6b 802-3-ethernet —

可以看到已经关闭成功

可以看到已经关闭成功

(2)删除TEAM组成员

(2)删除TEAM组成员

[root@centos7 ~]# nmcli connection delete team0-ens34

[root@centos7 ~]# nmcli connection delete team0-ens34

Connection ‘team0-ens34’ (a481fb6d-bf61-413d-a2c7-289966bee1a7)
successfully deleted.

Connection ‘team0-ens34’ (a481fb6d-bf61-413d-a2c7-289966bee1a7)
successfully deleted.

[root@centos7 ~]# nmcli connection delete team0-ens38

[root@centos7 ~]# nmcli connection delete team0-ens38

Connection ‘team0-ens38’ (758d0eba-1625-46b2-b539-1d853a45be6b)
successfully deleted.

Connection ‘team0-ens38’ (758d0eba-1625-46b2-b539-1d853a45be6b)
successfully deleted.

(3)删除TEAM组

(3)删除TEAM组

[root@centos7 ~]# nmcli connection delete team0

[root@centos7 ~]# nmcli connection delete team0

Connection ‘team0’ (e70483a1-2688-4eb2-9466-8e732360291d) successfully
deleted.

Connection ‘team0’ (e70483a1-2688-4eb2-9466-8e732360291d) successfully
deleted.

查看一下

查看一下

[root@centos7 ~]# nmcli connection show

[root@centos7 ~]# nmcli connection show

NAME UUID TYPE DEVICE

NAME UUID TYPE DEVICE

ens33 be9d1f2f-20e0-4282-9cb5-0da4c8b0fc7c 802-3-ethernet ens33

ens33 be9d1f2f-20e0-4282-9cb5-0da4c8b0fc7c 802-3-ethernet ens33

virbr0 8b1532d4-d99b-4201-8163-44d733302230 bridge virbr0

virbr0 8b1532d4-d99b-4201-8163-44d733302230 bridge virbr0

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

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

发表评论

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

网站地图xml地图