In Linux, dual-nic binding is achieved by virtualizing two NICs into one. 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. 1. Modify Nic configuration a, switch directory cd/etc/sysconfig/network-scripts/ifcfg-bond0 and then create a file ifcfg-bond0vimifcfg-bond0,
In Linux, dual-nic binding is achieved by virtualizing two NICs into one. 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.
1. Modify Nic Configuration
A. Switch the Directory
Cd/etc/sysconfig/network-scripts/ifcfg-bond0
Then create a file ifcfg-bond0
Vim, ifcfg-bond0,
DEVICE = bond0
ONBOOT = yes
BOOTPROTO = static
TYPE = Ethernet
USERCTL = no
IPADDR = 192.168.1.55
NETMASK = 255.255.255.0
GATEWAY = 192.168.1.254
B. Modify the eth0 File
Vim ifcfg-eth0.
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = none
TYPE = Ethernet
MASTER = bond0
SLAVE = yes
USERCTL = no
C. Modify the eth1 File
DEVICE = eth1
ONBOOT = yes
BOOTPROTO = none
TYPE = Ethernet
MASTER = bond0
SLAVE = yes
USERCTL = no
2. Load the bonding Module
Vi/etc/modprobe. d/dist. conf Add at the end of the file
Alias bond0 bonding
Options bond0 mode = 1 miimon = 100
Parameter description:
Miimon is used for link monitoring. For example: miimon = 100, The system monitors the link connection status every Ms. If one line fails, it is transferred to another line.
The value of mode indicates the working mode. The commonly used working mode is 0, 1.
Mode = 0 indicates that the load balancing (round-robin) method is load balancing, and both NICs work.
Mode = 1 indicates that fault-tolerance (active-backup) provides redundancy, working in the active/standby mode. That is to say, by default, only one network card works and the other is used for backup. bonding can only provide link monitoring, that is, whether the link from the host to the switch is connected. If the external link of the switch is down and the switch is not faulty, bonding considers that the link is correct and continues to be used.
3. Set bond0 to automatically load upon startup
Write/etc/rc. d/rc. local
Add a sentence in the last 2nd rows.
Ifenslave bond0 eth0 eth1
4. Restart the NIC
The command/etc/init. d/network restart (or service network restart) has the same meaning. If not, try reboot or init 6 again.
5. Verify that the NIC is successfully bound.
Enter ifconfig to check whether the MAC addresses of the three NICs bond0, eth0, and eth1 are the same. If they are the same, you can confirm that the dual-nic binding takes effect.
Then, check the/proc/net/bonding/bond0 file and check whether the NIC is successfully bound.
The above is a normal dual-nic binding. We will analyze a fault.