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!