Multi-Nic binding operation method under Linux system

Source: Internet
Author: User

In a Linux system, it is common to bind multiple network adapters to a single logical NIC, which can improve the stability of the network, so how do you bind multiple networks to one? The following small series to introduce under Linux multiple network card binding bond mode principle.

By binding multiple Linux network ports to one, you can improve the performance of your network, for example, for backup servers, you need to back up a few T data in one night, and using a single gigabit network will be a serious bottleneck. Other applications, such as FTP servers and high load download sites, have similar problems. Therefore, using Linux teaming or bond to bind multiple network cards as a logical port, configuring a single IP address can significantly increase network throughput (I/O) of the server.

Linux's multiple NIC bindings feature is the kernel of the "bonding" module, about this module can refer to the Linux Ethernet bonding driver documentation, but the current release of each Linux version of the kernel has included this module, In most cases, you do not need to recompile the kernel. Linux's bonding drive provides the ability to bind/integrate (bond) multiple network cards into a virtual logical port. And please note that the bound network port (bonded) has a variety of working modes; Generally, it is divided into hot standby and load balancing (balancing load). It is easier to configure in Redhat/fedora and other classes of Redhat Linux.

1. Create BOND0 configuration file

Vi/etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=BOND0--Physical device name

ipaddr=192.168.1.2--IP Address

netmask=255.255.255.0--Subnet mask

gateway=192.168.1.1--Gateway

dns=8.8.8.8--dns

Onboot=yes--Random start

Name=bond0

Bootproto=none

Userctl=no--whether to allow non-root users to control the device

2. Modify the eth0 and eth1 configuration files that are bound

Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Device= "Eth0"

Userctl=no

Onboot=yes

Master=bond0

Slave=yes

Bootproto=none

Hwaddr=00:15:17:cc:fc:35

The eth1 configuration file is the same, except that the device value is changed to eth1.

3. Loaded in the Bond module drive

Edit the/etc/modprobe.conf or/etc/modules.conf file and add the following contents to enable the system to load bonding module driver

Alias Bond0 Bonding

Option Bond0 miimon=100 mode=1

Description

1). miimon=100 is used for link monitoring. The link state is monitored every 100ms. Bonding only monitors the link between the host and the switch. If the switch is out of the link and there is no problem in itself, then bonding that the link is not a problem and continues to use.

2). mode=1 represents the provision of redundant functionality. In addition, it can be 0, 2, 3, a total of four models. 0 means load Balancing

4. Add the following statement to the/etc/rc.d/rc.local file to enable the system to start Autorun

Ifenslave bond0 eth0 eth1

Route add-net 192.168.1.254 netmask 255.255.255.0 bond0 #如有需要才加该路由

5. Testing, verifying configuration

First execute command Mount Bonding module: modprobe bonding

Restart the Network service and confirm that Bond0 started correctly: Service network restart

Confirm that the device is loaded correctly: Less/proc/net/bonding/bond0

List all Web ports: ifconfig

Above is the Linux multiple network card binding bond mode principle introduced, the bond model originally has 7 kinds, here only introduced one of them, hope to help you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.