NIC Teaming on CentOS 7 with nmcli

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NIC Teaming on CentOS 7 with nmcli相关的知识,希望对你有一定的参考价值。

 NIC  Teaming on CentOS 7 with nmcli

1、Teaming Daemon安装

为了使用teaming功能,首先必须安装teamd包,系统通常不会安装。使用如下命令进行安装。

#yum install teamd -y

2、nmcli配置teaming

首先查看系统当前connection及device配置

[[email protected] Desktop]# nmcli connection  show

NAME  UUID  TYPE  DEVICE 

[[email protected] Desktop]# nmcli device status

DEVICE       TYPE      STATE         CONNECTION 

eno16777736  ethernet  disconnected  --         

eno33554992  ethernet  disconnected  --         

lo           loopback  unmanaged     --         

[[email protected] Desktop]# 

创建teaming接口

#nmcli con add type team con-name myteam0 ifname team0 config ‘{ "runner": {"name": "loadbalance"}}‘

配置team静态ip

#nmcli con mod myteam0 ipv4.addresses 192.168.31.108/24

#nmcli con mod myteam0 ipv4.gateway 192.168.31.1

#nmcli con mod myteam0 ipv4.method manual

添加eno16777736、eno33554992至myteam0中。

#nmcli con add type team-slave con-name myteam0-port1 ifname eno16777736 master myteam0

#nmcli con add type team-slave con-name myteam0-port2 ifname eno33554992 master myteam0

激活taaming接口

#nmcli con up myteam0

检查配置

[[email protected] Desktop]# nmcli connection  show

NAME           UUID                                  TYPE            DEVICE      

myteam0-port2  1a0f2bfd-cea1-4c7b-b2de-d34199b8561e  802-3-ethernet  eno33554992 

myteam0-port1  8e0c325c-d069-4014-bb75-1fa1f4674618  802-3-ethernet  eno16777736 

myteam0        e2976c8e-da7d-4901-88c6-db8a9913947c  team            team0       

[[email protected] Desktop]# nmcli device status

DEVICE       TYPE      STATE      CONNECTION    

eno16777736  ethernet  connected  myteam0-port1 

eno33554992  ethernet  connected  myteam0-port2 

team0        team      connected  myteam0       

lo           loopback  unmanaged  --            

[[email protected] Desktop]# ip a s

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000

    link/ether 00:0c:29:51:e8:75 brd ff:ff:ff:ff:ff:ff

3: eno33554992: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master team0 state UP qlen 1000

    link/ether 00:0c:29:51:e8:75 brd ff:ff:ff:ff:ff:ff

4: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 

    link/ether 00:0c:29:51:e8:75 brd ff:ff:ff:ff:ff:ff

    inet 192.168.31.108/24 brd 192.168.31.255 scope global team0

       valid_lft forever preferred_lft forever

    inet6 fe80::20c:29ff:fe51:e875/64 scope link tentative dadfailed 

       valid_lft forever preferred_lft forever

[[email protected] ~]# teamdctl team0 state

setup:

  runner: loadbalance

ports:

  eno16777736

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

  eno33554992

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

通过teamnl查看slave网卡状态

[[email protected] ~]# teamnl team0 ports

 3: eno33554992: up 1000Mbit FD 

 2: eno16777736: up 1000Mbit FD 

[[email protected] ~]# 

3、修改teaming配置

[[email protected] Desktop]#nmcli connection modify myteam0 team.config ‘{ "runner": {"name": "roundrobin"}}‘

需要重启下team0方可生效[[email protected] Desktop]# nmcli connection down myteam0

Connection ‘myteam0‘ successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)

[[email protected] Desktop]# nmcli connection show

NAME           UUID                                  TYPE            DEVICE 

myteam0-port1  2b975876-780f-4181-971e-a79cf6a07a40  802-3-ethernet  --     

myteam0-port2  24e3ef82-fb93-4d11-9a6e-4c27227f7f66  802-3-ethernet  --     

myteam0        1f4ed5e2-46a1-4dbf-a870-5b088957a434  team            --     

[[email protected] Desktop]# nmcli device status

DEVICE       TYPE      STATE         CONNECTION 

eno16777736  ethernet  disconnected  --         

eno33554992  ethernet  disconnected  --                

lo           loopback  unmanaged     --         

[[email protected] Desktop]# nmcli connection up myteam0-port1

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

[[email protected] Desktop]# nmcli connection up myteam0-port2

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

[[email protected] Desktop]# nmcli connection up myteam0

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

[[email protected] Desktop]# nmcli device status

DEVICE       TYPE      STATE      CONNECTION    

eno16777736  ethernet  connected  myteam0-port1 

eno33554992  ethernet  connected  myteam0-port2 

team0        team      connected  myteam0       

bond0        bond      unmanaged  --            

lo           loopback  unmanaged  --            

[[email protected] Desktop]# nmcli connection show

NAME           UUID                                  TYPE            DEVICE      

myteam0-port1  2b975876-780f-4181-971e-a79cf6a07a40  802-3-ethernet  eno16777736 

myteam0-port2  24e3ef82-fb93-4d11-9a6e-4c27227f7f66  802-3-ethernet  eno33554992 

myteam0        1f4ed5e2-46a1-4dbf-a870-5b088957a434  team            team0       

[[email protected] Desktop]# teamdctl team0 state

setup:

  runner: roundrobin

ports:

  eno16777736

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

  eno33554992

    link watches:

      link summary: up

      instance[link_watch_0]:

        name: ethtool

        link: up

        down count: 0

[[email protected] Desktop]# 

本文出自 “技术成就梦想!” 博客,请务必保留此出处http://dreamsanqin.blog.51cto.com/845412/1885582

以上是关于NIC Teaming on CentOS 7 with nmcli的主要内容,如果未能解决你的问题,请参考以下文章

NIC Bonding on CentOS 7 with nmtui

NIC Bonding on CentOS 7 with nmcli

Windows Server 笔记:Windows Server 2012 R2 NIC Teaming(NIC组)

Windows Server 2012 NIC Teaming配置实战

windows2012的NIC Teaming配置

Win10怎样绑定双网卡或多网卡做Nic Teaming链路聚合