Bind a Centos dual-nic bonding to achieve Load Balancing

Source: Internet
Author: User

To improve the high availability of the system, we can bind two or more NICs to a virtual Nic and use the same IP address to ensure that a link is disconnected, another link can be started at any time to improve system stability.

Enable dual NICs in virtual machines

Finish

When the dual Nic is working, it is represented as a virtual NIC (bond0). The virtual NIC also needs a driver named bonding.

Check whether the kernel supports dual-nic binding

Vim/boot/config-2.6.18-164.e15

This network mode is supported, and BOUNDING is a built-in module.

Enter

After the network card is bound to a uniform ip address, you do not need to set the ip address for eth0 and eth1.

Vim ifcfg-eth0.

Vim ifcfg-eth1.

Generate additional Nic file ifcfg-bond0

Cp ifcfg-eth0 ifcfg-bond0

(Address required for the virtual Nic bond0)

Vim ifcfg-bond0.

Vim/etc/modprobe. conf (to enable the system to load the bonding module)

Add

(Bond0 link monitoring with a latency of 100 milliseconds. mode = 1 indicates the active/standby mode)

Vim/etc/rc. d/rc. local (in the boot script, specify that bond0 is bound to the eth0 and eth1 NICS)

Init 6 restart the system

Dmesg | grep bond0 (view information about the active/standby mode)

Or cat/proc/net/bonding/bond0

Monitoring once every second

Wtach-n 1 'cat/proc/net/bonding/bond'

When eth0 is down, the backup link eth1 is automatically started.

When eth1 is down, eth0 starts

This article is from the "HWOTT" blog, please be sure to keep this source http://iceblock.blog.51cto.com/6758400/1167681


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.