Configure network bonding on RHEL (Red Hat Enterprise Linux)

来源:https://www.cnblogs.com/xuyaowen/archive/2018/07/12/network-bonding.html
-Advertisement-
Play Games

Question: Recently I have to use the RHEL and need to config the network with a few NICs. Here comes the question: What's the network bonding and How ...


Question:

      Recently I have to use the RHEL and need to config the network with a few NICs. Here comes the question: What's the network bonding and How to bond? So I write this post. 

What's network bonding?

      Network bonding is a method of combining (joining) two or more network interfaces together into a single interface. It will increase the network throughput, bandwidth and will give redundancy. If one interface is down or unplugged, the other one will keep the network traffic up and alive. Network bonding can be used in situations wherever you need redundancy, fault tolerance or load balancing networks.

Linux allows us to bond multiple network interfaces into single interface using a special kernel module named bonding. The Linux bonding driver provides a method for combining multiple network interfaces into a single logical “bonded” interface. The behaviour of the bonded interfaces depends upon the mode; generally speaking, modes provide either hot standby or load balancing services. Additionally, link integrity monitoring, may be performed.

Types of network Bonding

According the to the official documentation, here is the types of network bonding modes.

mode=0 (balance-rr)

Round-robin policy: It the default mode. It transmits packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.

mode=1 (active-backup)

Active-backup policy: In this mode, only one slave in the bond is active. The other one will become active, only when the active slave fails. The bond’s MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance.

mode=2 (balance-xor)

XOR policy: Transmit based on [(source MAC address XOR’d with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.

mode=3 (broadcast)

Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.

mode=4 (802.3ad)

IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.

 

Prerequisites:

– Ethtool support in the base drivers for retrieving the speed and duplex of each slave.
– A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require some type of configuration to enable 802.3ad mode.

mode=5 (balance-tlb)

Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.

Prerequisite:

– Ethtool support in the base drivers for retrieving the speed of each slave.

mode=6 (balance-alb)

Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.

 Setting up network Bonding on RHEL

 

Config the network bonding (mode 1 )

shutdown the nm (if you don't shoudown the nm, you can use nmcli con reload to make the nm reload the config file)

systemctl stop NetworkManager.service     
systemctl disable NetworkManager.service

check the mod

modprobe --first-time bonding
lsmod | grep bonding

create the bond0 interface file 

vim /etc/sysconfig/network-scripts/ifcfg-bond0
TYPE=Bond
BOOTPROTO=dhcp
NAME=bond0
DEVICE=bond0
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
#IPADDR=10.73.73.21
#PREFIX=24

fix the two files - ifcfg-eno1 ; ifcfg-eno2

[root@hp-dl320eg8-16 network-scripts]# cat ifcfg-eno1 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno1
UUID=fa3a6d8b-2000-4995-a6e4-c93cf3480ac1
DEVICE=eno1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@hp-dl320eg8-16 network-scripts]# cat ifcfg-eno2
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=xuyaowen
UUID=3624711a-f96d-40cb-9b06-0f10031c0895
DEVICE=eno2
ONBOOT=yes
MASTER=bond0
SLAVE=yes

restart the network

systemctl restart network

check the bond0 status

cat /proc/net/bonding/bond0
[root@hp-dl320eg8-16 network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eno1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eno1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 64:51:06:0d:fb:78
Slave queue ID: 0

Slave Interface: eno2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 64:51:06:0d:fb:79
Slave queue ID: 0

As you see in the above output, the bond0 interface is up and running and it is configured as active-backup(mode1) mode. In this mode, only one slave in the bond is active. The other one will become active, only when the active slave fails.

finished!

some command about net:

ifup ifcfg-bond0

ifdown ifcfg-bond0

to make the interface up/down

if the nm(network manager) is up:

use nmcli con reload to let the nm to know the changes.

ip addr show to show the addr

References:

  1. Linux Basics: Create Network Bonding On CentOS 7/6.5
  2. RHEL 7 Networking Guide
  3. 多網卡的7種bond模式原理
  4. linux下網卡bonding配置

保持更新,轉載請註明出處。 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 本文來源 https://blog.csdn.net/qq_20989105/article/details/76390367 ,轉載前請先聯繫原作者並聲明出處。 一、安裝gcc 1、Redis在linux上的安裝首先必須先安裝gcc,這個是用來編譯redis的源文件的。首先需要先切換的到root用 ...
  • 1) 目錄結構說明: windows:磁碟 分區 格式化--系統 linux:磁碟--分區--生成一個文件(磁碟分區) linux 中一切皆文件 ll -h 顯示人類能看懂的 mount -o remount,rw / 安裝tree yum install tree -y 查看一級根 tree -L ...
  • 說明: 本次ELK的基礎配置如下: 虛擬機:vmware 11 系統:centos7.2 兩台 IP:172.16.1.15/16 一、下載es wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/dist ...
  • 第一步先創建一個免費的證書 步驟一:申請免費證書 步驟二:填寫你的二級域 步驟三:等待審核通過,通過後,點擊下載 步驟四:根據自己伺服器類型,下載對應的證書,根據阿裡雲的安裝步驟做 以下是阿裡雲提供的iis7/8安裝步驟 • 開始 -〉運行 -〉MMC; • 啟動控制台程式,選擇菜單“文件"中的"添 ...
  • 一: FTP Centos7中預設已經安裝了sshd服務(sftp), vsftpd需要手動安裝 1、安裝並啟動FTP服務 1.1 安裝vsftpd 使用 yum 安裝 vsftpd yum install -y vsftpd 1.2 啟動vsftpd 安裝完成後, 啟動vsftpd服務 : ser ...
  • CMD命令 cmd是command的縮寫.即命令提示符(CMD),是在OS / 2 , Windows CE與Windows NT平臺為基礎的操作系統(包括Windows 2000和XP中, Vista中,和Server 2003 )下的“MS-DOS 方式”。中文版Windows XP 中的命令提 ...
  • 架構 前端展示 索引搜索 日誌緩存 Elastash redis Waiting for set levelDesc [ERROR] [2018 06 30 17:41:56][com.iba.boss.pubsub.listener.core.ListenerTemplate]BmcLevelDe ...
  • 第15章 FreeRTOS操作系統版本二代示波器實現 本章教程為大家講解FreeRTOS操作系統版本的二代示波器實現。主要講解RTOS設計框架,即各個任務實現的功能,任務間的通信方案選擇,任務棧,系統棧以及全局變數共用問題。同時,工程調試方法也專門做了說明。 15.1 註意事項(重要必讀) 15.2 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...