10
Manual:Interface/Bonding From MikroTik Wiki < Manual:Interface Summary Bonding is a technology that allows aggregation of multiple ethernet-like interfaces into a single virtual link, thus getting higher data rates and providing failover. Specifications Packages required: system License required: Level1 Submenu level: /interface bonding Standards and Technologies: None Hardware usage: Not significant Quick Setup Guide Let us assume that we have 2 NICs in each router (Router1 and Router2) and want to get maximum data rate between 2 routers. To make this possible, follow these steps: Make sure that you do not have IP addresses on interfaces which will be enslaved for bonding interface! Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p... 1 z 10 2015-09-28 21:19

Man Mk Bound

Embed Size (px)

DESCRIPTION

Mikrotik Bound

Citation preview

Page 1: Man Mk Bound

Manual:Interface/BondingFrom MikroTik Wiki< Manual:Interface

Summary

Bonding is a technology that allows aggregation of multiple ethernet-like interfaces into a single virtual link,thus getting higher data rates and providing failover.

Specifications

Packages required: systemLicense required: Level1Submenu level: /interface bondingStandards and Technologies: NoneHardware usage: Not significant

Quick Setup Guide

Let us assume that we have 2 NICs in each router (Router1 and Router2) and want to get maximum data ratebetween 2 routers. To make this possible, follow these steps:

Make sure that you do not have IP addresses on interfaces which will be enslaved for bondinginterface!

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

1 z 10 2015-09-28 21:19

Page 2: Man Mk Bound

Add bonding interface on Router1:

And on Router2:

Add addresses to bonding interfaces:

Test the link from Router1:

Link monitoring

It is critical that one of the available link monitoring options is enabled. In the above example, if one of thebonded links were to fail, the bonding driver will still continue to send packets over the failed link whichwill lead to network degradation. Bonding in RouterOS currently supports two schemes for monitoring alink state of slave devices: MII and ARP monitoring. It is not possible to use both methods at the same timedue to restrictions in the bonding driver.

ARP Monitoring

ARP monitoring sends ARP queries and uses the response as an indication that the link is operational. Thisalso gives assurance that traffic is actually flowing over the links. If balance-rr and balance-xor modes areset, then the switch should be configured to evenly distribute packets across all links. Otherwise all repliesfrom the ARP targets will be received on the same link which could cause other links to fail. ARPmonitoring is enabled by setting three properties link-monitoring, arp-ip-targets and arp-interval.Meaning of each option is described later in this article. It is possible to specify multiple ARP targets thatcan be useful in High Availability setups. If only one target is set, the target itself may go down. Havingadditional targets increases the reliability of the ARP monitoring.

Enable ARP monitoring

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

2 z 10 2015-09-28 21:19

Page 3: Man Mk Bound

We will not change arp-interval value in our example, RouterOS sets arp-interval to 100ms by default.

Unplug one of the cables to test if the link monitoring works correctly, you will notice some ping timeoutsuntil arp monitoring detects link failure.

MII monitoring

MII monitoring monitors only the state of the local interface. In RouterOS it is possible to configure MIImonitoring in two ways:

MII Type 1 - device driver determines whether link is up or down. If device driver does not supportthis option then link will appear as always up.MII Type 2 - deprecated calling sequences within the kernel are used to determine if link is up. Thismethod is less efficient but can be used on all devices. This mode should be set only if MII type 1 isnot supported.

Main disadvantage is that MII monitoring can't tell if the link can actually pass packets or not, even if thelink is detected as being up.

MII monitoring is configured by setting the variables link-monitoring mode and mii-interval.

Enable MII Type2 monitoring:

We will leave mii-interval to it's default value (100ms)

When unplugging one of the cables, the failure will be detected almost instantly compared to ARP linkmonitoring.

Bonding modes

802.3ad

802.3ad mode is an IEEE standard also called LACP (Link Aggregation Control Protocol). It includesautomatic configuration of the aggregates, so minimal configuration of the switch is needed. This standardalso mandates that frames will be delivered in order and connections should not see mis-ordering of packets.The standard also mandates that all devices in the aggregate must operate at the same speed and duplexmode and works only with MII link monitoring.

LACP balances outgoing traffic across the active ports based on hashed protocol header information andaccepts incoming traffic from any active port. The hash includes the Ethernet source and destination addressand if available, the VLAN tag, and the IPv4/IPv6 source and destination address. How this is calculated

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

3 z 10 2015-09-28 21:19

Page 4: Man Mk Bound

depends on transmit-hash-policy parameter.

Configuration example

Example connects two ethernet interfaces on a router to the Edimax switch as a single, load balanced andfault tolerant link. More interfaces can be added to increase throughput and fault tolerance. Since frameordering is mandatory on Ethernet links then any traffic between two devices always flows over the samephysical link limiting the maximum speed to that of one interface. The transmit algorithm attempts to use asmuch information as it can to distinguish different traffic flows and balance across the available interfaces.

Router R1 configuration:

Configuration on a switch:

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

4 z 10 2015-09-28 21:19

Page 5: Man Mk Bound

Notice that LACP is enabled on first trunk group (TRK1) and switch ports on first trunk group are boundwith 'v' flag. In our case port 2 and port4 will run LACP.

Verify if LACP is working: On the switch we should first verify if LACP protocol is enabled and running:

After that we can ensure that LACP negotiated with our router. If you don't see both ports on the list thensomething is wrong and LACP is not going to work.

After we verified that switch successfully negotiated LACP with our router, we can start traffic from Client1and Client2 to the Server and check how traffic is evenly forwarded through both bonding slaves:

balance-rr

If this mode is set, packets are transmitted in sequential order from the first available slave to the last.Balance-rr is the only mode that will send packets across multiple interfaces that belong to the same TCP/IPconnection.

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

5 z 10 2015-09-28 21:19

Page 6: Man Mk Bound

When utilizing multiple sending and multiple receiving links, packets are often received out of order, whichresult in segment retransmission, for other protocols such as UDP it is not a problem if client software cantolerate out-of-order packets.If switch is used to aggregate links together, then appropriate switch port configuration is required, howevermany switches do not support balance-rr.Quick setup guide demonstrates use of the balance-rr bonding mode. As you can see, it is quite simple to setup. Balance-rr is also useful for bonding several wireless links, however it requires equal bandwidth for allbonded links. If bandwidth of one bonded link drops, then total bandwidth of bond will be equal to thebandwidth of the slowest bonded link.

active-backup

This mode uses only one active slave to transmit packets. The additional slave only becomes active if theprimary slave fails. The MAC address of the bonding interface is presented onto the active port to avoidconfusing the switch. Active-backup is the best choice in high availability setups with multiple switches thatare interconnected.

balance-xor

This mode balances outgoing traffic across the active ports based on the hashed protocol header informationand accepts incoming traffic from any active port. Mode is very similar to LACP except that it is notstandardized and works with layer-3-and-4 hash policy.

broadcast

When ports are configured with broadcast mode, all slave ports transmit the same packets to the destinationto provide fault tolerance. This mode does not provide load balancing.

balance-tlb

This mode balances outgoing traffic by peer. Each link can be a different speed and duplex mode and nospecific switch configuration is required as for the other modes. Downside of this mode is that only MII linkmonitoring is supported and incoming traffic is not balanced. Incoming traffic will use the link that isconfigured as "primary".

Configuration exampleLets assume than router has two links - ether1 max bandwidth is 10Mbps and ether2 max bandwidth is5Mbps.First link has more bandwidth so we set it as primary link

No additional configuration is required for the switch.

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

6 z 10 2015-09-28 21:19

Page 7: Man Mk Bound

Image above illustrates how balance-tlb mode works. As you can see router can communicate to all theclients connected to the switch with a total bandwidth of both links (15Mbps). But as you already know,balance-tlb is not balancing incoming traffic. In our example clients can communicate to router with totalbandwidth of primary link which is 10Mbps in our configuration.

balance-alb

Mode is basically the same as balance-tlb but incoming traffic is also balanced. Only additional downsideof this mode is that it requires device driver capability to change MAC address. Most of the cheap cards donot support this mode.

Image above illustrates how balance-alb mode works. Compared to balance-tlb mode, traffic fromclients can also use the secondary link to communicate with the router.

Property Description

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

7 z 10 2015-09-28 21:19

Page 8: Man Mk Bound

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

8 z 10 2015-09-28 21:19

Page 9: Man Mk Bound

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

9 z 10 2015-09-28 21:19

Page 10: Man Mk Bound

Notes

Link failure detection and failover is working significantly better with expensive network cards, forexample, made by Intel, then with more cheap ones. On Intel cards for example, failover is taking place inless than a second after link loss, while on some other cards, it may require up to 20 seconds. Also, theActive load balancing (mode=balance-alb) does not work on some cheap cards.

L2 MTU of bonding interface is determined by taking smallest value of all slaves.

See also

Bonding presentation at the MUM (http://wiki.mikrotik.com/images/f/f7/X1-Bondingv01.2006.pdf)Bonding Examples

[ Top | Back to Content ]

Retrieved from "http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&oldid=26937"

This page was last modified on 2 February 2015, at 17:16.This page has been accessed 345,209 times.

Manual:Interface/Bonding - MikroTik Wiki http://wiki.mikrotik.com/index.php?title=Manual:Interface/Bonding&p...

10 z 10 2015-09-28 21:19