Dual-nic binding technology in Linux for load balancing and Failure Protection

Source: Internet
Author: User
The linux Nic bond uses the 0 mode. Theoretically, the transmission speed will be doubled. Actually, it is not necessarily better than a single Nic. Maintaining the high availability of servers is an important factor in the enterprise IT environment. The most important thing is the high availability of server network connections. NIC binding helps ensure high availability and provide other advantages to improve network performance. We will introduce how to bind two NICs in Linux to a virtual network card using two NICs. The aggregated device looks like

The linux Nic bond uses the 0 mode. Theoretically, the transmission speed is doubled. Actually, it is not necessarily better than a single Nic.

Maintaining the high availability of servers is an important factor in the enterprise IT environment. The most important thing is the high availability of server network connections. NIC binding helps ensure high availability and provide other advantages to improve network performance.

We will introduce how to bind two NICs in Linux to a virtual network card. The aggregated device looks like a separate Ethernet interface device, in general, two NICs have the same IP address, and parallel links are aggregated into a logical link. In fact, this technology already exists in Sun and Cisco, known as Trunking and Etherchannel technology. It is also used in Linux 2.4.x kernel, known as bonding. The earliest application of bonding technology was on the cluster beowulf, designed to improve data transmission between cluster nodes. Next we will discuss the principles of bonding. What is bonding? It should start with the promisc mode of the NIC. We know that, under normal circumstances, the network adapter only receives the target hardware Address (MAC Address) as its own Mac Ethernet frame, and filters out all other data frames to reduce the burden on the driver. However, the NIC also supports another mode called hybrid promisc, which can receive all frames on the network. For example, tcpdump runs in this mode. Bonding also runs in this mode, and modifies the mac address in the driver, changing the Mac address of the two NICs to the same, can receive data frames of a specific mac. Then, the data frame is sent to the bond driver for processing.

After talking about the theory for half a day, the configuration is actually very simple. There are four steps in total:

The operating system of the experiment is CentOS 5.4 5.2 5.3.
Prerequisites: the chipset model is the same, and the NIC should have its own independent BIOS chip.

Topology of dual Nic bonding (SEE)

1. Edit the virtual network interface configuration file and specify the nic ip Address
Vi/etc/sysconfig/network-scripts/ifcfg-bond0
[Root@www.linuxidc.com root] # cp/etc/sysconfig/network-scripts/ifcfg-eth0 ifcfg-bond0
2 # vi ifcfg-bond0
Change the first line to DEVICE = bond0
# Cat ifcfg-bond0
DEVICE = bond0
BOOTPROTO = none
IPADDR = 172.31.0.13
NETMASK = 255.255.252.0
BROADCAST = 172.31.3.254
ONBOOT = yes
TYPE = Ethernet
Do not specify the IP address, subnet mask, or Nic ID of a single Nic. Specify the above information to the virtual adapter (bonding.
[Root@www.linuxidc.com network-scripts] # cat ifcfg-eth0
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = none

MASTER = bond0

SLAVE = yes

[Root@www.linuxidc.com network-scripts] # cat ifcfg-eth1
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = none
MASTER = bond0
SLAVE = yes

Related Article

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.