modified on 23 June 2010 at 15:47 ••• 24,206 views

Mikrotik bonding

From Ubiquiti Wiki

Jump to: navigation, search

Contents

Introduction

Bonding is a software mechanisim in which you can aggregate multiple network interfaces to achieve more throughput with a higher level of availability. We will discuss a double link here but keep in mind that more links can be bonded to achieve higher speeds/availability.

A visualization of what we are trying to accomplish: Network Layout Diagram

Requirements

  • 4 Ubiquiti Radios A/B/G/N depending on your application
  • 2 Mikrotik routers with 2 Ethernet ports availible
  • 4 Antennas and proper cables (if using a UBNT devices that don't have them built in)
  • True Layer 2 connectivity between both Mikrotik devices on all links that will be used in the bond
    • This can be accomplished by AP-WDS/STA-WDS on the UBNT devices or by using EoIP within Mikrotik's software. We will discuss the WDS approach.

Configuration

UBNT Devices

Configuration and acess of UBNT Devices is outlined in AirOS-Quick Setup Guide. We will do our configuration through the Web GUI.

A1

  1. Under the wireless tab, set: "Access Point WDS" Mode
  2. Under the network tab, set: Bridge Mode, IP address to 192.168.0.11, Subnet mask to 255.255.255.0 and Gateway to 192.168.0.10
  3. Give the device a descriptive name and change the password

A2

  1. Under the wireless tab, set: "Access Point WDS" Mode
  2. Under the network tab, set: Bridge Mode, IP address to 192.168.0.12, Subnet mask to 255.255.255.0 and Gateway to 192.168.0.10
  3. Give the device a descriptive name and change the password

B1

  1. Under the wireless tab, set: "Station WDS" Mode
  2. Under the network tab, set: Bridge Mode, IP address to 192.168.0.21, Subnet mask to 255.255.255.0 and Gateway to 192.168.0.20
  3. Give the device a descriptive name and change the password

B2

  1. Under the wireless tab, set: "Station WDS" Mode
  2. Under the network tab, set: Bridge Mode, IP address to 192.168.0.22, Subnet mask to 255.255.255.0 and Gateway to 192.168.0.20
  3. Give the device a descriptive name and change the password

Mikrotik Gear

Connecting to your Mikrotik router can be done with Putty or Winbox and is well documented in their Wiki and Manual. This document will explain the command line configuration, which can easily be followed with the Mikrotik GUI (winbox). And to avoid confusion A1 goes to Ether1 and A2 goes to Ether2 and the same for the other tower except replace the A with an B.

Router A

  1. Log into your Mikrotik router
  2. Create a Bonding interface: Here you tell the router which interfaces should be included in the bond. We are going to use round-robin mode, make ether1 and ether2 the slaves and give the interface a name of "bonding1". The different modes are explained in Mikrotik's Wiki/Bonding.
    • /interface bonding add slaves=ether1,ether2 name=bonding1 mode=balance-rr
  3. Assign an IP to the bonding interface. Never assign ip's to the slave interfaces themselves.
    • /ip address add address 192.168.0.10/24 interface=bonding1
  4. Add Link Monitoring so your router knows when a link is having a problem. We will use ARP for link monitoring and tell the router to watch the ARP on 192.168.0.20. An explaniation of the different types of link monitoring can be found at Mikrotik's Wiki/Bonding.
    • /interface bonding set bonding1 link-monitoring=arp arp-ip-targets=192.168.0.20

Router B

  1. Log into your Mikrotik router
  2. Create a Bonding interface: Here you tell the router which interfaces should be included in the bond. We are going to use round-robin mode, make ether1 and ether2 the slaves and give the interface a name of "bonding1". The different modes are explained in Mikrotik's Wiki/Bonding.
    • /interface bonding add slaves=ether1,ether2 name=bonding1 mode=balance-rr
  3. Assign an IP to the bonding interface. Never assign ip's to the slave interfaces themselves.
    • /ip address add address 192.168.0.20/24 interface=bonding1
  4. Add Link Monitoring so your router knows when a link is having a problem. We will use ARP for link monitoring and tell the router to watch the ARP on 192.168.0.10. An explaniation of the different types of link monitoring can be found at Mikrotik's Wiki/Bonding.
    • /interface bonding set bonding1 link-monitoring=arp arp-ip-targets=192.168.0.10

Testing

We need to test and make sure the bonding is working. Follow these steps to insure everything is working properly.

  1. Log into Router A
  2. Run a ping to Router B
    • /ping 192.168.0.20
  3. Run the speed test tool to Router B
    • /tool bandwidth-test 192.168.0.20 direction=receive
               status: running
             duration: 9s
           rx-current: 213.4Mbps
 rx-10-second-average: 69.4Mbps
     rx-total-average: 69.4Mbps
         lost-packets: 0
          random-data: no
            direction: receive
              rx-size: 1500

While the speedtest is running disconnect one of your ether's connected to your UBNT gear, you should get a few missed pings then see something similar to the following.

               status: running
             duration: 8s
           rx-current: 93.3Mbps
 rx-10-second-average: 38.1Mbps
     rx-total-average: 38.1Mbps
         lost-packets: 0
          random-data: no
            direction: receive
              rx-size: 1500

Conclusion

A couple of things I would like to point out here. The total bandwidth achievable here is 2X the speed of the slowest link. Example: Lets say one link does 90 mbit and the other does 80 mbit your total throughput should be around 160 mbit (80 x 2). The bonding configuration outlined here is a half-duplex link. Bonding will work over multi-hop links as long as there is layer 2 connectivity between the endpoints doing the bonding.

--Rebel2234 15:47, 23 June 2010 (UTC)