Article Title: Use bonding for dual NICs under RHEL5 server. 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.
The so-called bonding means to bind multiple NICs to the same IP address to provide external services, which can achieve high availability or load balancing. Of course, it is impossible to directly set the same IP address for the two NICs. Through bonding, a virtual network card provides external connections, and the physical network card is changed to the same MAC address. Kernels 2.4.12 and later versions both provide bonding modules. Previous versions can be implemented through patch.
1. Check the network card you are currently using and check the files starting with ifcfg-in the/etc/sysconfig/network-scripts directory. They should be eth0, eth1 ......
2. Configure the virtual network card bond0
You can use DHCP or static IP. It is best to edit the configuration file through vi.
[Root @ server1 ~] # Cd/etc/sysconfig/network-scripts [Root @ server1 network-scripts] # cat ifcfg-bond0 DEVICE = bond0 BOOTPROTO = none ONBOOT = yes NETWORK = 192.168.0.0 NETMASK = 255.255.255.0 IPADDR = 192.168.0.10 USERCTL = no GATEWAY = 192.168.0.254 TYPE = Ethernet |
3. Modify the eth0 and eth1 configuration files.
[Root @ server1 network-scripts] # ifcfg-eth0 DEVICE = eth0 BOOTPROTO = none ONBOOT = yes MASTER = bond0 SLAVE = yes USERCTL = yes [Root @ server1 network-scripts] # ifcfg-eth1 DEVICE = eth1 BOOTPROTO = none ONBOOT = yes MASTER = bond0 SLAVE = yes USERCTL = yes |
4. Add the newly added bond0 device to modprobe. conf for kernel recognition. Add the Setting Parameter. The value of miimon indicates the time when two NICs monitor each other, in ms. The mode value is work mode, which can be set to high availability or load balancing. 0 is high availability (default), 1 is Server Load balancer, and an XOR mode is also available.
Alias bond0 bonding
Options bond0 miimon = 100 mode = 1