網路組Network Teaming

來源:互聯網
上載者:User

標籤:提高   style   res   ethtool   setup   ns3   bin   adb   ack   

網路組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 相關的內容,說明刪除成功

網路組Network Teaming

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.