Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure NIC binding in CentOS7

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to configure NIC binding in CentOS7. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

NIC (Network Interface Card) binding is also known as network binding. It can be defined as an aggregation or combination of multiple NIC to single-key interfaces. Its main purpose is to provide high availability and redundancy.

Experimental environment: DELL CentOS 7

Dual network card: em1/em2

# View the name of the Nic

Ip link | awk 'NR%2==1' | awk' {print $2 awk'{print $1}'| tr-d':'| grep-v lo |

precondition

Verify that the bonding module has been loaded into the linux environment, using the following command:

Modprobe bonding

List the bound module information

Modinfo bonding

Step 1: create a binding interface file

Create a binding interface file (ifcfg-bond0) under the folder "/ etc/sysconfig/network-scripts/"

[root@kvm-centos7 ~] # cd / etc/sysconfig/network-scripts/

[root@kvm-centos7 network-scripts] # cat ifcfg-bond0

DEVICE=bond0

TYPE=Bond

NAME=bond0

BONDING_MASTER=yes

BOOTPROTO=none

ONBOOT=yes

IPADDR=192.168.1.133

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

BONDING_OPTS= "mode=5 miimon=100" uses' mode=5'to provide fault tolerance and load balancing

Step 2: edit the NIC interface file (ifcfg-em1,ifcfg-em2)

[root@kvm-centos7 network-scripts] # clear

[root@kvm-centos7 network-scripts] # cat ifcfg-em1

TYPE=Ethernet

BOOTPROTO=none

UUID=f6f140af-1885-47d6-b22f-51e232d966e9

DEVICE=em1

ONBOOT=yes

MASTER=bond0

SLAVE=yes

[root@kvm-centos7 network-scripts] # cat ifcfg-em2

UUID=fe4606d1-23b8-48c7-a7e0-c858978ba4a9

DEVICE=em2

ONBOOT=yes

TYPE=Ethernet

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

Step 3: restart the network service

Systemctl restart network.service

Step 4: test and verify the bond interface

Check the status of the network card using ipconfig

View binding interface settings, such as binding mode and slave interface

Cat / proc/net/bonding/bond0

Step 5: fault tolerance testing

Test fault tolerance, stop a network card to see if you can access the server and interface status

Ifdown em1 # deactivation

Ifconfig checked the network status and found that the network status was normal.

This is the end of the article on "how to configure NIC binding in CentOS7". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report