Linux under Bond dual NIC binding

Source: Internet
Author: User


Bond , is a dual-NIC binding technology. The multi-block physical network card is bound to be a logical network card, and a reliable and high-availability technology is realized, such as network card redundancy and traffic equalization.

Seven types of bond modes:

First, Mod=0 is BANLANCE-RR (balance wheel cycle strategy)

Features: The order of transmission packets is transmitted sequentially, the first to go eth0, the second packet to go eth1 ... Keep looping like this until the transfer is complete. This mode provides load balancing and fault tolerance.

If a connection or session packet is sent from a different interface and passes through a different link, the client may have a situation where the packet arrives out of order, which causes the data to be sent out of order, causing the network's throughput to drop.

Second, mod=1 is Active-backup (master-backup strategy)

Features: Only one network card device is active, when the network card in the primary is faulty or down, it will immediately convert the slave network card to master network card, the original primary network card traffic transfer. This mode only provides the ability to fault tolerance.

The MAC address of the NIC is unique, and the MAC address of Bond is the only one, which also avoids the confusion of the switch and generates ARP broadcast storm. On the one hand, this mode can provide the availability of the network card connection, on the other hand only a network card processing active state, resource utilization is low.

Three, mod=2 namely Balance-xor (Balance strategy)

Feature: transmits packets based on the specified transfer hash policy. This mode provides load balancing and fault tolerance.

Iv. Mode=3 is broadcast (broadcast strategy)

Feature: Each packet is transmitted on each slave interface, and this mode provides fault tolerance.

Five, mod=4 802.3ad (ieee802.3ad dynamic Link aggregation)

Feature: Create an aggregation group that shares the same rate and duplex settings. Outgoing traffic slave elections are based on the transfer hash policy, which can be changed from the default XOR policy to other policies through the Xmit_hash_policy option.

Condition: Ethbool supports obtaining rate and duplex settings for each slave; switch supports IEEE802.3AD;

Most switches require a specific configuration to support 802.3ad mode.

Vi. mod=5 i.e. balance-tlb (adapter load balancer)

Features: Channel bonding is not required for any special switch support. Out-of-office traffic is allocated per slave based on the current load. If the slave that is accepting data fails, the other slave takes over the MAC address of the failed slave.

Condition: Ethbool supports getting the rate per slave.

Vii. mode=6, i.e. balance-alb (adaptive load balancing of the regulator)

Features: This mode includes the Balance-tlb mode, coupled with receive load balancing for IPv4 traffic, without the need for switch support. Receive load balancing is implemented through ARP negotiation.

Experiment with centos7.2 to bind the NIC:

First, create a bond0

[Email protected] ~]# cd/etc/sysconfig/network-scripts/

[email protected] network-scripts]# cat ifcfg-bond0

Device=bond0

Bootproto=static

Onboot=yes

ipaddr=172.25.254.200

netmask=255.255.255.0

gateway=172.25.254.2

network=172.25.254.0

dns1=202.96.134.133

bonding_opts= "mode=1 miimon=100 primary=eno16777736"

Userctl=no

[Email protected] network-scripts]#

Second, modify the configuration file of the dual network card

[email protected] network-scripts]# cat ifcfg-eno16777736

device=eno16777736

Bootproto=none

Onboot=yes

Master=bond0

Slave=yes

Userctl=no

Nm_contorlled=no

[email protected] network-scripts]# cat ifcfg-eno33554992

device=eno33554992

Bootproto=none

Onboot=yes

Master=bond0

Slave=yes

Userctl=no

Nm_contorlled=no

[Email protected] network-scripts]#

Third, restart the network services

[Email protected] network-scripts]# systemctl Restart Network

# loading the bonding module

[Email protected] network-scripts]# cat/etc/modprobe.d/bonding.conf

Alias Bond0 Bonding

Options Bond0 miimon=100 mode=1

[Email protected] network-scripts]# modprobe bonding

Four, experimental verification

[[Email protected] network-scripts]# IP add show

1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN

Link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00

inet 127.0.0.1/8 Scope host Lo

Valid_lft Forever Preferred_lft Forever

INET6:: 1/128 Scope Host

Valid_lft Forever Preferred_lft Forever

2:eno16777736: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> MTU qdisc pfifo_fast Master bond0 State up Qlen 1000

Link/ether 00:0c:29:fa:56:68 BRD FF:FF:FF:FF:FF:FF

3:eno33554992: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> MTU qdisc pfifo_fast Master bond0 State up Qlen 1000

Link/ether 00:0c:29:fa:56:68 BRD FF:FF:FF:FF:FF:FF

4:BOND0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> MTU Qdisc Noqueue State up

Link/ether 00:0c:29:fa:56:68 BRD FF:FF:FF:FF:FF:FF

inet 172.25.254.200/24 BRD 172.25.254.255 Scope Global BOND0

Valid_lft Forever Preferred_lft Forever

Inet6 FE80::20C:29FF:FEFA:5668/64 Scope link

Valid_lft Forever Preferred_lft Forever

[Email protected] network-scripts]#

Five, through the/proc/net/bonding/bond0 view mode and network card status and other information

[Email protected] network-scripts]# cat/proc/net/bonding/bond0

Ethernet Channel Bonding driver:v3.7.1 (April 27, 2011)


Bonding mode:fault-tolerance (Active-backup)

Primary slave:eno16777736 (Primary_reselect always)

Currently Active slave:eno16777736

MII Status:up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0


Slave interface:eno16777736

MII Status:up

speed:1000 Mbps

Duplex:full

Link Failure count:0

Permanent HW addr:00:0c:29:fa:56:68

Slave Queue id:0


Slave interface:eno33554992

MII Status:up

speed:1000 Mbps

Duplex:full

Link Failure count:0

Permanent HW addr:00:0c:29:fa:56:72

Slave Queue id:0

[Email protected] network-scripts]#

Six, when the active network card is down, the slave network card will immediately take its task

[Email protected] ~]# ifconfig eno16777736 down

[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:eno16777736 (Primary_reselect always)

Currently Active Slave: eno33554992

MII Status:up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0


Slave interface:eno16777736

MII Status:up

speed:1000 Mbps

Duplex:full

Link Failure count:0

Permanent HW addr:00:0c:29:fa:56:68

Slave Queue id:0


Slave interface:eno33554992

MII Status:up

speed:1000 Mbps

Duplex:full

Link Failure count:0

Permanent HW addr:00:0c:29:fa:56:72

Slave Queue id:0


[[email protected] ~]# Ping baidu.com

PING baidu.com (180.149.132.47) bytes of data.

Bytes from 180.149.132.47:icmp_seq=1 ttl=128 time=39.4 ms

Bytes from 180.149.132.47:icmp_seq=2 ttl=128 time=39.3 ms

Bytes from 180.149.132.47:icmp_seq=3 ttl=128 time=39.2 ms

Bytes from 180.149.132.47:icmp_seq=4 ttl=128 time=39.1 ms

Bytes from 180.149.132.47:icmp_seq=5 ttl=128 time=40.0 ms


This article is from the "Journey of an OPS" blog, make sure to keep this source http://chenxiaotao.blog.51cto.com/11430805/1931790

Linux under Bond dual NIC binding

Related Article

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.