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

What is the binding configuration of Linux bond Nic?

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

In this issue, the editor will bring you about what the Linux bond network card binding configuration is like. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

1. Create a bond network card file

Create an ifcfg-bond0 under the / etc/sysconfig/network-scripts/ directory

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

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

two。 Configure the network card to be bound

Write bond0 eth2 eth3

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

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

BONDING_OPTS= "mode=1 miimon=100 primary=eth2"

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 fails, it will be transferred to another line.

There are seven modes of Bonding:

# defineBOND_MODE_ROUNDROBIN 0 (balance-rr mode) load balancing 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 Transport load balancing Mode

# defineBOND_MODE_ALB 6 Network Card Virtualization

4. Modify rc.local (this can be ignored, not needed)

Vi / etc/rc.d/rc.local

Add: ifenslave bond0 eth0 eth2

5. It is the network card that takes effect.

Use the command: service network restart

Or execute reboot directly (this command is generally not recommended in a production environment, but in test execution, general problems can be solved. Oh, I like to restart with reboot)

The above is what the binding configuration of the Linux bond Nic shared by the editor is like. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow 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