Ubuntubonding (16.04 NIC Bindings)

Source: Internet
Author: User

ubuntubonding (NIC binding)

binding, also known as Port aggregation or link aggregation, means that multiple network interfaces (NICs) are combined into a single link, providing high availability, load balancing, maximum throughput, or these combinations.
Note that bonding can only provide link monitoring, i.e. whether the link from the host to the switch is connected. If only the link of the switch to external (such as firewall, etc.) is down, and the switch itself does not fail, then bonding will assume that the link is not a problem and continue to use.

The load balancer software Fenslave, which is required to install the NIC bindings, is a load Balancer tool under Linux that can efficiently allocate packets to the bonding driver.

1. Check whether the software Fenslave is installed
[email protected]:~# dpkg-l | grep fenslave
II Ifenslave 2.7UBUNTU1 All configure network interfaces for parallel routing (bonding)

The information above can be used to know that the software is installed

2, if not installed, can be installed through apt source, there is outside the network to use the source, there is no local DVD source.
[email protected]:~# apt-get Install Ifenslave

Third, check whether the bonding module is loaded normally
[email protected]:~# lsmod | grep bonding
Bonding 147456 0
[Email protected]:~#

iv. Add the bonding module to boot, edit the/etc/modules configuration file as follows

[email protected]:~# vi/etc/modules
#/etc/modules:kernel modules to load at boot time.
#
# This file contains the names of kernel modules, should be loaded
# at boot time, one per line. Lines beginning with "#" is ignored.
bonding #添加的内容 To enable the module to boot

[Email protected]:~#

Five, configure the network interface

1. Make sure your network is turned off:
[email protected]:~# systemctl Stop Networking.service

2. Then load the binding kernel module:
[email protected]:~# modprobe bonding #如果上面查看模块时已经加载, here can not execute

3. Edit the network configuration file

[email protected]:~# vi/etc/network/interfaces

Example 1: To use the simple primary and Standby mode settings, enp4s0f0 and ENP4S0F1 as the binding network card, the bound interface is bond0, and will act as the ENP4S0F0 main interface:
before binding, you need to check the available network card through the IFCONFIG-A command, the configuration file is as follows:
--------------------------------------------------------------------------
# ENP4S0F0 is manually configured, and slave to the "bond0" bonded NIC
Auto enp4s0f0 #要绑定的主网卡
iface enp4s0f0 inet manual
Bond-master bond0
bond-primary enp4s0f0

# Enp4s0f1 Ditto, thus creating a 2-link bond.
Auto Enp4s0f1 #要绑定的备网卡
iface enp4s0f1 inet manual
Bond-master bond0

# BOND0 is the bonding NIC and can be used as any other normal NIC.
# BOND0 is configured using static network information.
Auto Bond0 #绑定的网卡名
iface bond0 inet static #静态地址
address 192.168.3.30 #IP
Gateway 192.168.3.1 #网关
netmask 255.255.255.0 #子网
Bond-mode active-backup #模式主备
Bond-miimon #miimon是100毫秒监测一次网卡状态, if one line is not available, switch to another line.
bond-slaves None
-------------------------------------------------------------------------

Example 2: To use the adaptive Load Balancing mode (mode 6) settings, enp4s0f0 and ENP4S0F1 as the binding network card, the binding interface is BOND0,
The configuration file is as follows:

# ENP4S0F0 is manually configured, and slave to the "bond0" bonded NIC
Auto enp4s0f0
iface enp4s0f0 inet manual
Bond-master bond0

# Enp4s0f1 Ditto, thus creating a 2-link bond.
Auto Enp4s0f1
iface enp4s0f1 inet manual
Bond-master bond0

# BOND0 is the bonding NIC and can be used as any other normal NIC.
# BOND0 is configured using static network information.
Auto Bond0
iface bond0 inet static
Address 13.181.3.30
Gateway 13.181.3.254
netmask 255.255.255.0
Bond-mode 6 #绑定模式为6
Bond-miimon
bond-slaves enp4s0f0 enp4s0f1 #绑定的从属的网卡
------------------------------------------------------------------------------

Six, start the network card
[email protected]:~# systemctl start Networking.service


Vii. Viewing the work of Bond0

[email protected]:~# cat/proc/net/bonding/bond0
Ethernet Channel Bonding driver:v3.7.1 (April)

Bonding mode:fault-tolerance (active-backup) #bond模式为主备
Primary slave:enp4s0f0 (Primary_reselect always)
currently Active slave:enp4s0f0
MII status:up
MII Polling Interval (ms):
Up Delay (ms): 0
Down Delay (ms): 0

Slave interface:enp4s0f0
MII status:up
speed:10000 Mbps
Duplex:full
Link Failure count:0
Permanent HW addr:50:5d:ac:49:08:3f
Slave Queue id:0

Slave interface:enp4s0f1
MII status:up
speed:10000 Mbps
Duplex:full
Link Failure count:0
Permanent HW addr:50:5d:ac:49:08:40
Slave Queue id:0
[Email protected]:~#


There are 7 working modes (mode) of bonding:

0: (BALANCE-RR) round-robin policy: (Balanced polling strategy): The transmit packet order is transmitted sequentially until the last transmission is complete, which provides load balancing and fault tolerance.

1: (active-backup) active-backup policy: (Active backup policy): Only one device is active. One goes down and the other immediately transforms the primary device from the backup. The MAC address is externally visible. This mode provides fault tolerance.

2: (BALANCE-XOR) XOR policy: (Balanced strategy): transmits a transmission device based on a Boolean value [(Source MAC address Xor destination MAC address) mod device number]. This mode provides load balancing and fault tolerance.

3: (broadcast) broadcast policy: (Broadcast policy): Transfers all packets to all devices. This mode provides fault tolerance.

4: (802.3AD) IEEE 802.3ad Dynamic link aggregation. IEEE 802.3ad Dynamic Link aggregation: Create an aggregation group that shares the same speed and duplex settings. This mode provides fault tolerance. Each device requires drive-based re-acquisition speed and full-duplex support, and if the switch is used, the switch also needs to enable 802.3AD mode.

5: (balance-tlb) Adaptive Transmit load balancing (adapter transport load balancer): Channel bindings do not require dedicated switch support. The traffic emitted is assigned to each device according to the current load. Received by the current device, if the accepted device does not pass, use another device to take over the MAC address that the current device is processing.

6: (BALANCE-ALB) Adaptive load Balancing: (Adapter Load Balancer): Includes MODE5, the payload that is received by the ARP negotiation. The bonding driver intercepts the request sent by ARP on the local system, overwriting the original address of the subordinate device with one of the hardware addresses. It's like a different person on the server using a different hardware address.


































Ubuntubonding (16.04 NIC Bindings)

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.