fbpx

Bonding XOR (balance-xor) in MikroTik

Facebook
Twitter
LinkedIn
WhatsApp
Telegram

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

  1. Two or more Ethernet interfaces on a MikroTik device.
  2. RouterOS installed on the MikroTik device.

Configuration in MikroTik RouterOS

  1. Access to the MikroTik device: Use Winbox or access the device's web interface.
  2. Navigate to Interfaces: Go to the interfaces section to see all the available ones.
  3. 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.
  4. 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.
Bonding XOR (balance-xor) in MikroTik

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:

  1. Access the MikroTik Router via CLI: Use SSH or direct terminal to access the router.
  2. Create a bonding interface:
				
					/interface bonding add name=bonding-xor mode=balance-xor 
				
			
  1. Add the 'slave' interfaces to the bonding:
				
					/interface bonding set bonding-xor slaves=ether1,ether2
				
			
  1. (Optional) Configure an IP address for the bonding interface:
				
					/ip address add address=192.168.1.1/24 interface=bonding-xor
				
			
  1. 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

  1. 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.
  2. 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.
  3. 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.
  4. Incompatibility with other bonding methods: Cannot be mixed and matched with other bonding methods in the same interface.

Considerations

  1. 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.
  2. 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.
  3. 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.
  4. Test of performance: Before deploying to a production environment, perform performance testing to ensure that bonding is improving link capacity and availability as expected.
  5. 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.
  6. 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?

QUIZ - Bonding XOR (balance-xor) on MikroTik

Recommended book for this article

Do you want to suggest a topic?

Every week we post new content. Do you want us to talk about something specific?
Topic for the next blog

Leave a comment

Your email address will not be published. Required fields are marked with *

DISCOUNT CODE

AN24-LIB

applies to MikroTik books and book packs

Days
Hours
Minutes
Seconds

Introduction to
OSPF - BGP - MPLS

Sign up for this Free course

MAE-RAV-ROS-240118
Days
Hours
Minutes
Seconds

Sign up for this Free course

MAS-ROS-240111

Promo for Three Kings Day!

KINGS24

15%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the Three Kings Day discount code!

* promotion valid until Sunday January 7, 2024
** the code (KINGS24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

New Year's Eve Promo!

NY24

20%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the New Year's Eve discount code!

* promotion valid until Monday, January 1, 2024
** the code (NY24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

Christmas discounts!

XMAS23

30%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the discount code for Christmas!!!

**codes are applied in the shopping cart
Promo valid until Monday December 25, 2023

CYBER WEEK DISCOUNTS

CW23-MK

17%

all MikroTik OnLine courses

CW23-AX

30%

all Academy courses

CW23-LIB

25%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Cyber ​​Week!!!

**codes are applied in the shopping cart
Promo valid until Sunday December 3, 2023

BLACK FRIDAY DISCOUNTS

BF23-MX

22%

all MikroTik OnLine courses

BF23-AX

35%

all Academy courses

BF23-LIB

30%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Black Friday!!!

**Codes are applied in the shopping cart

codes are applied in the shopping cart
valid until Sunday November 26, 2023

Days
Hours
Minutes
Seconds

Sign up for this Free course

MAE-VPN-SET-231115

Halloween promo

Take advantage of discount codes for Halloween.

Codes are applied in the shopping cart

HW23-MK

11% discount on all MikroTik OnLine courses

11%

HW23-AX

30% discount on all Academy courses

30%

HW23-LIB

25% discount on all MikroTik Books and Book Packs

25%

Register and participate in the free course Introduction to Advanced Routing with MikroTik (MAE-RAV-ROS)

Today (Wednesday) October 11, 2023
7pm to 11pm (Colombia, Ecuador, Peru)

MAE-RAV-ROS-231011