Linux7配置team聚合链

centos7、redhat7使用teaming实现聚合链路,能够提升网卡绑定之后的网络吞吐性能,并且提供网卡故障后切换网卡处理的能力

team是基于小型内核驱动实现聚合链路,在用户层提供teamd命令实现链路管理

teamd可以实现以下模式的聚合链路

broadcast       广播容错
roundrobin      负载轮询
activebackup    主备
loadbalance     负载均衡
lacp            需要交换机支持lacp协议
  • 主备模式
1. 添加一个team0 生成绑定网卡team0以及team0的配置文件
nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}' 

2. 修改team0的配置
[root@localhost ~]# nmcli connection modify ipv4.addresses 192.168.1.7/24 ipv4.gateway 8.8.8.8 ipv4.dns 8.8.8.8 ipv4.method manual

3.ping下刚才加的team0
[root@localhost ~]# ping 192.168.1.7
PING 192.168.1.7 (192.168.1.7) 56(84) bytes of data.
64 bytes from 192.168.1.7: icmp_seq=1 ttl=64 time=0.142 ms
...

4. 查看team的状态
[root@localhost ~]# teamdctl team0 state
setup:
  runner: activebackup
runner:
  active port: 
[root@localhost ~]# 

5. 将网卡eno16777736绑定到team0上
[root@localhost ~]# nmcli connection add type team-slave con-name team0-port1 ifname eno16777736 master team0 
Connection 'team0-port1' (afd6ff8c-6301-4140-af5f-6ca509136ae5) successfully added.
[root@localhost ~]# 

6.同理,第二块网卡也是如此:
[root@localhost ~]# nmcli connection add type team-slave con-name team0-port2 ifname ens38 master team0 
Connection 'team0-port2' (d0b22519-dbe6-4080-bf25-62eb0da7eacb) successfully added.
[root@localhost ~]# 

7.现在team0链路上有互为主备的的网卡了
[root@localhost ~]# teamdctl team0 state
setup:
  runner: activebackup
ports:
  eno16777736
    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
[root@localhost ~]# 

//连接和设备的状态
[root@localhost ~]# nmcli device 
DEVICE       TYPE      STATE      CONNECTION  
virbr0       bridge    connected  virbr0      
eno16777736  ethernet  connected  team0-port1 
ens38        ethernet  connected  team0-port2 
team0        team      connected  team0       
lo           loopback  unmanaged  --          
virbr0-nic   tap       unmanaged  --          
[root@localhost ~]# nmcli connection 
NAME         UUID                                  TYPE            DEVICE      
virbr0       76a121d2-73ca-45fd-be24-60c5a46e5fdb  bridge          virbr0      
eno16777736  be3b17c4-48df-4513-aa1d-a653b7a57cc2  802-3-ethernet  --          
team0-port1  fa3cb438-f7b9-430f-b050-8f1a3cfdbfc6  802-3-ethernet  eno16777736 
team0        a1ff597f-db0a-43e5-8076-c902e0df7290  team            team0       
team0-port2  09b59d72-2a52-4cad-be70-7187ed2e4ecd  802-3-ethernet  ens38       
ens33-dhcp   97ab866a-3136-4349-9961-c26524d8d408  802-3-ethernet  --          
[root@localhost ~]# 

7.配置绑定网卡team0 结束,最后重启一下team0和NetworkMnanger就可以了
[root@localhost ~]# nmcli connection down team0 && nmcli connection up team0

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐