How Linux configures the dual NIC binding bond

Source: Internet
Author: User

What is bind?

The technology of virtual multi-block network card into a network card, through the bond technology, make multiple NIC appear to be a separate Ethernet interface device and have the same IP address.

Principle:
The NIC works in promiscuous (PROMISC) mode, receiving all packets that reach the network card, Tcpdump is also promiscuous mode (PROMISC), and modifies the MAC address of the two NIC to the same data frame that receives a specific Mac. The corresponding data frame is then transmitted to the bond driver for processing.

Mode=1: In the main standby mode, only the primary network card eth0 work, eth1 as a backup network card is not working, only when a network interface failure (such as switch power off, etc.), in order to avoid network interruption, the system will be configured according to the specified NIC sequence to start work, to ensure that the machine can still serve the external Fail-safe function.
Mode=0: In load Balancing mode, both NICs work, providing twice times the bandwidth.


Configuration steps:


1, select 2 of the network ports you need to see which network ports
[Email protected] ~]# ifconfig-a

2, edit the network port configuration file
[Email protected] ~]# cd/etc/sysconfig/network-scripts
[[email protected] network-scripts]# ls
Start with ifcfg-
For example: Eth0 's profile name is Ifcfg-eth0

[Email protected] network-scripts]# vim Ifcfg-eth0
[email protected] network-scripts]# cat Ifcfg-eth0
Device=eth0 #网口名eth0
Type=ethernet #以太网接口
Onboot=yes #LINUX在启动时激活该网口
Bootproto=none #使用什么协议激活网口
None means no protocol is used
Static indicates that the IP is set
DHCP represents the dynamic acquisition of IP
Master=bond0 #指定虚拟网口的名字 (Master)
Slave=yes #备用 (from Device)

[Email protected] network-scripts]# vim ifcfg-eth1
[email protected] network-scripts]# cat Ifcfg-eth1
Device=eth1 #网口名eth1
Type=ethernet #以太网接口
Onboot=yes #LINUX在启动时激活该网口
Bootproto=none #使用什么协议激活网口
None means no protocol is used
Static indicates that the IP is set
DHCP represents the dynamic acquisition of IP
Master=bond0 #指定虚拟网口的名字
Slave=yes #备用
Note: eth0, eth1 Master (Master) is bond0, which itself belongs to slave from device as bond0 (standby)

[Email protected] network-scripts]# vim ifcfg-bond0
[email protected] network-scripts]# cat ifcfg-bond0
Device=bond0
Type=ethernet
Onboot=yes
Bootproto=static
ipaddr=172.16.11.99
netmask=255.255.0.0
gateway=172.16.1.1

3, Configuration Bonding
[Email protected] network-scripts]# vim/etc/modprobe.d/dist.conf
Add the following two lines at the end
Alias Bond0 Bonding
Options Bond0 miimon=100 mode=1
#miimon是用来进行链路监测的: miimon=100 indicates that the system monitors the link connection status every 100ms, and transfers to another route if one line is different.
#mode =1 indicates that it belongs to the main standby mode.

4, add the following statement in the/etc/rc.d/rc.local file, is the system start automatically run
Ifenslave bond0 eth0 eth1
#route add-net 172.16.0.0 netmask 255.255.0.0 bond0---If you need to add the route

5. Reboot restart

6, if you look at the current network port is the main network port
[Email protected] ~]# cat/proc/net/bonding/bond0
Ethernet Channel Bonding driver:v3.7.1 (April 27, 2011)

Bonding mode:fault-tolerance (Active-backup)
Primary Slave:none
Currently Active Slave:eth1
MII Status:up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface:eth0
MII Status:up
speed:1000 Mbps
Duplex:full
Link Failure count:1
Permanent HW Addr:00:0c:29:9d:58:ae
Slave Queue id:0

Slave interface:eth1
MII Status:up
speed:1000 Mbps
Duplex:full
Link Failure count:0
Permanent HW Addr:00:0c:29:9d:58:b8
Slave Queue id:0
Copy Code
Attention:
①uuid is the only number that is unique for each network port
② Two configuration files hwaddr cannot be the same, can not, because will automatically read
③ Network port after switching ifconfig bond0 to see the MAC address or the MAC address before switching--in order to prevent IP corresponding MAC address confusion

How Linux configures the dual NIC binding bond

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.