Linux7配置team聚合链之主备模式

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

  • 4
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
在CentOS 7.6上实现双网卡绑定teaming,可以按照以下步骤进行操作: 1. 确认系统中已经安装 teaming 相关软件包,如果没有安装,可以使用以下命令安装: ``` yum install -y teamd teamd-devel libteam ``` 2. 编辑网卡配置文件,例如 eth0 和 eth1,可以使用 vim 或者其他编辑器打开 /etc/sysconfig/network-scripts 目录下的 ifcfg-eth0 和 ifcfg-eth1 文件。 ``` vim /etc/sysconfig/network-scripts/ifcfg-eth0 ``` ``` vim /etc/sysconfig/network-scripts/ifcfg-eth1 ``` 在这两个文件中都添加以下内容: ``` TEAM_MASTER=team0 TEAM_PORT_CONFIG='{"prio": 100}' ``` 其中 TEAM_MASTER 指定了 teaming 的名称,这里取名为 team0;TEAM_PORT_CONFIG 定义了端口的优先级,这里设置为 100。 3. 创建 team0 设配置文件,可以使用以下命令创建 /etc/sysconfig/network-scripts/ifcfg-team0 文件。 ``` vim /etc/sysconfig/network-scripts/ifcfg-team0 ``` 在该文件中添加以下内容: ``` DEVICE=team0 DEVICETYPE=Team TEAM_CONFIG='{"runner": {"name": "activebackup"}}' BOOTPROTO=none ONBOOT=yes ``` 其中 TEAM_CONFIG 定义了 teaming 的模式,这里设置为 activebackup(模式)。 4. 重启网络服务,使配置生效。 ``` systemctl restart network ``` 或者使用以下命令重启 teaming 服务。 ``` systemctl restart teamd ``` 5. 验证 teaming 是否生效,可以使用以下命令查看 teaming 设的状态。 ``` teamdctl team0 state ``` 如果输出类似以下内容,说明 teaming 配置成功。 ``` setup: runner: activebackup ports: eth0 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up eth1 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up runner: active port: eth0 ``` 至此,双网卡绑定 teaming 实现 mod=1 activebackup 模式配置完成。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值