bond聚合和team聚合

2024-03-23 13:44
文章标签 聚合 bond team

本文主要是介绍bond聚合和team聚合,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

链路聚合

网卡的链路聚合就是将多块网卡连接起来,当一块网卡损坏,网络依旧可以正常运行,可以有效的防止因为网卡损坏带来的损失,同时也可以提高网络访问速度。

网卡的链路聚合方式:

​ bond:最多可以添加两块网卡

​ team:最多可以添加八块网卡

bond的常用的2种模式:

​ bond0(balance-rr)

​ bond0用于负载轮询(2个网单独都是100MB,聚合为1个网络传输带宽为200MB)

​ bond1(active-backup)

​ bond1用于高可用,其中一条线若断线,其他线路将会自动备援

                            --> eth0  ----\app  --发送数据到--> bond0          <---> switch --> eth1  ----/

链路聚合配置

bond聚合

bond0test

[root@cjy ~]# nmcli device
DEVICE  TYPE      STATE                   CONNECTION         
ens160  ethernet  connected               ens160             
ens192  ethernet  connected               Wired connection 1 
ens224  ethernet  connected               Wired connection 2 
lo      loopback  connected (externally)  lo                               
创建bond0, 模式为balance-rr
[root@cjy ~]# nmcli connection add type bond mode balance-rr con-name bond0 ifname bond0 ipv4.method manual ipv4.addresses 192.168.159.250/24 ipv4.gateway 192.168.159.2 ipv4.dns 192.168.159.2
Connection 'bond0' (2715a7c6-668b-4487-9be1-733a7eb04bd0) successfully added.
添加物理网卡连接至bond0
[root@cjy ~]# nmcli connection add type bond-slave con-name bond-slave0 ifname ens192 master bond0
Connection 'bond-slave0' (c9e7e854-4208-403e-8d56-d90da7d645a2) successfully added.
[root@cjy ~]# nmcli connection add type bond-slave con-name bond-slave1 ifname ens224 master bond0
Connection 'bond-slave1' (2923a403-6998-45fb-b9f6-7fe467b514e8) successfully added.
激活bond-slave0和bond-slave1
[root@cjy ~]# nmcli connection up bond-slave0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
[root@cjy ~]# nmcli connection up bond-slave1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
查看bond配置信息
[root@cjy ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.14.0-362.8.1.el9_3.x86_64Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0Slave Interface: ens192
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:b5:d1:27
Slave queue ID: 0Slave Interface: ens224
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:b5:d1:31
Slave queue ID: 0再删除bond0
[root@cjy ~]# nmcli connection down bond-slave0
Connection 'bond-slave0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
[root@cjy ~]# nmcli connection down bond-slave1
Connection 'bond-slave1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[root@cjy ~]# nmcli connection
NAME                UUID                                  TYPE      DEVICE 
ens160              5be8f7d1-83b5-3896-8dad-4ea38657f2ab  ethernet  ens160 
bond0               2715a7c6-668b-4487-9be1-733a7eb04bd0  bond      bond0  
lo                  4590f7d0-9e56-4359-98e8-300780d6cacc  loopback  lo     
Wired connection 1  b1db212b-4873-3c5c-a19d-e2163242e0fb  ethernet  ens192 
Wired connection 2  d0109af2-61dd-3e43-96b9-5ee112e9935a  ethernet  ens224 
bond-slave0         c9e7e854-4208-403e-8d56-d90da7d645a2  ethernet  --     
bond-slave1         2923a403-6998-45fb-b9f6-7fe467b514e8  ethernet  --     
[root@cjy ~]# nmcli connection delete bond-slave0
Connection 'bond-slave0' (c9e7e854-4208-403e-8d56-d90da7d645a2) successfully deleted.
[root@cjy ~]# nmcli connection delete bond-slave1
Connection 'bond-slave1' (2923a403-6998-45fb-b9f6-7fe467b514e8) successfully deleted.
[root@cjy ~]# nmcli connection down bond0
Connection 'bond0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
[root@cjy ~]# nmcli connection delete bond0
Connection 'bond0' (2715a7c6-668b-4487-9be1-733a7eb04bd0) successfully deleted.

bond1

[root@cjy ~]# nmcli device
DEVICE  TYPE      STATE                   CONNECTION         
ens160  ethernet  connected               ens160             
ens192  ethernet  connected               Wired connection 1 
ens224  ethernet  connected               Wired connection 2 
lo      loopback  connected (externally)  lo                 
创建bond1,模式为active-backup
[root@cjy ~]# nmcli connection add type bond con-name bond1 ifname bond1 mode active-backup ipv4.method manual ipv4.addresses 192.168.159.250/24 ipv4.gateway 192.168.159.2 ipv4.dns 192.168.159.2
Connection 'bond1' (69ce3544-e374-48a8-9ce2-5f02a7eb4729) successfully added.
添加物理网卡连接至bond1
[root@cjy ~]# nmcli connection add type bond-slave con-name bond-slave0 ifname ens192 master bond1
Connection 'bond-slave0' (d7b44509-8d0c-4771-9449-105d68269e76) successfully added.
[root@cjy ~]# nmcli connection add type bond-slave con-name bond-slave1 ifname ens224 master bond1
Connection 'bond-slave1' (258a0f19-5b2e-48a5-926f-b9896fcdbb03) successfully added.
启用连接
[root@cjy ~]# nmcli connection up bond1
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)
[root@cjy ~]# nmcli connection up bond-slave0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/12)
[root@cjy ~]# nmcli connection up bond-slave1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/13)
查看验证
[root@cjy ~]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v5.14.0-362.8.1.el9_3.x86_64Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens192
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0Slave Interface: ens192
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:b5:d1:27
Slave queue ID: 0Slave Interface: ens224
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:b5:d1:31
Slave queue ID: 0停止ens224会自动切换
[root@cjy ~]# nmcli device disconnect ens224
Device 'ens224' successfully disconnected.
[root@cjy ~]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v5.14.0-362.8.1.el9_3.x86_64Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens192
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0Slave Interface: ens192
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:b5:d1:27
Slave queue ID: 0再删除bond1
[root@cjy ~]# nmcli connection
NAME                UUID                                  TYPE      DEVICE 
ens160              5be8f7d1-83b5-3896-8dad-4ea38657f2ab  ethernet  ens160 
bond1               69ce3544-e374-48a8-9ce2-5f02a7eb4729  bond      bond1  
lo                  4590f7d0-9e56-4359-98e8-300780d6cacc  loopback  lo     
bond-slave0         d7b44509-8d0c-4771-9449-105d68269e76  ethernet  ens192 
bond-slave1         258a0f19-5b2e-48a5-926f-b9896fcdbb03  ethernet  --     
Wired connection 1  b1db212b-4873-3c5c-a19d-e2163242e0fb  ethernet  --     
Wired connection 2  d0109af2-61dd-3e43-96b9-5ee112e9935a  ethernet  --     
[root@cjy ~]# nmcli connection delete bond-slave0
Connection 'bond-slave0' (d7b44509-8d0c-4771-9449-105d68269e76) successfully deleted.
[root@cjy ~]# nmcli connection delete bond-slave1
Connection 'bond-slave1' (258a0f19-5b2e-48a5-926f-b9896fcdbb03) successfully deleted.
[root@cjy ~]# nmcli connection delete bond1
Connection 'bond1' (69ce3544-e374-48a8-9ce2-5f02a7eb4729) successfully deleted.
[root@cjy ~]# nmcli connection
NAME                UUID                                  TYPE      DEVICE 
ens160              5be8f7d1-83b5-3896-8dad-4ea38657f2ab  ethernet  ens160 
lo                  4590f7d0-9e56-4359-98e8-300780d6cacc  loopback  lo     
Wired connection 1  b1db212b-4873-3c5c-a19d-e2163242e0fb  ethernet  ens192 
Wired connection 2  d0109af2-61dd-3e43-96b9-5ee112e9935a  ethernet  --     

team聚合

创建team0
[root@cjy ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}' ipv4.addresses 192.168.159.250/24 ipv4.gateway 192.168.159.2 ipv4.dns 192.168.159.2 ipv4.method manual
Connection 'team0' (6ba01058-a3ff-491a-be20-9c4457571e39) successfully added.
添加物理网卡连接至team0
[root@cjy ~]# nmcli connection add type team-slave con-name team0-port1 ifname ens192 master team0
Connection 'team0-port1' (79f875f8-5740-458b-b406-9525c13f8b09) successfully added.
[root@cjy ~]# nmcli connection add type team-slave con-name team0-port2 ifname ens224 master team0
Connection 'team0-port2' (6b6a1dd0-7651-4fb0-b77f-793e785bdf0e) successfully added.
[root@cjy ~]# nmcli connection down  "Wired connection 1"
Connection 'Wired connection 1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/17)
[root@cjy ~]# nmcli connection down  "Wired connection 2"
Connection 'Wired connection 2' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/16)
检查team0状态
[root@cjy ~]# ping -I team0 192.168.159.250
PING 192.168.159.250 (192.168.159.250) from 192.168.159.250 team0: 56(84) bytes of data.
64 bytes from 192.168.159.250: icmp_seq=1 ttl=64 time=0.096 ms
64 bytes from 192.168.159.250: icmp_seq=2 ttl=64 time=0.122 ms
64 bytes from 192.168.159.250: icmp_seq=3 ttl=64 time=0.198 ms
64 bytes from 192.168.159.250: icmp_seq=4 ttl=64 time=0.256 ms
64 bytes from 192.168.159.250: icmp_seq=5 ttl=64 time=0.087 ms
64 bytes from 192.168.159.250: icmp_seq=6 ttl=64 time=0.245 ms
^C
--- 192.168.159.250 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5154ms
rtt min/avg/max/mdev = 0.087/0.167/0.256/0.068 ms
查看
[root@cjy ~]# teamdctl team0 state
setup:runner: activebackup
ports:ens192link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0ens224link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0
runner:active port: ens192
断掉后检测
[root@cjy ~]# nmcli device disconnect ens224
Device 'ens224' successfully disconnected.
[root@cjy ~]# teamdctl team0 state
setup:runner: activebackup
ports:ens192link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0
runner:active port: ens192

动态修改team模式

[root@cjy ~]#  teamdctl team0 config dump > team.conf
[root@cjy ~]#  vi team.conf
[root@cjy ~]#  cat team.conf
{"device": "team0","mcast_rejoin": {"count": 1},"notify_peers": {"count": 1},"ports": {"ens192": {"link_watch": {"name": "ethtool"}},"ens224": {"link_watch": {"name": "ethtool"}}},"runner": {"name": "loadbalance"}
}
以最新修改的配置选项修改team0属性
[root@cjy ~]# nmcli connection modify team0 team.config team.conf
修改之后需要重启team0
[root@cjy ~]# nmcli connection
NAME                UUID                                  TYPE      DEVICE 
ens160              5be8f7d1-83b5-3896-8dad-4ea38657f2ab  ethernet  ens160 
lo                  4590f7d0-9e56-4359-98e8-300780d6cacc  loopback  lo     
team0               6ba01058-a3ff-491a-be20-9c4457571e39  team      team0  
team0-port1         79f875f8-5740-458b-b406-9525c13f8b09  ethernet  ens192 
team0-port2         6b6a1dd0-7651-4fb0-b77f-793e785bdf0e  ethernet  ens224 
Wired connection 1  b1db212b-4873-3c5c-a19d-e2163242e0fb  ethernet  --     
Wired connection 2  d0109af2-61dd-3e43-96b9-5ee112e9935a  ethernet  --    
[root@cjy ~]# nmcli connection down team0
Connection 'team0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/22)
[root@cjy ~]# nmcli connection up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/24)
查看是否成功
[root@cjy ~]# teamdctl team0 state
setup:runner: loadbalance
ports:ens192link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0ens224link watches:link summary: upinstance[link_watch_0]:name: ethtoollink: updown count: 0

这篇关于bond聚合和team聚合的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/838475

相关文章

Jenkins构建Maven聚合工程,指定构建子模块

一、设置单独编译构建子模块 配置: 1、Root POM指向父pom.xml 2、Goals and options指定构建模块的参数: mvn -pl project1/project1-son -am clean package 单独构建project1-son项目以及它所依赖的其它项目。 说明: mvn clean package -pl 父级模块名/子模块名 -am参数

ElasticSearch的DSL查询⑤(ES数据聚合、DSL语法数据聚合、RestClient数据聚合)

目录 一、数据聚合 1.1 DSL实现聚合 1.1.1 Bucket聚合  1.1.2 带条件聚合 1.1.3 Metric聚合 1.1.4 总结 2.1 RestClient实现聚合 2.1.1 Bucket聚合 2.1.2 带条件聚合 2.2.3 Metric聚合 一、数据聚合 聚合(aggregations)可以让我们极其方便的实现对数据的统计、分析、运算。例如:

七、Maven继承和聚合关系、及Maven的仓库及查找顺序

1.继承   2.聚合   3.Maven的仓库及查找顺序

maven-聚合工程

聚合工程: 聚合工程里可以分为顶级项目(顶级工程、父工程)与子工程,这两者的关系其实就是父子继承的关系,子工程在maven里称之为模块(module),模块之间是平级,是可以相互依赖的。子模块可以使用顶级工程里所有的资源(依赖),子模块之间如果要使用资源,必须构建依赖(构建关系)一个顶级工程是可以由多个不同的子工程共同组合而成。

链路聚合配置

链路聚合配置前需要将物理接口进行清除,然后将接口加入到聚合内完成对接。 对接端口核心3口4口与财务核心的23口与24口进行对接。 拓扑如下:​​​​​​​ 配置如下: 核心路由器[CK]dhcp enable [CK]interface GigabitEthernet 0/0/0[CK-GigabitEthernet0/0/0]ip address dhcp-alloc[CK]a

华为eNSP:手工链路聚合和动态链路聚合

手工链路聚合(静态链路聚合) 一、拓扑图 二、交换机配置过程 [s1]int Eth-Trunk 1#创建进入链路聚合组1[s1-Eth-Trunk1]trunkport g0/0/1#将g0/0/1口加入聚合组1[s1-Eth-Trunk1]trunkport g0/0/2[s1-Eth-Trunk1]trunkport g0/0/3[s1-Eth-Trunk1]quit 配

Flink实战案例(二十三):自定义时间和窗口的操作符(四)window functions之增量聚合函数(一)ReduceFunction

实例一 例子: 计算每个传感器15s窗口中的温度最小值 val minTempPerWindow = sensorData.map(r => (r.id, r.temperature)).keyBy(_._1).timeWindow(Time.seconds(15)).reduce((r1, r2) => (r1._1, r1._2.min(r2._2))) 实例二 ReduceFun

【硬刚ES】ES基础(十四)Elasticsearch聚合分析简介

本文是对《【硬刚大数据之学习路线篇】从零到大数据专家的学习指南(全面升级版)》的ES部分补充。

【硬刚ES】ES入门 (13)Java API 操作(4)DQL(1) 请求体查询/term 查询,查询条件为关键字/分页查询/数据排序/过滤字段/Bool 查询/范围查询/模糊查询/高亮查询/聚合查

本文是对《【硬刚大数据之学习路线篇】从零到大数据专家的学习指南(全面升级版)》的ES部分补充。 1 请求体查询 2 高亮查询 3 聚合查询 package com.atguigu.es.test;import org.apache.http.HttpHost;import org.apache.lucene.search.TotalHits;import org.elasticse

hadoop 日志聚合 jobhistory配置

一、前言 安装了hadoop-2.7.3集群,登陆YARN WEB界面,发现下图mapreduce应用UI入口都无法使用,现记录下处理方案  二、处理方案 1.yarn-site.xml配置yarn.resourcemanager.webapp.address,如果没配置ApplicationMaster入口无法使用  <property>          <name>yarn.resou