Network Teaming

Network Teaming

对网络物理链路进行组合或聚合,以提供具有更高吞吐量的逻辑链路或冗余能力,这个最初在Linux内核中实现的概念被广泛地称为bonding,Network Teaming被选择来指代这个概念的新实现,现有的bonding驱动程序不受影响.Team提供一个小型内核驱动程序来实现包的快速处理,并提供各种用户空间应用程序来完成用户空间中的其他所有工作。

Teambonding的对比

FeatureBondingTeam
broadcast Tx policyYesYes
round-robin Tx policyYesYes
active-backup Tx policyYesYes
LACP (802.3ad) supportYes (active only)Yes
Hash-based Tx policyYesYes
User can set hash functionNoYes
Tx load-balancing support (TLB)YesYes
LACP hash port selectYesYes
load-balancing for LACP supportNoYes
Ethtool link monitoringYesYes
ARP link monitoringYesYes
NS/NA (IPv6) link monitoringNoYes
ports up/down delaysYesYes
port priorities and stickiness (“primary” option enhancement)NoYes
separate per-port link monitoring setupNoYes
multiple link monitoring setupLimitedYes
lockless Tx/Rx pathNo (rwlock)Yes (RCU)
VLAN supportYesYes
user-space runtime controlLimitedFull
Logic in user-spaceNoYes
ExtensibilityHardEasy
Modular designNoYes
Performance overheadLowVery Low
D-Bus interfaceNoYes
multiple device stackingYesYes
zero config using LLDPNo(in planning)
NetworkManager supportYesYes

Team模式

  • broadcast:广播模式,数据传输到所有端口。
  • round-robin :轮询模式,数据依次在所有端口上传输。
  • active-backup :主备模式,当其他端口/链接作为backup时,使用一个端口/链接。
  • loadbalance:负载均衡模式,具有Tx负载均衡和基于bpf的Tx端口选择器。
  • lacp :lacp模式,需要交换机开启lacp协议。

配置Team

查看网络设备

# nmcli connection show
NAME                UUID                                  TYPE      DEVICE
ens33               ec77b707-d5a8-43b2-963e-bf5ed6837418  ethernet  ens33
Wired connection 1  c5ec8230-4f6b-315b-9e3b-71f74b397764  ethernet  ens37
Wired connection 2  3db638ab-7ca7-3cee-a7ac-81a79d658939  ethernet  ens38

查看设备连接状态

# nmcli device status
DEVICE  TYPE      STATE      CONNECTION
ens33   ethernet  connected  ens33
ens37   ethernet  connected  Wired connection 1
ens38   ethernet  connected  Wired connection 2
lo      loopback  unmanaged  --

创建team接口,名称为team0,配置为主备模式

# nmcli connection add type team ifname team0 con-name team0  ipv4.addresses 192.168.240.138/24 ipv4.method manual  ipv4.gateway 192.168.240.2 autoconnect yes config '{"runner":{"name":"activebackup"}}'
Connection 'team0' (c54cd942-fb78-4eee-aa10-022d2fe55187) successfully added.

执行成功后,会生成配置文件,路径为/etc/sysconfig/network-scripts/ifcfg-team0

添加ens37设备到team中

# nmcli con add type team-slave con-name team0-port1 ifname ens37 master team0
Connection 'team0-port1' (d6c693e6-0c29-413f-804c-5b0b9aeeed3c) successfully added.

添加ens38设备到team中

#  nmcli con add type team-slave con-name team0-port2 ifname ens38 master team0
Connection 'team0-port2' (9b7bed39-9006-4a2d-9582-9ee30114fbf2) successfully added.

启用连接

# nmcli conn up team0-port1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
# nmcli conn up team0-port2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)

查看连接状态

# nmcli conn
NAME                UUID                                  TYPE      DEVICE
ens33               ec77b707-d5a8-43b2-963e-bf5ed6837418  ethernet  ens33
team0               c54cd942-fb78-4eee-aa10-022d2fe55187  team      team0
team0-port1         79b2e171-b645-481f-af16-a68af4aab4ed  ethernet  ens37
team0-port2         9b7bed39-9006-4a2d-9582-9ee30114fbf2  ethernet  ens38
Wired connection 1  c5ec8230-4f6b-315b-9e3b-71f74b397764  ethernet  --
Wired connection 2  3db638ab-7ca7-3cee-a7ac-81a79d658939  ethernet  --

查看team状态

# teamdctl team0 state
setup:
  runner: activebackup
ports:
  ens37
    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
runner:
  active port: ens37

日常管理操作

查看team状态

# teamdctl team0 state
setup:
  runner: activebackup
ports:
  ens37
    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
runner:
  active port: ens37

从team中移除设备

# teamdctl team0 port remove ens37
[root@localhost ~]# teamdctl team0 state
setup:
  runner: activebackup
ports:
  ens38
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
runner:
  active port: ens38

添加设备到team中

# teamdctl team0 state
setup:
  runner: activebackup
ports:
  ens37
    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
runner:
  active port: ens38

参考文档

  • https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-Understanding_the_Network_Teaming_Daemon_and_the_Runners
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值