NIC Bonding on CentOS 7 with nmtui

当系统管理员希望增加可用带宽,并提供冗余和负载平衡的数据传输,内核支持bonding允许以聚合的方式实现。简单地说,绑定意味着将两个或多个物理网络接口(称为奴隶)聚合成一个单独的逻辑节点(称为主网络)。如果一个特定的NIC(网络接口卡)的经验问题,通信不受影响只要其他保持活跃。

1.先决条件

默认情况下,bonding内核模块没有启用。因此,我们将需要加载它并确保它持久。使用modprobe--first-time加载bonding模块,如果加载模块失败,会发出警告。

# modprobe --first-time bonding

以上的命令仅加载bondiing模块为当前会话,服务器重启后模块不会自动加载。为了确保持续加载,创建/etc/modules-load.d/bonding.conf文件放置于文件夹/etc/modules-load.d目录中,确保每次服务器重启时加载bonding模块。

# echo "# Load thebonding kernel module at boot" > /etc/modules-load.d/bonding.conf

# echo "bonding">> /etc/modules-load.d/bonding.conf

服务器重启之后确保bonding模块自动加载

[root@MiWiFi-R3-srvDesktop]# lsmod|grep bonding

bonding              136705  0

[root@MiWiFi-R3-srvDesktop]#

2.配置bonding

查看系统当前可用网卡,当前两块网卡上均无可用连接。

[root@MiWiFi-R3-srv ~]# nmcli device status

DEVICE       TYPE      STATE         CONNECTION

bond0        bond      disconnected  --

eno16777736  ethernet  disconnected  --

eno33554992  ethernet  disconnected  --

lo           loopback  unmanaged     --

[root@MiWiFi-R3-srv ~]# nmcli connection show

NAME  UUID TYPE  DEVICE

当前服务器网卡信息如下

[root@MiWiFi-R3-srvDesktop]# ifconfig

eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

ether 00:0c:29:51:e8:75  txqueuelen 1000  (Ethernet)

RX packets 2227  bytes 216343 (211.2 KiB)

RX errors 0  dropped 0 overruns 0  frame 0

TX packets 109  bytes 10643 (10.3 KiB)

TX errors 0 dropped 0 overruns 0  carrier0  collisions 0

eno33554992:flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

ether 00:0c:29:51:e8:7f  txqueuelen 1000  (Ethernet)

RX packets 2633  bytes 300745 (293.6 KiB)

RX errors 0  dropped 0 overruns 0  frame 0

TX packets 138  bytes 11748 (11.4 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

lo:flags=73<UP,LOOPBACK,RUNNING>  mtu65536

inet 127.0.0.1  netmask 255.0.0.0

inet6 ::1  prefixlen 128 scopeid 0x10<host>

loop txqueuelen 0  (Local Loopback)

RX packets 2  bytes 196 (196.0 B)

RX errors 0  dropped 0 overruns 0  frame 0

TX packets 2  bytes 196 (196.0 B)

TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

[root@MiWiFi-R3-srvDesktop]#

登陆图形界面,nmtui打开配置界面如下

[root@MiWiFi-R3-srvDesktop]#nmtui

                         选中edit a connection确定

点击add

bondàcreate进去bond配置界面

设置profile name及device名,选择add添加网卡,如下

设置profile name 为eth0,device设置为网卡eno16777736,点击ok。相同方法配置eth1,device设置为eno33554992。

配置完成后,返回主界面,设置mode为active-backup,设置primary设备为eno16777736。点击ok退出。

查看服务器当前配置

[root@MiWiFi-R3-srvDesktop]# cat /proc/net/bonding/mybond

Ethernet Channel BondingDriver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance(active-backup)

Primary Slave: eno16777736(primary_reselect always)

Currently Active Slave:eno16777736

MII Status: up

MII Polling Interval (ms):100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eno33554992

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr:00:0c:29:51:e8:7f

Slave queue ID: 0

Slave Interface: eno16777736

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr:00:0c:29:51:e8:75

Slave queue ID: 0

[root@MiWiFi-R3-srvDesktop]#

查看网卡信息,eno16777736与eno33554992网卡mac地址相同

[root@MiWiFi-R3-srvDesktop]# ifconfig

eno16777736:flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500

ether 00:0c:29:51:e8:7f  txqueuelen 1000  (Ethernet)

RX packets 3626  bytes 343058 (335.0 KiB)

RX errors 0  dropped 0 overruns 0  frame 0

TX packets 138  bytes 15571 (15.2 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

eno33554992:flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500

ether 00:0c:29:51:e8:7f  txqueuelen 1000  (Ethernet)

RX packets 4034  bytes 428144 (418.1 KiB)

RX errors 0  dropped 34 overruns 0  frame 0

TX packets 139  bytes 11838 (11.5 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

lo:flags=73<UP,LOOPBACK,RUNNING>  mtu65536

inet 127.0.0.1  netmask 255.0.0.0

inet6 ::1  prefixlen 128 scopeid 0x10<host>

loop txqueuelen 0  (Local Loopback)

RX packets 2  bytes 196 (196.0 B)

RX errors 0  dropped 0 overruns 0  frame 0

TX packets 2  bytes 196 (196.0 B)

TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

mybond:flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500

inet 192.168.31.119  netmask 255.255.255.0  broadcast 192.168.31.255

inet6 fe80::20c:29ff:fe51:e87f  prefixlen 64 scopeid 0x20<link>

ether 00:0c:29:51:e8:7f  txqueuelen 0 (Ethernet)

RX packets 66  bytes 8172 (7.9 KiB)

RX errors 0 dropped 34  overruns 0  frame 0

TX packets 30  bytes 5018 (4.9 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0 collisions 0

[root@MiWiFi-R3-srvDesktop]#

再次查看当前设置状态

[root@MiWiFi-R3-srvDesktop]# nmcli device status

DEVICE       TYPE      STATE         CONNECTION

mybond       bond      connected     mybond

eno16777736  ethernet  connected     eth0

eno33554992  ethernet  connected     eth1

bond0        bond      disconnected  --

lo           loopback  unmanaged     --

[root@MiWiFi-R3-srv ~]#

当前设备的链接信息   

[root@MiWiFi-R3-srvDesktop]# nmcli connection show

NAME    UUID                                  TYPE            DEVICE

eth0    4435f07a-4585-452e-85a5-c9a968d48bab  802-3-ethernet  eno16777736

eth1    48142a3f-a088-4e27-9d96-ccc586792980  802-3-ethernet  eno33554992

mybond  fcc6f5d4-5da6-499d-97e5-e7b5ba1cd2a0  bond            mybond

3.bonding模式

mode= value

balance-rr or 0

Sets a round-robin policy for faulttolerance and load balancing.Transmissions are received and sent outsequentially on each bonded slave interface beginning with the first oneavailable.

active-backup or 1

Sets an active-backup policyfor fault tolerance.Transmissions  arereceived and sent out via the first available bonded slave interface. Anotherbonded slave interface is only used if the active bonded slave interface fails.

balance-xo ror 2

Transmissions are based on the selected hashpolicy. The

default is to derive a hash by XOR ofthe source and destination MAC addresses   multipliedby the modulo of the number of slave interfaces. In this mode traffic destined for specific peers will always be sent over thesame interface. As the destination is determinedby the MAC addresses this method works best for traffic to peers on the same linkor local network. If traffic has to pass through a single router then this modeof traffic balancing will be suboptimal.

broadcast or 3

Sets a broadcast policy for fault tolerance.All transmissions are sent on all slave interfaces.

80 2.3ad or 4

Sets an IEEE 802.3ad dynamiclink aggregation policy. Creates aggregation groups that share the same speedand duplex settings. Transmits and receives on all slaves in the activeaggregator. Requires a switch that is 802.3ad compliant.

balance-tlb or5

Sets a Transmit Load Balancing (TLB) policyfor fault tolerance and load balancing. The outgoing traffic is distributed accordingto the current load on each slave interface. Incoming traffic is received bythe current slave. If the receiving slave fails, another slave takes over theMAC address of the failed slave. This mode is only suitable for local addressesknown to the kernel bonding module and therefore cannot be used behind a bridgewith virtual machines.

balance-alb or6

Sets an Adaptive Load Balancing (ALB) policyfor fault tolerance and load balancing. Includes transmit and receive loadbalancing for IP v4 traffic.Receive load balancing is achieved through AR Pnegotiation. This mode is only suitable for local addresses known to the kernelbonding module and therefore cannot be used behind a bridge with virtualmachines.

转载于:https://blog.51cto.com/369day/1885373

NIC Bonding on CentOS 7 with nmtui相关推荐

  1. NIC Teaming on CentOS 7 with nmtui

       NIC  Teaming on CentOS 7 with nmtui 在Linux,可以将多个网络链路聚合成一个逻辑链路,可以增加网络吞吐量或冗余.例如,我们可以将IP地址分配给由两个网络接口 ...

  2. Linux Kernel TCP/IP Stack — L1 Layer — NIC bonding

    目录 文章目录 目录 NIC bonding mode=0(balance-rr,RR 负载均衡策略) mode=1(active-backup,主备策略) mode=2(balance-xor,XO ...

  3. centos oracle 服务自动启动,CentOS下配置Oracle 11gR2为系统服务自动启动

    CentOS下配置Oracle 11gR2为系统服务自动启动 CentOS下配置Oracle 11gR2为系统服务自动启动 为什么80%的码农都做不了架构师?>>> PS:在Wind ...

  4. 嵌入式系统linux下bond,CentOS双网卡绑定bond0

    a)拷⻉并配置vim /etc/sysconfig/network-scripts/ifcfg-bond0配置⽂件(会自动创建文件) DEVICE=bond0 TYPE=Ethernet ONBOOT ...

  5. 18-Linux网络协议和管理

    网络协议和管理 计算机网络:指将地理位置不同的具有独立功能的多台计算机及其外部设备,通过通信线路连接起来,在网络操作系统,网络管理软件及网络通信协议的管理和协调下,实现资源共享和信息传递的计算机系统. ...

  6. 软硬件融合加速技术系列文章

    目录 文章目录 目录 计算机组成原理 异构计算 GPU FPGA SmartNIC/DPU Linux 操作系统原理 处理器 进程管理 内存管理 I/O 系统 文件系统 网络协议栈 资源管理 设备管理 ...

  7. Greenplum学习实践-【安装部署】-2、 5.10集群部署

    Greenplum学习实践-[安装部署]-2. 5.10集群部署 第 1 章** 环境说明 1.1 官方文档 Greenplum官方安装说明: https://gpdb.docs.pivotal.io ...

  8. openflow协议之meter表简单实现

    前言 Openflow1.3以及后续的版本增加了meter表,基于此结构,OpenFlow Switch可以实现各种简单的QoS功能,比如速率限制等,再结合每个端口的队列(queues),可以实现更加 ...

  9. 自己动手构建iSCSI磁盘阵列

    在理想情况下,无论是对于关键业务应用需求,还是对于诸如开发.测试.磁盘到磁盘备份以及灾难恢复等应用需求,当需要更多存储空间时,大家首先想到的就是去购买最新技术的企业级存储设备.但在很多现实的情况下,由 ...

最新文章

  1. hdu 3392 Pie
  2. Linux 查看和删除进程
  3. bzoj 2821:作诗 分块
  4. GPS 实景识别网络搭建项目(源码免费领取)
  5. 巫师3储物箱在哪_巫师三孤岩宝箱在哪 | 手游网游页游攻略大全
  6. Supporting hyperplane
  7. Windows使用Dism备份操作系统快捷命令 系统备份
  8. 盯盯拍CEO 罗勇现身云栖大会 畅谈车联网生态并发布全新产品mini3
  9. 算法专题训练(1)股票问题
  10. java gef_GEF开发入门要点(个人经验)
  11. 湿空气性质计算,随笔与学习记录(1.饱和水蒸气压力计算)
  12. 计组高分笔记:【04】指令系统 「指令格式与分类 | CISC、RISC | 直接寻址 | 间接寻址 | 寄存器寻址 | 隐式寻址 | 立即寻址| 基址寻址 | 变址寻址 | 相对寻址 | 堆栈寻址」
  13. 使用OpenMP reduction子句求解二维数组的最小值和输出所在下标
  14. 一张图片测试你的好色程度
  15. 最好用的ftp工具,8款超级好用的最好用的ftp工具
  16. 10的负次方的名称怎么称呼?
  17. 《新财富》500富人榜 参考
  18. 【Python从零开始】caffe2的安装过程(在win10+Python+VS2015的环境下,改成caffe2的安装)(2)
  19. apple tv 开发_现在是购买Apple TV的好时机吗?
  20. Zencart网站搭建与配置教程

热门文章

  1. 波士顿动力新视频:上岗工作机器狗,巡查工地一丝不苟
  2. 开源的“谷歌AutoML杀手”来了
  3. NASA无人机障碍赛:专业选手Vs.人工智能,赌一赌谁赢?
  4. 两日公开课:伯克利深度强化学习训练营 | 视频+PPT
  5. MySQL的basedir
  6. SOA相关资料整理分享
  7. 项目实战之服务端分页的实现——SQL
  8. 编译安装RRDtool报错
  9. 在QT中CXDVA视频组件的例子
  10. 3.0 Android组件之间的信使Intent