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 bind and configure bond Network Card in Linux

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces how to bind and configure bond network cards in Linux. The article is very detailed and has certain reference value. Interested friends must read it!

It can be configured successfully with one command. I configured it on vm8.0 virtual machine.

1. Create bond network card file

Create ifcfg-bond0 in/etc/sysconfig/network-scripts/directory

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

Or copy the physical NIC: cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-bond0

2. Configure the NIC to bind

Write bond0 eth2 eth3

Use the command vi /etc/sysconfig/network-scripts/ifcfg-bond0 (ifcfg-bond 0 is the name of the network card, if you want to write other network cards, you can modify the name)

The final results are as follows:

The code is as follows:

#cat ifcfg-bond0

DEVICE=bond0

ONBOOT=yes

IPADDR=10.128.1.11

NETMASK=255.255.255.0

GATEWAY=10.128.1.11

USERCTL=no

The configuration of the two network cards to be bound here is the same

The code is as follows:

#cat ifcfg-eth2

DEVICE=eth2

ONBOOT=yes

MASTER=bond0

bootproto=none

#cat ifcfg-eth3

DEVICE=eth3

ONBOOT=yes

MASTER=bond0

bootproto=none

3. Modify modprobe.conf

vi /etc/modprobe.conf

Add:

alias bond0 bonding

options hond miimon=100 mode=1

#miimon is used for link monitoring. For example:miimon=100, then the system monitors the connection status every 100ms, and if one line is blocked, it will switch to another line;

There are seven Bonding modes:

#defineBOND_MODE_ROUNDROBIN 0 (balance-rr mode) Load Balancer mode of NIC

#defineBOND_MODE_ACTIVEBACKUP 1 (active-backup mode) Fault-tolerant mode of NIC

#defineBOND_MODE_XOR 2 (balance-xor mode) requires switch support

#defineBOND_MODE_BROADCAST 3 (broadcast mode)

#defineBOND_MODE_8023AD 4 (IEEE 802.3ad Dynamic Link Aggregation Mode) requires switch support

#defineBOND_MODE_TLB 5 Adaptive Transfer Load Balancer Mode

#defineBOND_MODE_ALB 6 Network card virtualization mode

4. Modify rc.local

vi /etc/rc.d/rc.local

Add: ifenslave bond0 eth0 eth2

5. Yes. Network card in effect.

Command: Service network restart

Or directly execute reboot (this command is generally not recommended in production environments, but it can be executed in tests, and general problems can be solved. I love to reboot.

The above is "How to bind and configure bond network card in Linux" All the contents of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

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