[LINUX] [CentOS 7.3] I tried bonding (active-backup) with two network interfaces.

Introduction

I tried to build bonding with two network interfaces on CentOS 7.3. I would like to output the procedure until bonding is assembled.

What is bonding in the first place?

Bundle multiple network interfaces to make them redundant and improve processing capacity.

environment

item Description
Hypervisor ESXi6.7
OS CentOS7.3
NIC 2 sheets
[root@tspweb01 ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@tspweb01 ~]#

nic.JPG

Rough composition

bonding.JPG

Remarks

Active-backup configuration to be configured this time

active.JPG

Construction procedure

Prior confirmation

** ① Network check **

--Network interface

Confirm that ʻens192 and ʻens224 are down.

[root@tspweb01 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
3: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:0c:29:ee:2e:c4 brd ff:ff:ff:ff:ff:ff

--NetworkManager status

Confirm that the service is up

[root@tspweb01 network-scripts]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running)since fire 2020-06-16 20:11:06 JST; 17min ago
     Docs: man:NetworkManager(8)
 Main PID: 782 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           mq782 /usr/sbin/NetworkManager --no-daemon

June 16 20:26:28 tspweb01 NetworkManager[782]: <info>  [1592306788.2383] ma...L
June 16 20:26:28 tspweb01 NetworkManager[782]: <info>  [1592306788.2384] po...S
June 16 20:26:28 tspweb01 NetworkManager[782]: <info>  [1592306788.2386] po...S
June 16 20:26:33 tspweb01 NetworkManager[782]: <info>  [1592306793.2854] de...]
June 16 20:26:33 tspweb01 NetworkManager[782]: <info>  [1592306793.2855] ma...L
June 16 20:26:33 tspweb01 NetworkManager[782]: <info>  [1592306793.2885] au..."
June 16 20:26:33 tspweb01 NetworkManager[782]: <info>  [1592306793.2890] de...]
June 16 20:26:33 tspweb01 NetworkManager[782]: <info>  [1592306793.2900] ma...L
June 16 20:26:33 tspweb01 NetworkManager[782]: <info>  [1592306793.2901] po...S
June 16 20:26:33 tspweb01 NetworkManager[782]: <info>  [1592306793.2902] po...S
Hint: Some lines were ellipsized, use -l to show in full.
[root@tspweb01 network-scripts]#

** ② Network setting file backup **

--ʻIfcfg-* `backup

mkdir -p /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`
cp -p /etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`/.
ls -la /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`

Execution example

[root@tspweb01 network-scripts]# mkdir -p /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`
[root@tspweb01 network-scripts]# cp -pi /etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`/.
[root@tspweb01 network-scripts]#
[root@tspweb01 network-scripts]# ls -la /etc/sysconfig/network-scripts/backup_`date +'%Y%m%d'`
20 in total
drwxr-xr-x.2 root root 82 June 16 21:00 .
drwxr-xr-x.3 root root 4096 June 16 20:59 ..
-rw-r--r--.1 root root 153 June 16 20:25 ifcfg-ens192
-rw-r--r--.1 root root 153 June 12 07:54 ifcfg-ens224
-rw-r--r--.1 root root 254 September 12 2016 ifcfg-lo
[root@tspweb01 network-scripts]#

** ③ bonding.conf backup **

--Check for the existence of bonding.conf

Make sure that bonding.conf does not exist.

[root@tspweb01 network-scripts]# ls -l /etc/modprobe.d/bonding.conf;date
ls: /etc/modprobe.d/bonding.Unable to access conf:There is no such file or directory
Tuesday, June 16, 2020 20:30:30 JST
[root@tspweb01 network-scripts]#
cp -p /etc/modprobe.d/bonding.conf /etc/modprobe.d/bonding.conf_`date +'%Y%m%d'`
ls -la /etc/modprobe.d/bonding.conf_`date +'%Y%m%d'`

Setup steps

** ① Create and check bonding.conf **

--Create bonding.conf

vi /etc/modprobe.d/bonding.conf

Settings

alias bond0 bonding

After setting, save with wq!.

--bonding.conf Check the contents

It must be the set content.

[root@tspweb01 modprobe.d]# cat /etc/modprobe.d/bonding.conf
alias bond0 bonding
[root@tspweb01 modprobe.d]#

** ② NIC setting **

vi /etc/sysconfig/network-scripts/ifcfg-ens192

Contents

TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens192
HWADDR=00:0c:29:ee:2e:ba
DEVICE=ens192
ONBOOT=yes
MASTER=bond0
SLAVE=yes
vi /etc/sysconfig/network-scripts/ifcfg-ens224

Contents

TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens224
HWADDR=00:0c:29:ee:2e:c4
DEVICE=ens224
ONBOOT=yes
MASTER=bond0
SLAVE=yes

** [Explanation of settings] **

item Description
TYPE type
BOOTPROTO When using DHCP"dhcp", If you want to set it statically"static"Or"none"
IPV6INIT Whether IPv6 setting is implemented
NAME NIC name
HWADDR MAC address of NIC
DEVICE NIC device name
ONBOOT Whether to boot the NIC when the OS boots
MASTER Logical interface name to set(This timebond0)
SLAVE Whether to use as SLAVE

** ③ NIC setting check **

[root@tspweb01 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-ens192
TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens192
HWADDR=00:0c:29:ee:2e:ba
DEVICE=ens192
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@tspweb01 network-scripts]#
[root@tspweb01 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-ens224
TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens224
HWADDR=00:0c:29:ee:2e:c4
DEVICE=ens224
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@tspweb01 network-scripts]#

** ④ bonding setting **

vi /etc/sysconfig/network-scripts/ifcfg-bond0

Contents

BOOTPROTO=none
DEVICE=bond0
TYPE=Bond
ONBOOT=yes
IPADDR=192.168.0.41
PREFIX=24
GATEWAY=192.168.0.1
BONDING_OPTS="mode=1 miimon=100 primary=ens192 primary_reselect=1"

** [BONDING_OPTS description] **

BONDING_OPTS="mode=1 miimon=100"

item Set value Description
mode 1 Active-backup mode
miimon 100 0.Check the Bonding status at 1-second intervals(1000msec =1 second)

** ⑤ Bonding setting confirmation **

[root@tspweb01 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
BOOTPROTO=none
DEVICE=bond0
TYPE=Bond
ONBOOT=yes
IPADDR=192.168.0.41
PREFIX=24
GATEWAY=192.168.0.1
BONDING_OPTS="mode=1 miimon=100 primary=ens192 primary_reselect=1"
[root@tspweb01 network-scripts]#

** ⑥ network service restart **

systemctl restart network

Confirm after setting

** ① Check IP information **

Confirm that bond0 exists.

[root@tspweb01 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000
    link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
3: ens224: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000
    link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
4: ens256: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:0c:29:ee:2e:ce brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.45/24 brd 192.168.0.255 scope global ens256
       valid_lft forever preferred_lft forever
    inet6 2404:7a80:91a1:4d00:20c:29ff:feee:2ece/64 scope global tentative mngtmpaddr dynamic
       valid_lft 2592000sec preferred_lft 604800sec
    inet6 fe80::20c:29ff:feee:2ece/64 scope link tentative
       valid_lft forever preferred_lft forever
7: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.41/24 brd 192.168.0.255 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 2404:7a80:91a1:4d00:20c:29ff:feee:2eba/64 scope global tentative mngtmpaddr dynamic
       valid_lft 2592000sec preferred_lft 604800sec
    inet6 fe80::20c:29ff:feee:2eba/64 scope link
       valid_lft forever preferred_lft forever
[root@tspweb01 network-scripts]#

** ② Bonding status check **

Bonding is made up of ʻens192 and ʻens224.

[root@tspweb01 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: ens192 (primary_reselect better)
Currently Active Slave: ens192
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: ens192
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:ee:2e:ba
Slave queue ID: 0

Slave Interface: ens224
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:ee:2e:c4
Slave queue ID: 0
[root@tspweb01 network-scripts]#

** ③ SSH confirmation at TeraTerm **

What you can ssh.

ssh.JPG

Try dropping ʻens192 (active) `

Diagram

standby.JPG

procedure

① Drop ʻens192`

[root@tspweb01 ~]# ifdown ens192
device'ens192'Was successfully disconnected.
[root@tspweb01 ~]#

③ Confirm that it has been switched to ʻens224`

[root@tspweb01 ~]# 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: ens224
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: ens224
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:ee:2e:c4
Slave queue ID: 0
[root@tspweb01 ~]#

reference

What is bonding [What is Bonding? --IT Glossary e-Words](http://e-words.jp/w/%E3%83%9C%E3%83%B3%E3%83%87%E3%82%A3% E3% 83% B3% E3% 82% B0.html) [Linux (CentOS8 / RHEL8) Bonding mode and setting confirmation method, combination with Switch Link Aggregation setting](https://milestone-of-se.nesuke.com/nw-basic/link-aggregation/linux- bonding-and-switch-config /) Bonding on CentOS 7

Recommended Posts

[CentOS 7.3] I tried bonding (active-backup) with two network interfaces.
I tried fp-growth with python
I tried scraping with Python
I tried Learning-to-Rank with Elasticsearch!
I tried clustering with PyCaret
I tried gRPC with Python
I tried scraping with python
I tried trimming efficiently with OpenCV
I tried summarizing sentences with summpy
I tried web scraping with python.
I tried moving food with SinGAN
I tried implementing DeepPose with PyTorch
I tried face detection with MTCNN
I tried running prolog with python 3.8.2.
I tried SMTP communication with Python
I tried sentence generation with GPT-2
I tried learning LightGBM with Yellowbrick
I tried face recognition with OpenCV
I tried Linux (CentOS 7) life and death monitoring (Ping) with monitoring server Zabbix
I tried to control the network bandwidth and delay with the tc command
I tried multiple regression analysis with polynomial regression
I tried sending an SMS with Twilio
I tried using Amazon SQS with django-celery
I tried to implement Autoencoder with TensorFlow
I tried to visualize AutoEncoder with TensorFlow
I tried to get started with Hy
I tried scraping Yahoo News with Python
I tried using Selenium with Headless chrome
I tried factor analysis with Titanic data!
I tried learning with Kaggle's Titanic (kaggle②)
I tried sending an email with python.
I tried non-photorealistic rendering with Python + opencv
I tried a functional language with Python
I tried recursion with Python ② (Fibonacci sequence)
I tried implementing DeepPose with PyTorch PartⅡ
I tried playing with the image with Pillow
I tried to solve TSP with QAOA
I tried simple image recognition with Jupyter
I tried CNN fine tuning with Resnet
I tried natural language processing with transformers.
#I tried something like Vlookup with Python # 2
I tried to make a periodical process with CentOS7, Selenium, Python and Chrome
I tried handwriting recognition of runes with scikit-learn
I tried to predict next year with AI
I tried "smoothing" the image with Python + OpenCV
I tried to detect Mario with pytorch + yolov3
I tried to implement reading Dataset with PyTorch
I tried to use lightGBM, xgboost with Boruta
I tried to learn logical operations with TF Learn
I tried to move GAN (mnist) with keras
I tried "differentiating" the image with Python + OpenCV
I tried image recognition of CIFAR-10 with Keras-Image recognition-
I tried "License OCR" with Google Vision API
I tried to save the data with discord
I tried to detect motion quickly with OpenCV
I tried to integrate with Keras in TFv1.1
I tried non-negative matrix factorization (NMF) with TensorFlow
I tried L-Chika with Raspberry Pi 4 (Python edition)
I tried Python-like loop processing with BigQuery Scripting
I tried playing with PartiQL and MongoDB connected
I tried principal component analysis with Titanic data!