Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux about host server dual network card bond configuration

Shulou Source: shulou.com Published: 2022-06-03 02:10:21 10月03日 Update

In the actual implementation of the project, a host has two network cards to achieve double connection. At this time, it is necessary to configure the two network cards of the host with bond, which is virtualized as a network card and works in an active and standby way to ensure the high availability of the system.

I. configuration requirements of bond

The two network card chips bound must be of the same model and have independent BIOS chips.

Second, the configuration process of bond

Take the bond configuration of eth0 and eth2 network cards as an example to explain the operation steps. The following operations are done under the root user.

1. Create a virtual network interface profile / etc/sysconfig/network-scripts/ifcfg-bond0 with the following contents:

DEVICE=bond0

BOOTPROTO=none

TYPE=Ethernet

ONBOOT=yes

IPADDR=192.168.31.100

NETMASK=255.255.255.0

GATEWAY=192.168.31.1

Note: the red part is the system IP address and gateway address, which needs to be modified according to the actual deployment.

two。 Edit the ifcfg-eth0 network card configuration file

Execute the command vi / etc/sysconfig/network-scripts/ifcfg-eth0, and modify the configuration file of the eth0 Nic in the following format:

DEVICE=eth0

USERCTL=no

ONBOOT=yes

MASTER=bond0

SLAVE=yes

BOOTPROTO=none

3. Edit the ifcfg-eth2 network card configuration file

Execute the command vi / etc/sysconfig/network-scripts/ifcfg-eth2, and modify the configuration file of the eth2 Nic in the following format:

DEVICE=eth2

USERCTL=no

ONBOOT=yes

MASTER=bond0

SLAVE=yes

BOOTPROTO=none

4. Modify configuration file / etc/modprobe.conf

Add the following to the configuration file:

Installbond0 / sbin/modprobe-an eth0 eth2 & & / sbin/modprobe bonding

Optionsbonding mode=1 miimon=100

5. Modify configuration file / etc/rc.d/rc.local

Add the following to the configuration file:

Ifenslavebond0 eth0 eth2

6. Execute the / etc/init.d/network restart command to restart the network for the configuration to take effect

7. Check whether the configuration is successful

Log in to the system as a root user and execute the command ifconfig to check whether there is a bond0 network card in the network card information, whether the eth0 and eth2 status are normal, and whether eth0, eth2 and bond0 use the same ip address.

Summary: after the dual network card is bound, be sure to check whether the switch connected by the dual network card has made aggregation. If the aggregation is not done, it will not be successful.

Tags: Configuration network card file content command address system host success actual format user network chip check same switch information model project Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL OPPO Reno Huawei vpn Apple