======= Bonding ======= .. sidebar:: Contents .. contents:: :depth: 3 :local: Interface Bonding is a network technique that combines multiples physical network interfaces into a single logical interface, often to increase bandwidth, improve fault tolerance, or optimize network performance. It operates at the data link layer of the OSI model, securing interface aggregation whilst keeping communication protocols consistent. In OSDx, bonding configuration is preformed via bonding interfaces. Operational command :osdx:op:`interfaces bonding * show ports` can be used to display miscellaneous information about Bonding interfaces, including bonding mode, hash policy, bonded ports, etc. *Example:* .. code-block:: none admin@osdx# run interfaces bonding bond0 show ports Ethernet Channel Bonding Driver: v6.1.55 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 Peer Notification Delay (ms): 0 Slave Interface: eth1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:a0:26:e2:3c:49 Slave queue ID: 0 Slave Interface: eth0 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:a0:26:e2:3c:48 Slave queue ID: 0 Port Status monitorization ========================== In an interface bonding configuration, a ``port`` refers to a physical network interface that becomes part of a bonded group. This section explains the different monitorization modes for bonded ports available in OSDx. ARP Monitor ----------- In ARP monitor mode, each bonded interface sends periodic ARP requests to a specified IP addres to verify link availability. Responses indicate that the path is operational. This mechanism requires defining both the target IP address and the interval in milliseconds between ARP checks. This can be configured as shown below. .. code-block:: none set interfaces bonding bond0 arp-monitor target 192.168.100.1 set interfaces bonding bond0 arp-monitor interval 100 .. note:: Specifying multiple IP addresses increases the reliability of ARP monitoring. This can be achived by adding more than one :osdx:cfg:`interfaces bonding * arp-monitor target *` configuration command. MII monitoring -------------- This mode only monitors the state of the local interface, with the device driver determining whether the link is up or down. The main disadvantage is that MII monitoring cannot determine network connectivity, even if the link appears to be up. This mechanism requires setting an interval (in milliseconds) to read the port status. This can be configured as shown below. .. code-block:: none set interfaces bonding bond0 miimon 100 Bonding modes ============= Interface bonding offers a strategic approach to network optimization by allowing multiple physical interfaces to function as a single logical link. However, its effectiveness depends on the bonding mode selected, since each has different operational logic, performance characteristics, and fault tolerance capabilities. Bonded interfaces do not work independently. Instead, they operate according to the bonding mode and rules defined by the bond interface. In the section below, we explain the different types of bonding modes available in OSDx, analyzing their roles and configuration. To add an interface to a bond in OSDx, the following configuration command is used :osdx:cfg:`interfaces ethernet * bond-group *` Round-Robin ----------- This mode transmits packets in sequential order, from the first port available to the last. This mode provides load balancing and fault tolerance. This configuration mode requires that the bond-connected switch has its ports grouped into a single logical interface. This mode can be configured as shown below. .. code-block:: none set interfaces bonding bond0 mode round-robin set interfaces ethernet eth0 bond-group bond0 set interfaces ethernet eth1 bond-group bond0 Active-backup ------------- In this mode, only one bond port is active at a time. A different port becomes active when the current port fails. The bond's MAC address is visible only on one port, to prevent the switch from becoming confused. This mode provides fault tolerance and can be configured as shown below. .. code-block:: none set interfaces bonding bond0 mode active-backup set interfaces ethernet eth0 bond-group bond0 set interfaces ethernet eth1 bond-group bond0 Xor-Hash -------- This mode selects the output port based on an XOR hash function, providing load balancing. The parameters used in the XOR hash function can be modified by changing the ``hash-policy``. Different hash-policies are explained in the hash-policy section. This configuration mode requires that the switch connected to the bond has its ports grouped into a single logical interface. This mode can be configured as shown below. .. code-block:: none set interfaces bonding bond0 mode xor-hash set interfaces ethernet eth0 bond-group bond0 set interfaces ethernet eth1 bond-group bond0 Broadcast --------- This mode transmits everything on all bonded interfaces available, providing fault tolerance. This mode can be configured as shown below. .. code-block:: none set interfaces bonding bond0 mode broadcast set interfaces ethernet eth0 bond-group bond0 set interfaces ethernet eth1 bond-group bond0 802.3ad ------- This mode creates aggregation groups that share the same speed and duplex settings. Use all ports in the bond according to the IEEE 802.3ad via LACP (Link Aggregation Control Protocol). This mode requires the bond-connected switch to have its LACP-capable ports grouped. LACP balances outgoing traffic across the active ports using an XOR hash function specified in ``hash-policy``, while accepting incoming traffic from any active port. For this configuration mode, we recommend using MMI monitor. Different hash-policies are explained in the hash-policies section. This mode can be configured as shown below. .. code-block:: none set interfaces bonding bond0 mode 802.3ad set interfaces ethernet eth0 bond-group bond0 set interfaces ethernet eth1 bond-group bond0 Transmit load balance --------------------- This mode supports two ways to transmit load balancing: ``dynamic`` and ``static``. In dynamic mode, outgoing traffic is distributed across bonded interfaces based on their current workload and individual link speed, allowing for real-time optimization. In static mode, traffic distribution remains fixed once assigned (based on an XOR hash function). Different hash-policies are explained in the hash-policy section. Incoming traffic is not balanced and will use the link configured as primary. Each link can have different speed and duplex settings. This mode can be dynamically configured, as shown below, and does not require any special switch support. It is important to note that only MII monitor is supported in this mode. .. code-block:: none set interfaces bonding bond0 mode transmit-load-balance set interfaces ethernet eth0 bond-group bond0 set interfaces ethernet eth1 bond-group bond0 This mode can also be statically configured, as shown below, and does not require any special switch support. .. code-block:: none set interfaces bonding bond0 mode transmit-load-balance set interfaces bonding bond0 disable-dynamic-lb set interfaces ethernet eth0 bond-group bond0 set interfaces ethernet eth1 bond-group bond0 Adaptive load balance --------------------- This mode operates like ``transmit load balance``, but incoming IPv4 traffic is also balanced. This mode can be dynamically configured, as shown below. It is important to note that only MII monitor is supported in this mode. .. code-block:: none set interfaces bonding bond0 mode adaptive-load-balance set interfaces ethernet eth0 bond-group bond0 set interfaces ethernet eth1 bond-group bond0 This mode can also be statically configured, as shown below, and does not require any special switch support. .. code-block:: none set interfaces bonding bond0 mode adaptive-load-balance set interfaces bonding bond0 disable-dynamic-lb set interfaces ethernet eth0 bond-group bond0 set interfaces ethernet eth1 bond-group bond0 Hash-policies ============= Hash policies define how traffic is distributed across bonded interfaces in bonding modes that use hashing, such as ``xor-hash``, ``802.3ad`` or ``transmit-load-balance`` and ``adaptive-load-balance`` in static mode. These policies determine which parameters need to be taken into account for hash calculation. Simply adjust the ``hash-policy`` parameter. Layer 2 ------- Uses source and destination MAC addresses, as well as the packet type ID field, to generate the hash. This algorithm will send all traffic to a particular network peer on the same bonded interface. Layer 2+3 --------- Uses source and destination MAC and IP addresses, as well as the packet type ID field, to generate the hash. This algorithm will send all traffic to a particular network peer on the same bonded interface. Layer 3+4 --------- This policy uses upper layer protocol information when available. It uses source and destination ports, as well as source and destination IP addresses. .. warning:: This algorithm is not fully 802.3ad compliant. In rare cases, mixed fragmented and normal packets from the same connection might get split between network interfaces, causing out-of-order delivery. However, this does not usually have an impact on typical network traffic. To configure the desired hash policy in OSDx, you can use the :osdx:cfg:`interfaces bonding * hash-policy *` configuration command as shown below. By default, the value is set to ``layer2``. .. code-block:: none set interfaces bonding bond0 hash-policy layer2+3 The following table sumarizes the different hash policies. .. dropdown:: **Hash policies**: +-------------------------+----------------------+-----------------+---------------------+----------------+------------------+-------------+----------------+ | | Destination MAC addr | Source MAC addr | Destination IP addr | Source IP addr | Destination Port | Source Port | Packet type ID | +=========================+======================+=================+=====================+================+==================+=============+================+ | Layer 2 | Yes | Yes | No | No | No | No | Yes | +-------------------------+----------------------+-----------------+---------------------+----------------+------------------+-------------+----------------+ | Layer 2+3 | Yes | Yes | Yes | Yes | No | No | Yes | +-------------------------+----------------------+-----------------+---------------------+----------------+------------------+-------------+----------------+ | Layer 3+4 | No | No | Yes | Yes | Yes | Yes | No | +-------------------------+----------------------+-----------------+---------------------+----------------+------------------+-------------+----------------+ Bonding and VLANs ================= OSDx also allows VLANs to be used together with bonding. Enter the following configuration command. :osdx:cfg:`interfaces bonding * vif * address *`. It is important to note that, when using VLANs, you only need to specify the VIF ID in the address configuration command. :doc:`Here `, you can find an example on how to configure VLANs with bonding interfaces. Bonding Interoperability ======================== In OSDx, bonding interfaces are compatible with both Ethernet and WLAN interfaces. However, it is important to note that WLAN interfaces are only supported in station mode. A configuration is shown below by way of example. .. code-block:: none set controllers wlan radios wifi0 band 5GHz set controllers wlan radios wifi0 bandwidth 80MHz set controllers wlan radios wifi0 channel 36 set controllers wlan radios wifi0 mode 802.11a set controllers wlan radios wifi0 mode 802.11ac set controllers wlan radios wifi0 mode 802.11ax set interfaces wlan wlan0 phy wifi0 set interfaces wlan wlan0 type station network 1 security akm psk set interfaces wlan wlan0 type station network 1 security encrypted-passphrase U2FsdGVkX19XLkE83M+8+fXp0fmeVC61212xISymnJI= set interfaces wlan wlan0 type station network 1 security framework rsn set interfaces wlan wlan0 type station network 1 security pairwise-ciphers aes-ccmp set interfaces wlan wlan0 type station network 1 ssid testbond set interfaces wlan wlan0 bond-group bond0 set interfaces bonding bond0 address 192.168.101.1/24 set interfaces bonding bond0 mode active-backup This example shows how to configure ``wlan0`` and add it to a bond interface. It is also posible to include additional WLAN interfaces, such as ``wlan3``, in station mode. Finally, it is important to note that WLAN and ethernet interfaces can be bonded together. Examples ======== :doc:`Here `, you can find different examples of these options. Command Summary =============== .. osdx:cmdtree:: cfg :maxdepth: 3 interfaces bonding .. osdx:cmdtree:: op :maxdepth: 3 interfaces bonding