Linux platform Dual-NIC binding technology for load balancing (NIC aggregation) bonding

Source: Internet
Author: User

Linux load balancing based on two-NIC binding technology for Platform

Maintaining high availability of servers is an important factor in an enterprise-wide IT environment. One of the most important is the high availability of server network connections. Network interface card (NIC) binding technology helps ensure high availability features and provides additional benefits to improve networking performance. The two-Nic binding implementation is the use of two network card virtual become a network card, the aggregation of the device appears to be a separate Ethernet interface device, the popular point is that two network cards have the same IP address and parallel link aggregation into a logical link work. In fact, this technology has long existed in sun and Cisco, known as Trunking and EtherChannel technology, which is also used in the Linux 2.4.x kernel, known as bonding.

Bonding The earliest application of the technology is in the cluster--beowulf, in order to improve the data transmission between the nodes of the cluster design. Let's discuss the principle of bonding, what is bonding needs to start with the promiscuous (PROMISC) mode of the NIC. We know that under normal circumstances, the network card only receives the destination hardware address (MAC addresses) is the Ethernet frame of its own Mac, filtering out other data frames to reduce the burden on the driver. But the NIC also supports another mode called promiscuous Promisc, which can receive all the frames on the network, such as Tcpdump, which is running in this mode. Bonding also runs in this mode, and modifies the MAC address in the driver, changing the MAC address of the two NIC to the same, and receiving data frames for a particular Mac. The corresponding data frames are then routed to the bond driver for processing. For more information, refer to Redhat in bonding

The experimental operating system is Redhat Linux Enterprise AS3

Binding Prerequisites: The chipset model is the same, and the NIC should have its own independent BIOS chip.

Topological map of Double net Cabondine


650) this.width=650; "Alt=" Click here to open new window "src=" https://note.wiz.cn/api/document/files/unzip/ Aa733843-7ddd-4d02-b73d-a5b13936ed14/7020544b-dac5-49af-8d1a-f83a61187335.8222/index_files/clip_ Image0026aebc63c-4c56-4858-8ae5-b12533584206.jpg "width=" height= "231"/>

1 , edit the virtual network interface configuration file, specify the network card IP

# Cp/etc/sysconfig/network-scripts/ifcfg-eth0 Ifcfg-bond0

# vim/etc/sysconfig/network-scripts/ifcfg-bond0

2 , edit

# Vim Ifcfg-bond0

Change the first line to Device=bond0

# Cat Ifcfg-bond0

Device=bond0

Bootproto=static

ipaddr=172.31.0.13

netmask=255.255.252.0

broadcast=172.31.3.254

Onboot=yes

Type=ethernet

Here's the idea, don't specify an IP address, subnet mask, or network card ID for a single network card. Specify the above information in the virtual adapter (bonding).

# Cat Ifcfg-eth0

Device=eth0

Onboot=yes

Bootproto=dhcp

# Cat Ifcfg-eth1

Device=eth0

Onboot=yes

Bootproto=dhcp

3 , edit the/etc/modprobe.conf file, add the following line to enable the system to load the bonding module at startup, the external virtual network interface device is BOND0

Add the following two lines

Alias Bond0 Bonding

Options Bond0 miimon=100 mode=1

Note: The Miimon is used for link monitoring. For example: miimon=100, then the system every 100MS monitoring link connection status, if there is a line that does not pass to another

A line; The value of mode indicates the mode of operation, he has a total of 0,1,2,3 four modes, commonly used for 0, 12 kinds.

mode=0 indicates that the load balancing (round-robin) is balanced, and both NICs are working.

mode=1 indicates that fault-tolerance (active-backup) provides redundancy, working in a way that the master is working, meaning that only one NIC works by default ,

Another piece to do the backup.

Bonding link monitoring can only be provided, i.e. whether the link from the host to the switch is connected. If only the switch external link down, and the switch itself is not faulty,

Then bonding will assume that the link is not a problem and continue to use

4 # Vi/etc/rc.d/rc.local

Add two lines

Ifenslave bond0 eth0 eth1

Route add-net 172.31.3.254 netmask 255.255.255.0 bond0

Restart the machine when it is configured to complete.

Reboot will see the following message indicating that the configuration was successful

................

Bringing Up interface Bond0 OK

Bringing Up interface eth0 OK

Bringing Up interface eth1 OK

................

Below we discuss the following mode for 0, 1 o'clock, respectively.

mode=1 operation in the main standby mode, then eth1 as the Backup network card is no ARP

[email protected] network-scripts]# ifconfig Verify the configuration information of the NIC

Bond0 Link encap:ethernet HWaddr 00:0e:7f:25:d9:8b

inet addr:172.31.0.13 bcast:172.31.3.255 mask:255.255.252.0

Up broadcast RUNNING MASTER multicast mtu:1500 metric:1

RX packets:18495 errors:0 dropped:0 overruns:0 frame:0

TX packets:480 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:1587253 (1.5 Mb) TX bytes:89642 (87.5 Kb)

Eth0 Link encap:ethernet HWaddr 00:0e:7f:25:d9:8b

inet addr:172.31.0.13 bcast:172.31.3.255 mask:255.255.252.0

Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1

RX packets:9572 errors:0 dropped:0 overruns:0 frame:0

TX packets:480 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:833514 (813.9 KB) TX bytes:89642 (87.5 KB)

Interrupt:11

eth1 Link encap:ethernet HWaddr 00:0e:7f:25:d9:8b

inet addr:172.31.0.13 bcast:172.31.3.255 mask:255.255.252.0

Up broadcast RUNNING noarp SLAVE multicast mtu:1500 metric:1

RX packets:8923 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:753739 (736.0 Kb) TX bytes:0 (0.0 b)

Interrupt:15

That is to say, in the main standby mode, when a network interface fails (such as the main switch power down, etc.), do not return to the network interruption, the system will follow the Cat/etc/rc.d/rc.local

Specify the order of the network card work, the machine can still serve the external, played a function of failure protection.

In the Mode=0 load balancing operation mode, he can provide twice times the bandwidth, let's take a look at the network card configuration information

[Email protected] root]# ifconfig

Bond0 Link encap:ethernet HWaddr 00:0e:7f:25:d9:8b

inet addr:172.31.0.13 bcast:172.31.3.255 mask:255.255.252.0

Up broadcast RUNNING MASTER multicast mtu:1500 metric:1

RX packets:2817 errors:0 dropped:0 overruns:0 frame:0

TX packets:95 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:226957 (221.6 KB) TX bytes:15266 (14.9 KB)

Eth0 Link encap:ethernet HWaddr 00:0e:7f:25:d9:8b

inet addr:172.31.0.13 bcast:172.31.3.255 mask:255.255.252.0

Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1

RX packets:1406 errors:0 dropped:0 overruns:0 frame:0

TX packets:48 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:113967 (111.2 KB) TX bytes:7268 (7.0 KB)

Interrupt:11

eth1 Link encap:ethernet HWaddr 00:0e:7f:25:d9:8b

inet addr:172.31.0.13 bcast:172.31.3.255 mask:255.255.252.0

Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1

RX packets:1411 errors:0 dropped:0 overruns:0 frame:0

TX packets:47 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:112990 (110.3 KB) TX bytes:7990 (7.8 kb)

Interrupt:15

In this case, a NIC fails, only the server egress bandwidth drops, and does not affect network use.

By looking at the working status of BOND0, we can understand the working status of bonding in detail.

[Email protected] bonding]# cat/proc/net/bonding/bond0

bonding.c:v2.4.1 (September 15, 2003)

Bonding mode:load Balancing (round-robin)

MII Status:up

MII Polling Interval (ms): 0

Up Delay (ms): 0

Down Delay (ms): 0

Multicast Mode:all Slaves

Slave interface:eth1

MII Status:up

Link Failure count:0

Permanent HW addr:00:0e:7f:25:d9:8a

Slave Interface:eth0

MII Status:up

Link Failure count:0

Permanent HW addr:00:0e:7f:25:d9:8b

Linux under the network Cabondine technology not only increased the reliability of the server, but also increased the available network bandwidth, to provide users with uninterrupted key services.


This article is from the "Lonely No Color" blog, please be sure to keep this source http://tenderness.blog.51cto.com/8855468/1942961

Linux platform Dual-NIC binding technology for load balancing (NIC aggregation) bonding

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.