Article title: Dual-Nic binding in Linux achieves load balancing and failure protection. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In this article, the dual-Nic binding implementation in Linux is to use two NICs to virtualize a single NIC. 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.
In fact, in linux, it is very simple to bind a dual-Nic to a single NIC. you only need a few simple steps to achieve this. let's take a look at it. First, let's give a brief introduction to the experiment environment:
Operating system: RedHat Enterprise linux 4.0
Prerequisites: the chipset model is the same, and the NIC should have its own independent BIOS chip.
Procedure:
1. edit the virtual network interface configuration file and specify the IP address of the NIC. (without this file, we can copy one from the previous configuration file to reduce the input text .)
| [Root @ heng ~] # Cp/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-scripts/ifcfg-bond0 |
Make sure the content of/etc/sysconfig/network-scripts/ifcfg-bond0 is the same
[Root @ heng ~] # Cat/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE = bond0
BOOTPROTO = static
BROADCAST = 192.168.1.255
IPADDR = 192.168.1.202
NETMASK = 255.255.255.0
ONBOOT = yes
TYPE = Ethernet
|
2. edit/etc/sysconfig/network-scripts/ifcfg-eth0 and/etc/sysconfig/network-scripts/ifcfg-eth1 to make sure the edited content is the same as the content shown below
[Root @ heng ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = none |
[Root @ heng ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE = eth1
ONBOOT = yes
BOOTPROTO = none |
[1] [2] [3] Next page