In fact, I have also written a blog post about bind dual NICs in Linux. Today, I conducted another binding experiment and found that it is much simpler than the original binding. It may be caused by different system or system versions. A series of previous articles about bind Dual Network Interfaces in Linux. Today, we found that it is okay not to perform those operations. Therefore, the following is a simple record.
[Root @ localhost ~] # Cd/etc/sysconfig/network-scripts/[root @ localhost network-scripts] # cp ifcfg-eth1 ifcfg-bond0
Vim ifcfg-bond0.
[Root @ localhost network-scripts] # cat ifcfg-bond0DEVICE = "bond0" BOOTPROTO = "static" NM_CONTROLLED = "no" ONBOOT = "yes" TYPE = "Ethernet" BONDING_OPTS = "mode = "1 miimon = 100 "IPADDR = 192.168.2.115NETMASK = 255.255.255.0DNS1 = 192.168.2.115DNS2 = 192.168.8.2 [root @ localhost network-scripts] #
Vim ifcfg-eth1.
[Root @ localhost network-scripts] # cat ifcfg-eth1DEVICE = "eth1" BOOTPROTO = "static" HWADDR = "00: 0C: 29: 72: 88: DC "NM_CONTROLLED =" no "ONBOOT =" yes "TYPE =" Ethernet "MASTER = bond0SLAVE = yes [root @ localhost network-scripts] #
Vim ifcfg-eth2 (I have three NICs here, starting from eth0 so to eth2)
[Root @ localhost network-scripts] # cat ifcfg-eth2DEVICE = "eth2" BOOTPROTO = "static" NM_CONTROLLED = "no" ONBOOT = "yes" TYPE = "Ethernet" MASTER = bond0SLAVE = yes [root @ localhost network-scripts] #
Restart the network. [Root @ localhost network-scripts] # service network restart
The test results after network restart are as follows:
Ping the bond0 address for testing
Some configuration parameters for binding dual-nic in Linux are collected as follows:
BONDING_OPTS parameter description this parameter is used to specify the attributes when the network card is bound. The following describes common parameters: miimon parameter: Specify the switching interval in milliseconds when the network card fails. Primary parameter: Specify the default primary ENI device. Mode parameter: 0-Round Robin mode. The bound Nic is evenly divided by the round robin algorithm for access. 1-in high availability mode, only one Nic is used during running, and other NICs are used as backups. We recommend that you use this mode when the load does not exceed the bandwidth or pressure of a single Nic. 2-Server Load balancer mode based on the HASH algorithm. Nic shunting is performed based on the TCP protocol layer setting of xmit_hash_policy, allow access from different processing sources to be processed on the same Nic as much as possible. 3-in broadcast mode, all bound NICs obtain the same data, which is generally used for special network requirements. If you need to send the same data to two vswitches that are not connected to each other. 4-802.3ab Load Balancing mode requires that the switch also supports the 802.3ab mode. Theoretically, when both the server and switch support this mode, the maximum bandwidth of the NIC can be doubled (for example, from 1 Gbps to 2 Gbps) 5-The adapter outputs the Server Load balancer mode. The output data is output through all the bound NICs. When receiving data, only one of the NICS is selected. If the NIC used to receive data fails, other NICs take over. The nic and nic Driver must use the ethtool command to obtain the speed information. 6-the input/output Server Load balancer mode of the adapter. Based on "mode 5", Server Load balancer is implemented while receiving data. Besides requiring the ethtool command to obtain speed information, it is also required that the MAC address of the NIC be dynamically modified. Xmit_hash_policy parameter (this parameter affects the 2 and 4 modes in the mode parameter): layer1-HASH computing through the MAC address. Calculation formula: (MACsrc using MACdest) % Nslavelayer3 + 4-HASH calculation using TCP and UDP ports and their IP addresses. Calculation formula: (portsrc incluportdest) equal (IPsrc incluipdest) % NslaveNote: the 0, 2, 3, and 4 modes in the mode parameter require that the switch supports the "ports group" function and can be set accordingly, for example, in Cisco, set the connected port to "trunk group ".