How to configure multiple network cards in redhat linux 6 version of bonding

  

In the era of Internet, the high availability of the network has always been a very critical part, network failures directly lead to the interruption of application services, and the development of IT technology In terms of trends, in addition to high availability, the network will have higher and higher requirements for high performance. In order to provide high availability or high performance of the network, we may need to bundle multiple NICs into one virtual NIC to provide external services, so that higher bandwidth can be obtained, and even if one physical NIC fails, it will not cause The connection is broken. The word multi-network card binding has different names on different platforms. It is called bonding under Linux. Let's look at how to configure bonding.

Two Prerequisites

This article uses RHEL 6 as an example. The configuration of other versions of OS
is basically the same. The difference is the configuration file. I will not repeat them here. If necessary, according to this article, it should be a problem. Linux network card binding is generally double network card, more than two network card binding is the same step, this article describes the configuration of four network cards.

Three steps

3.1 Confirm that the NIC device is eth1-4


3.2 Edit the NIC configuration file ifcfg-eth* as follows: Br>

[root@dddhost Desktop]# cat /etc/sysconfig/network-scripts/ifcfg-eth1DEVICE=eth1ONBOOT=yesBOOTPROTO=noneMASTER=bond0SLAVE=yesUSERCTL=noEdit 4 NICs in turn, where DEVICE is the device name (eth1) -4), MASTER is the bond network card name (bond0).

3.3 Create a bond NIC configuration file ifcfg-bond0 in the folder /etc/sysconfig/network-scripts/:

[root@dddhost Desktop]# vi /etc/sysconfig/network- Scripts/ifcfg-bond0DEVICE=bond0USERCTL=noONBOOT=yesBOOTPROTO=staticIPADDR=10.2.1.123NETMASK=255.255.255.0GATEWAY=10.2.1.1BONDING_OPTS="miimon=80 mode=1"Set IP, subnet mask, gateway and other parameters, And the mode of network card binding, where BONDING_OPTS option:

  • miimon is used for link monitoring. For example: miimon=100, then the system monitors the link connection status every 100ms;
  • mode=1 indicates that the fault-tolerance (active-backup) provides redundancy, and the working mode is the active/standby mode. That is to say, by default, only one network card works, and another backup; mode=0 indicates that load balancing (round-robin) is load balancing mode, and multiple network cards work. There are a total of seven bond modes (0-6), and the above modes 0 and 1 are the most commonly used.

    3.4 Create bonding.conf in the folder /etc/modprobe.d and write the following:

    [root@dddhost Desktop]# cat /etc/modprobe. d/bonding.confalias bond0 bonding

    3.5 At this point, the configuration of the NIC binding has been completed. It should be noted that the NetworkManager in the Linux system will affect the bond NIC. Therefore, you need to disable the service and execute the following command:

    [root@dddhost Desktop]# service NetworkManager stopStopping NetworkManager daemon: [ OK ][root@dddhost Desktop]# chkconfig NetworkManager off

    3.6 Restart the network for all configurations to take effect

    [root@dddhost Desktop]# service network restartShutting down interface bond0: [ OK ]Shutting down loopback interface: [ OK ]Bringing up loopback interface: [ OK ]Bringing up interface bond0: [ OK ]

    3.7 Check the status of the bond NIC

  • ifconfig -a, you can see the IP configuration on the bond NIC


    cat /proc/net/bonding/bond0, you can see the status of each NIC, such as using the active/standby mode (and mode=1), you can see the currently active NIC


    3.8Test

    From the output above, you can see that the activated network card is eth1. In order to test whether the network card binding is successful, we find another computer to ping bond0. IP, then disable eth1 and observe network connectivity. The test is completed and the network card binding works normally.

  • Copyright © Windows knowledge All Rights Reserved