Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the binding bond of dual network cards under Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

It is believed that many inexperienced people do not know what to do about how to configure the dual network card binding bond under Linux. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

What is bond?

The network card bond is bound into a logical network card by multiple network cards to achieve local network card redundancy, bandwidth expansion and load balancing. It is a commonly used technology in production scenarios. Kernels 2.4.12 and later are available for bonding modules, and previous versions can be implemented through patch.

II. Configuration example of bond

1. Test environment

[root@wjq2 ~] # cat / etc/redhat-release

Red Hat Enterprise Linux Server release 6.4 (Santiago)

[root@wjq2 ~] # uname-r

2.6.32-358.el6.x86_64

2. Check whether linux supports bonding. Most distributions do.

[root@wjq2 ~] # cat / boot/config-2.6.32-358.el6.x86_64 | grep-I bonding

CONFIG_BONDING=m

Or

[root@wjq2 ~] # modinfo bonding | more

Filename: / lib/modules/2.6.32-358.el6.x86_64/kernel/drivers/net/bonding/bonding.ko

Author: Thomas Davis, tadavis@lbl.gov and many others

Description: Ethernet Channel Bonding Driver, v3.6.0

Version: 3.6.0

License: GPL

Srcversion: 990DDFEBDBA03F305236885

Depends: 8021q,ipv6

Vermagic: 2.6.32-358.el6.x86_64 SMP mod_unload modversions

Parm: max_bonds:Max number of bonded devices (int)

Parm: tx_queues:Max number of transmit queues (default = 16) (int)

Parm: num_grat_arp:Number of gratuitous ARP packets to send on failover event (int)

Parm: num_unsol_na:Number of unsolicited IPv6 Neighbor Advertisements packets to send on failover event (int)

Parm: miimon:Link check interval in milliseconds (int)

Parm: updelay:Delay before considering link up, in milliseconds (int)

Parm: downdelay:Delay before considering link down, in milliseconds (int)

Parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int)

Parm: mode:Mode of operation; 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 fo

R 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp)

Parm: primary:Primary network device to use (charp)

Parm: primary_reselect:Reselect primary slave once it comes up; 0 for always (default), 1 for only if speed o

F primary is better, 2 for only on active slave failure (charp)

Parm: lacp_rate:LACPDU tx rate to request from 802.3ad partner; 0 for slow, 1 for fast (charp)

Parm: ad_select:803.ad aggregation selection logic; 0 for stable (default), 1 for bandwidth, 2 for count (cha)

Rp)

Parm: xmit_hash_policy:balance-xor and 802.3ad hashing method; 0 for layer 2 (default), 1 for layer 3 4, 2 fo

R layer 2x3 (charp)

Parm: arp_interval:arp interval in milliseconds (int)

Parm: arp_ip_target:arp targets in n.n.n.n form (array of charp)

Parm: arp_validate:validate src/dst of ARP probes; 0 for none (default), 1 for active, 2 for backup, 3 for al

L (charp)

If the above information is output, bonding is supported. If not, the kernel does not support bonding and the kernel needs to be recompiled.

3. View the configuration information of the existing network card

[root@wjq2 ~] # ifconfig

Eth0 Link encap:Ethernet HWaddr 00:50:56:B5:4F:F5

Inet addr:10.1.1.58 Bcast:10.1.1.255 Mask:255.255.255.0

Inet6 addr: fe80::250:56ff:feb5:4ff5/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:1302 errors:0 dropped:0 overruns:0 frame:0

TX packets:300 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:105872 (103.3 KiB) TX bytes:38427 (37.5KiB)

Eth2 Link encap:Ethernet HWaddr 00:50:56:B5:2D:0F

Inet addr:10.1.1.59 Bcast:10.1.1.255 Mask:255.255.255.0

Inet6 addr: fe80::250:56ff:feb5:2d0f/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:923 errors:0 dropped:0 overruns:0 frame:0

TX packets:18 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:69365 (67.7 KiB) TX bytes:1240 (1.2 KiB)

Lo Link encap:Local Loopback

Inet addr:127.0.0.1 Mask:255.0.0.0

Inet6 addr: 1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:8 errors:0 dropped:0 overruns:0 frame:0

TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:0

RX bytes:440 (440.0 b) TX bytes:440 (440.0 b)

4. Modify the configuration file of the physical network card

The two physical network ports are: the virtual port bound with eth0,eth2 is: bond0

[root@wjq2 network-scripts] # vim ifcfg-eth0

DEVICE=eth0

TYPE=Ethernet

UUID=adc59d0e-8c6c-4d03-8f98-d77ef5131208

ONBOOT=yes

NM_CONTROLLED=no

BOOTPROTO=none

MASTER=bond0

SLAVE=yes # can not have this field, so you need to boot and execute the ifenslave bond0 eth0 eth2 command.

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME= "System eth0"

HWADDR=00:50:56:b5:4f:f5

[root@wjq2 network-scripts] # vim ifcfg-eth2

DEVICE=eth2

TYPE=Ethernet

UUID=3fca3e29-7fd1-4355-86c2-2f76e43f4d9c

ONBOOT=yes

NM_CONTROLLED=no

BOOTPROTO=none

HWADDR=00:50:56:b5:2d:0f

MASTER=bond0

SLAVE=yes # can not have this field, so you need to boot and execute the ifenslave bond0 eth0 eth2 command.

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME= "System eth2"

5. Configure the logical network card bond0

The ifcfg-bond0 configuration file needs to be created manually

[root@wjq2 network-scripts] # vim ifcfg-bond0

DEVICE=bond0

NAME='System bond0'

TYPE=Ethernet

NM_CONTROLLED=no

USERCTL=no

ONBOOT=yes

BOOTPROTO=none

IPADDR=10.1.1.100

NETMASK=255.255.255.0

GATEWAY=10.1.1.249

6. Load the module to make the system support bonding

If / etc/modprobe.d/modprobe.conf does not exist, you can create it manually or use the / etc/modprobe.d/dist.conf file.

[root@wjq2 ~] # vim / etc/modprobe.d/modprobe.conf

Alias bond0 bonding

Options bond0 miimon=100 mode=0

Description: the link check time for configuring bond0 is 100ms and the mode is 0. (the detailed seven modes of bond are explained in detail at the end.)

7. Load bond module

[root@wjq2 ~] # modprobe bonding

8. View the binding result

[root@wjq2 ~] # cat / proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: load balancing (round-robin)

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eth0

MII Status: up

Speed: 10000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:50:56:b5:4f:f5

Slave queue ID: 0

Slave Interface: eth2

MII Status: up

Speed: 10000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:50:56:b5:2d:0f

Slave queue ID: 0

View the information of physical and logical network cards

[root@wjq2 ~] # ifconfig

Bond0 Link encap:Ethernet HWaddr 00:50:56:B5:4F:F5

Inet addr:10.1.1.100 Bcast:10.1.1.255 Mask:255.255.255.0

Inet6 addr: fe80::250:56ff:feb5:4ff5/64 Scope:Link

UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1

RX packets:903 errors:0 dropped:0 overruns:0 frame:0

TX packets:158 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:0

RX bytes:68972 (67.3 KiB) TX bytes:17037 (16.6 KiB)

Eth0 Link encap:Ethernet HWaddr 00:50:56:B5:4F:F5

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:452 errors:0 dropped:0 overruns:0 frame:0

TX packets:79 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:34507 (33.6KiB) TX bytes:6935 (6.7KiB)

Eth2 Link encap:Ethernet HWaddr 00:50:56:B5:4F:F5

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:451 errors:0 dropped:0 overruns:0 frame:0

TX packets:79 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:34465 (33.6KiB) TX bytes:10102 (9.8KiB)

Lo Link encap:Local Loopback

Inet addr:127.0.0.1 Mask:255.0.0.0

Inet6 addr: 1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:16 errors:0 dropped:0 overruns:0 frame:0

TX packets:16 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:0

RX bytes:960 (960.0 b) TX bytes:960 (960.0 b)

9. Test bond

Due to the use of mode=0, load balancing, we ping114.114.114.114 and then manually disconnect a network card, and the ping will not be interrupted.

[root@wjq2] # ping 114.114.114.114

PING 114.114.114.114 (114.114.114.114) 56 (84) bytes of data.

64 bytes from 114.114.114.114: icmp_seq=1 ttl=59 time=4.46 ms

64 bytes from 114.114.114.114: icmp_seq=1 ttl=59 time=4.56 ms (DUP!)

64 bytes from 114.114.114.114: icmp_seq=2 ttl=59 time=2.21 ms

64 bytes from 114.114.114.114: icmp_seq=2 ttl=59 time=2.28 ms (DUP!)

64 bytes from 114.114.114.114: icmp_seq=3 ttl=59 time=2.23 ms

64 bytes from 114.114.114.114: icmp_seq=3 ttl=59 time=2.24 ms (DUP!)

64 bytes from 114.114.114.114: icmp_seq=4 ttl=59 time=1.94 ms

64 bytes from 114.114.114.114: icmp_seq=4 ttl=59 time=1.94 ms (DUP!)

64 bytes from 114.114.114.114: icmp_seq=5 ttl=59 time=1.95 ms

64 bytes from 114.114.114.114: icmp_seq=5 ttl=59 time=1.95 ms (DUP!)

64 bytes from 114.114.114.114: icmp_seq=6 ttl=59 time=2.00 ms

64 bytes from 114.114.114.114: icmp_seq=6 ttl=59 time=2.01 ms (DUP!)

……

Close the eth0 network card manually with another terminal, and ping is not interrupted.

[root@wjq2 ~] # ifdown eth0

64 bytes from 114.114.114.114: icmp_seq=10 ttl=59 time=1.96 ms

64 bytes from 114.114.114.114: icmp_seq=11 ttl=59 time=2.12 ms

64 bytes from 114.114.114.114: icmp_seq=12 ttl=59 time=2.30 ms

64 bytes from 114.114.114.114: icmp_seq=13 ttl=59 time=2.23 ms

64 bytes from 114.114.114.114: icmp_seq=14 ttl=59 time=2.16 ms

64 bytes from 114.114.114.114: icmp_seq=15 ttl=59 time=2.04 ms

64 bytes from 114.114.114.114: icmp_seq=16 ttl=59 time=1.88 ms

Check the bond0 status and find that the eth0 is gone, but the bond is normal (only the Nic information in the UP state is displayed)

[root@wjq2 ~] # cat / proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: load balancing (round-robin)

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eth2

MII Status: up

Speed: 10000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:50:56:b5:2d:0f

Slave queue ID: 0

Then start the eth0 network card and find that there is a recovery of up status.

[root@wjq2 ~] # ifup eth0

[root@wjq2 ~] #

[root@wjq2 ~] # cat / proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: load balancing (round-robin)

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eth0

MII Status: up

Speed: 10000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:50:56:b5:4f:f5

Slave queue ID: 0

Slave Interface: eth2

MII Status: up

Speed: 10000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:50:56:b5:2d:0f

Slave queue ID: 0

3. Expansion (multiple network cards are bound to multiple bond)

Above, two network cards (eth0 and eth2) are bound into a bond0. If we want to set multiple bond ports, such as physical network ports eth0 and eth2 to form bond0,eth3 and eth4 to form bond1,eth5 and eth6 to form bond2, then the setting method of the network port settings file is the same as above, except that the / etc/modprobe.d/dist.conf file cannot be superimposed. There are two ways to set up correctly:

1. The first kind

Alias bond0 bonding

Alias bond1 bonding

Alias bond2 bonding

Options bonding max_bonds=3 miimon=100 mode=0

So all bindings can only use one mode.

2. The second kind

Alias bond0 bonding

Options bond0 miimon=100 mode=0 max_bonds=3

Alias bond1 bonding

Options bond1 miimon=100 mode=1 max_bonds=3

Alias bond2 bonding

Options bond2 miimon=100 mode=2 max_bonds=3

Note: in this way, different bond ports can be set to different mode, pay attention to the setting of automatic boot / etc/rc.d/rc.local file.

Special note: if there is no max_bonds parameter in the options of the configuration file, the following error message will appear: Master 'bond1': Error: handshake with driver failed. Because when you load the bonding module with modprobe, add parameters to specify how many bonding device to create, otherwise only one will be created by default, that is, bond0.

[root@wjq2 ~] # ifenslave bond1 eth3 eth4

Master 'bond1': Error: handshake with driver failed. Aborting

The results of multiple bond are as follows:

[root@wjq2 ~] # ifconfig

Bond0 Link encap:Ethernet HWaddr 00:50:56:B5:4F:F5

Inet addr:10.1.1.100 Bcast:10.1.1.255 Mask:255.255.255.0

Inet6 addr: fe80::250:56ff:feb5:4ff5/64 Scope:Link

UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1

RX packets:2012 errors:0 dropped:0 overruns:0 frame:0

TX packets:160 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:0

RX bytes:153964 (150.3 KiB) TX bytes:20786 (20.2 KiB)

Bond1 Link encap:Ethernet HWaddr 00:50:56:B5:5A:25

Inet addr:10.1.1.101 Bcast:10.1.1.255 Mask:255.255.255.0

Inet6 addr: fe80::250:56ff:feb5:5a25/64 Scope:Link

UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1

RX packets:1806 errors:0 dropped:0 overruns:0 frame:0

TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:0

RX bytes:131984 (128.8 KiB) TX bytes:536 (536.0 b)

Bond2 Link encap:Ethernet HWaddr 00:50:56:B5:0B:EB

Inet addr:10.1.1.102 Bcast:10.1.1.255 Mask:255.255.255.0

Inet6 addr: fe80::250:56ff:feb5:beb/64 Scope:Link

UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1

RX packets:1806 errors:0 dropped:0 overruns:0 frame:0

TX packets:9 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:0

RX bytes:131920 (128.8 KiB) TX bytes:606 (606.0 b)

Eth0 Link encap:Ethernet HWaddr 00:50:56:B5:4F:F5

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:1007 errors:0 dropped:0 overruns:0 frame:0

TX packets:81 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:77033 (75.2 KiB) TX bytes:10939 (10.6 KiB)

Eth2 Link encap:Ethernet HWaddr 00:50:56:B5:4F:F5

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:1005 errors:0 dropped:0 overruns:0 frame:0

TX packets:80 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:76931 (75.1 KiB) TX bytes:10929 (10.6 KiB)

Eth3 Link encap:Ethernet HWaddr 00:50:56:B5:5A:25

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:903 errors:0 dropped:0 overruns:0 frame:0

TX packets:4 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:65983 (64.4 KiB) TX bytes:252 (252.0 b)

Eth4 Link encap:Ethernet HWaddr 00:50:56:B5:5A:25

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:903 errors:0 dropped:0 overruns:0 frame:0

TX packets:4 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:66001 (64.4 KiB) TX bytes:284 (284.0 b)

Eth5 Link encap:Ethernet HWaddr 00:50:56:B5:0B:EB

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:903 errors:0 dropped:0 overruns:0 frame:0

TX packets:5 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:65951 (64.4 KiB) TX bytes:342 (342.0 b)

Eth6 Link encap:Ethernet HWaddr 00:50:56:B5:0B:EB

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:903 errors:0 dropped:0 overruns:0 frame:0

TX packets:4 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:65969 (64.4 KiB) TX bytes:264 (264.0 b)

Lo Link encap:Local Loopback

Inet addr:127.0.0.1 Mask:255.0.0.0

Inet6 addr: 1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:4 errors:0 dropped:0 overruns:0 frame:0

TX packets:4 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:0

RX bytes:240 (240.0 b) TX bytes:240 (240.0 b)

IV. Seven modes of bond

For shared file systems such as samba and nfs, the network throughput is very large, resulting in great pressure on the network card. The network card bond achieves local network card redundancy, bandwidth expansion and load balancing by binding multiple physical network cards into one logical network card. The specific function depends on which mode is adopted.

1. Mode=0 (balance-rr) (balanced cycle strategy)

Link load balancing, increase bandwidth, support fault tolerance, a link failure will automatically switch the normal link. The switch needs to be configured with an aggregation port, and Cisco is called port channel.

Features: the order of transmitting data packets is to transmit in turn (that is, the first packet goes eth0, the next packet goes eth2. . This mode provides load balancing and fault tolerance until the last transmission is completed), but we know that if the packets of a connection or session are sent from different interfaces and pass through different links halfway, the problem of packet disorderly arrival is likely to occur on the client, and disorderly packets need to be re-required to be sent, so that the throughput of the network will decline.

2. Mode=1 (active-backup) (master-backup policy)

This is the active / standby mode. Only one network card is active and the other is a standby standby. All traffic is processed on the active link. If the switch is configured with bundling, it will not work, because the switch sends packets to two network cards, and half of the packets are discarded.

Features: only one device is active, when one goes down and the other is immediately switched to the primary device by backup. The mac address is externally visible, and from the outside, the MAC address of the bond is unique to avoid confusion in the switch (switch).

This mode only provides fault tolerance; thus it can be seen that the advantage of this algorithm is that it can provide high availability of network connections, but its resource utilization is low, only one interface is working, and when there are N network interfaces, the resource utilization rate is 1max N

3. Mode=2 (balance-xor) (balance strategy)

Indicates that the XOR Hash load is shared and cooperates with the aggregation of the switch in a non-negotiated manner. (xmit_hash_policy is required, switch is required to configure port channel)

Features: data packets are transmitted based on the specified transmission HASH policy. The default policy is: (source MAC address XOR destination MAC address)% number of slave. Other transport policies can be specified through the xmit_hash_policy option, which provides load balancing and fault tolerance

4. Mode=3 (broadcast) (broadcast strategy)

Indicates that all packets are sent from all network interfaces, which is uneven, only redundant, but too wasteful of resources. This model applies to the financial industry because they need highly reliable networks and do not allow any problems. It needs to cooperate with the aggregation of the switch in a non-negotiated manner.

Features: transmitting each packet on each slave interface, this mode provides fault tolerance

5. Mode=4 (802.3ad) (IEEE 802.3ad dynamic link aggregation)

Indicates that it supports the 802.3ad protocol and cooperates with the aggregate LACP mode of the switch (requires xmit_hash_policy). The standard requires all devices to aggregate at the same rate and duplex mode, and, like other bonding load balancing modes except balance-rr mode, no connection can use the bandwidth of more than one interface.

Features: create an aggregation group that shares the same speed and duplex settings. Multiple slave work under the same active polymer according to the 802.3ad specification.

The slave election for outbound traffic is based on the transport hash policy, which can be changed from the default XOR policy to other policies through the xmit_hash_policy option. It should be noted that not all transmission strategies are 802.3ad adaptive, especially considering the packet disorder mentioned in section 43.2.4 of 802.3ad standard. Different implementations may have different adaptations.

Necessary conditions:

Conditional 1:ethtool supports getting the rate and duplex settings for each slave

Conditional 2:switch (switch) supports IEEE 802.3ad Dynamic link aggregation

Condition 3: most switch (switches) require specific configuration to support 802.3ad mode

6. Mode=5 (balance-tlb) (adapter transmission load balancing)

The slave is selected to send according to the load of each slave, and the current slave is used when receiving. This mode requires some ethtool support for the network device driver of the slave interface; and ARP monitoring is not available.

Features: do not need any special switch (switch) support channel bonding. Outbound traffic is allocated on each slave based on the current load (based on speed). If the slave that is receiving data fails, another slave takes over the MAC address of the failed slave.

Necessary conditions:

Ethtool supports getting the rate of each slave

7. Mode=6 (balance-alb) (Adapter Adaptive load balancing)

Rlb (receiving load balancing receive load balance) is added to the tlb of 5. No switch (switch) support is required. Receiving load balancing is realized through ARP negotiation.

Features: this mode includes balance-tlb mode, plus receiving load balancing (receive load balance, rlb) for IPV4 traffic, and does not require any switch (switch) support. Receiving load balancing is implemented through ARP negotiation. The bonding driver intercepts the ARP reply sent by the local machine and rewrites the source hardware address to the unique hardware address of a slave in the bond, so that different peers use different hardware addresses to communicate.

Received traffic from the server side is also balanced. When the local ARP request is sent, the bonding driver copies and saves the IP information of the peer from the ARP package. When the ARP reply arrives from the peer, the bonding driver extracts its hardware address and initiates an ARP reply to a slave in the bond.

One of the problems with using ARP negotiation for load balancing is that every time an ARP request is broadcast, the hardware address of bond is used, so after the peer learns this hardware address, all received traffic will flow to the current slave. This problem can be solved by sending updates (ARP replies) to all peers, which contain their unique hardware addresses, causing traffic to be redistributed.

Received traffic is also redistributed when a new slave is added to the bond, or when an inactive slave is reactivated. The received load is sequentially distributed (round robin) on the fastest slave in the bond

When a link is reconnected, or a new slave is added to the bond, received traffic is redistributed across all currently active slave, and an ARP reply is initiated for each client using the specified MAC address. The updelay parameter described below must be set to a value greater than or equal to the switch (switch) forwarding delay to ensure that ARP replies sent to the peer will not be blocked by switch (switch).

Necessary conditions:

Conditional 1:ethtool supports getting the rate of each slave

Condition 2: the underlying driver supports setting the hardware address of a device, so that there is always a slave (curr_active_slave) using the hardware address of bond, while ensuring that the slave in each bond has a unique hardware address. If curr_active_slave fails, its hardware address will be taken over by the newly selected curr_active_slave

In fact, the difference between mod=6 and mod=0: mod=6, first full of eth0 traffic, and then occupy eth2, … EthX; and mod=0, you will find that the traffic of both ports is very stable, basically the same bandwidth. And mod=6, you will find that the first port traffic is very high, the second port only accounts for a small part of the traffic.

Mode5 and mode6 do not need to be set on the switch side, and the network card can be aggregated automatically. Mode4 needs to support 802.3ad. Mode0,mode2 and mode3 theoretically require static aggregation. However, in the actual measurement, mode0 can receive unevenly through mac address spoofing when the switch is not set up.

After reading the above, have you mastered how to configure the dual Nic binding bond under Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report