How to bind multiple network cards to one under Linux?

  
                

In Linux systems, multiple network cards are usually bundled into one logical network card, which can improve the stability of the network. How to bind multiple networks to one? The following small series will introduce you to the bond mode principle of multi-NIC binding under Linux.

Linux plurality of network ports as a binding, can improve network performance, such as for the backup server, the data to be backed up in a night several T, if a single Gigabit Ethernet port It will be a very serious bottleneck. Other applications, such as ftp servers and high-load download sites, have similar problems. Therefore, using Linux teaming or bond to bind multiple network cards as a logical network port and configuring a single IP address will greatly improve the network throughput (I/O) of the server.

Linux's multi-NIC binding function uses the "bonding" module in the kernel. For this module, you can refer to the Linux Ethernet Bonding Driver documentation. However, the Linux kernel has been released for each module. In most cases you do not need to recompile the kernel. Linux's bonding driver provides the ability to bind/bond multiple network cards into a single virtual logical network port. Please note that the bonded network port has multiple modes of operation; in general, it is divided into hot standby and load balancing. It is easier to configure in Redhat/Fedora and other Redhat Linux classes.

1.Create bond0 configuration file

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

DEVICE=bond0 -- physical device name

IPADDR=192.168.1.2 --IP address

NETMASK=255.255.255.0 --Subnet mask

GATEWAY=192.168.1.1 -- Gateway

DNS=8.8 .8.8 --DNS

ONBOOT=yes -- Random Start

NAME=bond0

BOOTPROTO=none

USERCTL=no -- Whether to allow non The root user controls the device

2. Modify the configuration file of the bound eth0 and eth1

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

DEVICE =“eth0”

USERCTL=no

ONBOOT=yes

MASTER=bond0

SLAVE=yes

BOOTPROTO=none

HWADDR=00:15:17:CC:FC:35

The configuration file of eth1 is the same, except that the value of device is changed to eth1.

3. Install the bond module driver

Edit the /etc/modprobe.conf or /etc/modules.conf file and add the following to load the bonding module driver when the system starts.

alias bond0 bonding

option bond0 miimon=100 mode=1

Description:

1).miimon=100 Used for link monitoring. That is, the link status is monitored every 100 ms. Bonding only monitors the link between the host and the switch. If the link going out of the switch has a problem and there is no problem in itself, then Bonding believes that the link continues to be used without problems.

2).mode=1 means to provide redundancy. In addition to this, it can be 0, 2, 3, a total of four modes. 0 means load balancing

4. Add the following statement to the /etc/rc.d/rc.local file to make the system start automatic operation

ifenslave bond0 eth0 eth1

Route add -net 192.168.1.254 netmask 255.255.255.0 bond0 #Add the route if necessary

5. Detect and verify the configuration

First execute the command to load the bonding module: modprobe bonding

Restart the network service and confirm that bond0 starts correctly: service network restart

Confirm that the device has been loaded correctly: less /proc/net/bonding/bond0

List all network ports: ifconfig

The above is the introduction of the principle of multi-NIC binding bond mode under Linux. There are generally 7 kinds of bond mode. Here only one of them is introduced, I hope to help you.

Copyright © Windows knowledge All Rights Reserved