The method of XOR bonding, also known as balance-xor, is another form of link aggregation that can be used on MikroTik devices running RouterOS.
This method combines multiple physical network links to act as a single logical link. Unlike LACP (802.3ad), xor-balance uses a load balancing strategy based on the logical “exclusive OR” (XOR) operator applied to the source and destination MAC addresses.
At the end of the article you will find a small test that will allow you assess the knowledge acquired in this reading
How It Works
The balance-xor method uses the XOR operator to make load balancing decisions. Specifically, the source and destination MAC addresses are used as inputs for the XOR operation.
The result determines which physical interface in the bonding group will be used to transmit a data packet. This technique allows for more rudimentary load balancing compared to 802.3ad, but has the advantage of being simpler to configure and not requiring compatible hardware at the other end of the link.
Previous requirements
- Two or more Ethernet interfaces on a MikroTik device.
- RouterOS installed on the MikroTik device.
Configuration in MikroTik RouterOS
- Access to the MikroTik device: Use Winbox or access the device's web interface.
- Navigate to Interfaces: Go to the interfaces section to see all the available ones.
- Create the Bonding Interface:
- Click the button + and choose Bonding.
- In the window that appears, go to the tab General.
- Set a name for the interface.
- In the Bonding, choose the Fashion as balance-xor.
- Add ports to the Bonding Interface:
- In the same Bonding configuration window, look for the option Slaves.
- Add the Ethernet interfaces that you want to group.
Important data
- Load balancing: Although balance-xor is simpler than 802.3ad, its effectiveness may be less if traffic originates and terminates on a very small number of MAC addresses.
- Fault tolerance: As with other bonding methods, if a link fails, traffic will automatically be redistributed among the remaining links.
- Compatibility: LACP support is not required at the other end of the link to use balance-xor.
Limitations
- Limited Number of Ports: As with other methods, the number of ports you can group is usually limited.
Practical applications
El XOR bonding (balance-xor) It is used in various situations to improve network performance and provide some level of redundancy. Here are some practical applications:
1. Load Balancing
The main use of balance-xor is to balance traffic across multiple physical interfaces. This is primarily done to optimize network resource usage and ensure that no interface is overloaded while others are idle. It's especially useful when you have multiple connections of similar bandwidth and want to distribute traffic evenly.
2. Performance Improvement
Although balance-xor will not increase bandwidth for a single network connection, it can improve overall network performance by allowing multiple data streams to use different physical interfaces. This is useful in environments where there are many parallel data flows, such as in a data center or on an enterprise network.
3. Redundancy
Another advantage of using balance-xor is that it provides redundancy in the event of a link failure. If one of the physical interfaces fails, traffic will automatically be sent through the interfaces that are still active. However, keep in mind that this does not provide a completely failover mechanism, but it is better than having no redundancy at all.
4. Server Environments
In a server environment with multiple network connections, balance-xor can be useful to distribute the load across connections and provide redundancy. This is common in web servers, databases, and other systems that handle large volumes of incoming and outgoing connections.
5. Connections with Multiple ISPs
If your network is connected to the Internet through multiple ISPs, you can use balance-xor to balance outgoing traffic between connections. This can help maximize available bandwidth and provide a basic level of redundancy.
6. Long Distance Links
For long distance connections where downtime is critical, XOR bonding can offer a method to maintain the connection even if one of the links fails.
7. Streaming and Multimedia
For applications that require real-time data transmission such as VoIP or video streaming, balance-xor can help ensure that bandwidth is used efficiently, although it is not the best option for this type of traffic compared to others. more advanced load balancing and QoS methods.
Basic example of how to configure XOR (balance-xor) bonding in MikroTik.
Let's imagine that you have two Ethernet interfaces on your MikroTik device, ether1 y ether2, and you want to group them using the balance-xor method.
Steps to configure Bonding XOR in MikroTik CLI:
- Access the MikroTik Router via CLI: Use SSH or direct terminal to access the router.
- Create a bonding interface:
/interface bonding add name=bonding-xor mode=balance-xor
- Add the 'slave' interfaces to the bonding:
/interface bonding set bonding-xor slaves=ether1,ether2
- (Optional) Configure an IP address for the bonding interface:
/ip address add address=192.168.1.1/24 interface=bonding-xor
- Verify the configuration:
/interface bonding print
This should display something similar to:
Flags: X - disabled, R - running 0 name="bonding-xor" mtu=1500
mac-address=XX:XX:XX:XX:XX:XX arp=enabled mode=balance-xor primary=none
link-monitoring=mii arp_interval=100ms arp_ip_target="" up-delay=0ms
down-delay=0ms slaves=ether1,ether2 mii-interval=100ms
With these steps, you should have XOR bonding set up and running. the interface bonding-xor now group ether1 y ether2 using the XOR balancing method based on the source and destination MAC addresses.
Limitations
- Not network agnostic: Load balancing is done on a MAC address basis, meaning that traffic between two pairs of MAC addresses will always use the same physical link. This might not be optimal if you have large volumes of traffic between a pair of addresses.
- Does not increase bandwidth for a single connection: Since balancing is done based on MAC address, you cannot increase bandwidth for a single client-server connection. In other words, a single TCP connection will not benefit from greater bandwidth than a single physical interface.
- There may be problems with intermediate switches: Some switches may have trouble handling traffic coming from a balance-xor bonding interface, especially if they have features like Spanning Tree Protocol (STP) enabled.
- Incompatibility with other bonding methods: Cannot be mixed and matched with other bonding methods in the same interface.
Considerations
- Switch Support: Verify that your switch supports the type of bonding you are trying to implement. Not all managed switches have support for all types of bonding.
- Configuration at both ends: Bonding must be configured on both the router and the device at the other end of the link (usually a switch). Make sure the configuration is compatible on both ends.
- Monitoring and Backup: It is crucial to have mechanisms to monitor the status of each link within the bonding to be able to respond quickly if something goes wrong. Also consider having a backup strategy in case of complete bonding failure.
- Test of performance: Before deploying to a production environment, perform performance testing to ensure that bonding is improving link capacity and availability as expected.
- Reserve Connections: While bonding can provide some redundancy, it is not a substitute for a true failover or more advanced load balancing strategy. Consider your needs and whether balance-xor is really the best option for your specific case.
- MAC Addresses and Balancing: If you have many devices with the same MAC address in a VLAN, this can lead to suboptimal balancing. Make sure device MAC addresses are unique to avoid this.
Taking these limitations and considerations into account, you will be able to make a more informed and effective implementation of XOR bonding on your MikroTik network.
Brief knowledge quiz
What do you think of this article?
Do you dare to evaluate your learned knowledge?
Recommended book for this article
Switching and Bridging RouterOS v7 Book
Study material for the MTCSWE Certification Course updated to RouterOS v7
Related Posts
- Layer 2 Misconfigurations: Hardware Offload Limitations on Multiple Bridges
- Layer 2 misconfigurations: LAG interfaces and load balancing
- Layer 2 Misconfigurations: Packet Flow with Hardware Offloading and MAC Learning
- Understanding the Concept of MTU at Layer 2 and Layer 3: Impacts and Considerations
- Bonding Broadcast in MikroTik