Dual-nic binding technology in Linux for load balancing and Failure Protection
Cgweb
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 technology 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 Redhat Linux Enterprise 3.0.
Prerequisites: the chipset model is the same, and the NIC should have its own independent BIOS chip.
Topology of dual Nic Bonding
1. New/etc/sysconfig/network-scripts/ifcfg-bond0 File
DEVICE = bond0
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.0.23
NETMASK = zookeeper
GATEWAY = 192.168.128.233
USERCTL = no
Do not specify the IP address, subnet mask, or Nic ID of a single Nic. Specify the above information to the virtual adapter (bonding.
2. Change/etc/sysconfig/network-scripts/ifcfg-eth0 Nic Properties
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = none
MASTER = bond0
USERCTL = no
3. Change the properties of the/etc/sysconfig/network-scripts/ifcfg-eth1 Nic
DEVICE = eth1
ONBOOT = yes
BOOTPROTO = none
MASTER = bond0
USERCTL = no
Source: DIY tribe
4 # vi/etc/modules. conf
Edit the/etc/modules. conf file and 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 rows
Alias bond0 bonding
Options bond0 miimon = 100 mode = 1