Bind dual NICs in linux

Source: Internet
Author: User

Detailed explanation of RHEL5 dual Nic binding settings


Most servers on the market are equipped with 2-4 network ports. Generally, only one of them is used. To make full use of resources and prevent Nic faults,

We recommend that you use the bonding technology. Pay attention to the configuration of the two Network Ports corresponding to the vswitch in the real environment!


1. Edit the virtual network interface configuration file and specify the NIC Information

[root@crushlinux ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0DEVICE=bond0BOOTPROTO=none      BONBOOT=yesIPADDR=192.168.1.254NETMASK=255.255.255.0GATEWAY=192.168.1.1NETWORK=192.168.1.0USERCTL=no


2. Configure the real Nic eth0 and eth1

[root@crushlinux ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0BOOTPROTO=noneONBOOT=yesMASTER=bond0SLAVE=yesUSERCTL=yes[root@crushlinux ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1DEVICE=eth1BOOTPROTO=noneONBOOT=yesMASTER=bond0SLAVE=yesUSERCTL=yes

3. Load the module so that the system supports bonding

[root@crushlinux ~]# mv /etc/modprobe.conf /etc/modprobe.conf.bak[root@crushlinux ~]# vi /etc/modprobe.confalias eth0 bnx2alias eth1 bnx2alias scsi_hostadapter aacraidalias scsi_hostadapter1 ata_piixalias bond0 bondingoptions bond0 miimon=100 mode=1 primary=eth0

Note:

Mode specifies the working mode of bond0. Commonly Used values: 0 and 1. 0 indicate the load balancing mode, and 1 indicate the active/standby mode.

Mode = 0 indicates that the load balancing (round-robin) method is load balancing, and both NICs work.

Mode = 1 indicates that fault-tolerance (active-backup) provides redundancy, working in the master-slave mode. By default, one network card works, and the other is backed up.


Bonding only provides link monitoring to check whether the link from the host to the vswitch is connected. If the switch's external link is down,

The switch itself is not faulty, so bonding will think the link is okay and continue to use it.


Miimon is used for link monitoring.

For example: miimon = 100, The system monitors the link connection status every Ms. If one line fails, it is transferred to another line.


4. Add boot script

[Root @ crushlinux ~] # Add ifenslave bond0 eth0 eth1 to the last line of vi/etc/rc. d/rc. local


5. Restart the network service

[root@crushlinux ~]# service network restart


Vi. Test

Run the ping command on another machine.

[Root @ berg ~] # Ifconfig eth0 192.168.1.253

[Root @ berg ~] # Ping 192.168.1.254

If different to the ifcfg-bond0 for troubleshooting, if ping can test the dual network card binding, unplug a network cable, or is correct.

You can unplug all the two network adapters for testing. Wait 10 ~ 30 seconds. ping continues.


This article is from the "Crushlinux Studio" blog!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.