In Linux, you can easily bind multiple NICs to achieve load balancing and dual-line hot backup.
Server Load balancer distributes the average load to any number of network adapters to overlay the bandwidth.
Dual-line Hot Standby means that multiple NICs are backed up to each other. Any one of them can work to ensure the normal operation of the network.
Binding types
Mode = 0 round-robin: sequential (Round Robin load balancing, most commonly used)
Mode = 1 active-Backup: only one
Mode = 2 XOR: Same Mac same Nic
Mode = 3 broadcast: All
The major release editions are slightly different, basically divided into three types,
Debian and Ubuntu,
Suse,
Mandriva, fedora, and RH
-----------------------------------------------------------------------
Bind multiple NICs On Debian and Ubuntu
Experimental environment: Ubuntu 6.06 dadder, kernel version 2.6.15-23 Server
First install ifenslave
# Apt-Get install ifenslave-2.6
Edit/etc/Network/interfaces
Auto lo bond0 eth0 eth1
Iface bond0 Inet static
Address 10.31.1.5
Netmask 255.255.255.0
Network 10.31.1.0
Gateway 10.31.1.254
Up/sbin/ifenslave bond0 eth0
Up/sbin/ifenslave bond0 eth1
Iface lo loopback
Iface eth0 Inet static
Address 10.1.1.101
Netmask 255.255.255.0
Iface eth1 Inet static
Address 10.1.1.102
Netmask 255.255.255.0
Edit/etc/modprobe. d/ARCH/i386
Add two rows:
Alias bond0 Bonding
Options bonding mode = 0 miimon = 100
Restart the network.
/Etc/init. d/networking restart
-----------------------------------------------------------------------
Suse, mandriva, fedora, and RH
1. edit/etc/modules. CONF file (The SuSE system is/etc/modprobe. d/modprobe. cong. local), add the following line to make the system load the bonding module at startup, and the external virtual network interface device is bond0
Alias bond0 Bonding
2. Edit the virtual network interface configuration file and specify the IP address of the NIC.
VI/etc/sysconfig/network-scripts/ifcfg-bond0
(The SuSE system is/etc/sysconfig/Network/ifcfg-bond0)
Writing of Fedora
Device = bond0
Ipaddr = 192.168.1.1
Netmask = 255.255.255.0
Network = 192.168.1.0
Broadcast = 192.168.1.255
Onboot = Yes
Bootproto = none
Userctl = No
SuSE statement
Bootproto = 'static'
Broadcast = '1970. 168.1.255'
Ethtool_options =''
Ipaddr = '192. 168.1.1'
MTU =''
Netmask = '2017. 255.255.0'
Network = '1970. 168.1.0'
Startmode = 'auto'
Usercontrol = 'no'
3. Edit the physical network interface configuration file and point to the virtual network interface bond0.
Fedora:
The physical network interface configuration file is located in/etc/sysconfig/network-scripts,
The ifcfg-eth0 corresponds to the first Nic, And the ifcfg-eth1 corresponds to the second Gigabit Nic.
Ifcfg-eth0:
Device = eth0
Ipaddr = 11.0.0.1
Netmask = 255.255.255.0
Userctl = No
Onboot = Yes
Bootproto = none
Ifcfg-eth1:
Device = eth1
Ipaddr = 11.0.0.2
Netmask = 255.255.255.0
Userctl = No
Onboot = Yes
Bootproto = none
SuSE:
The physical network interface configuration file is located at/etc/sysconfig/Network /,
Use ifcfg-eth-(MAC) as the name
Bootproto = 'static'
Ipaddr = '10. 0.0.1'
Netmask = '2017. 255.255.0'
Startmode = 'auto'
Usercontrol = 'no'
Finally, edit/etc/rc. Local (SuSE is/etc/rc. d/RC) or directly run
Ifenslave bond0 eth0 eth1 eth2 (write the names of several NICs when several NICs are bound)
No matter how the IP address of eth0 eth1 eth2 is set, the bind0 setting prevails after binding. The MAC addresses of all NICs are the same.