Created
January 27, 2018 15:15
-
-
Save aziraphale/6e51b8cb36a239913ad8a46a3b020e2b to your computer and use it in GitHub Desktop.
AAISP line bonding config for a Mikrotik RouterOS router
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: this can't be used directly, but is a good starting point. | |
# Based on a Mikrotik RouterBoard RB450G. | |
# In my setup, one VDSL modem is connected directly to ether2, while the other goes via my core network switch on ether3. | |
# Ports ether3, ether4 and ether5 are bridged into an interface named "LAN", which is where all local traffic would | |
# come from. | |
# This config includes an odd third route rule which I can't explain, but I found that throughput broke when it was removed. | |
# This is based on bonding two lines. More can be bonded by adding more PPPoE-Client interfaces, more firewall/mangle rules, | |
# more routes, and by changing the "nth" parameter of the mangle rules. | |
# Note that this config only defines UPSTREAM traffic bonding; downstream bonding is configured by adjusting the number | |
# of lines selected for each IP address block in http://control.aa.net.uk/. | |
# This just sets the name of ethernet interfaces and is included solely so that later interface names make sense. | |
/interface ethernet | |
set [ find default-name=ether2 ] advertise=100M-full,1000M-half,1000M-full comment="{_4} A&A Ethernet/WAN link" name="A&A Eth" | |
set [ find default-name=ether3 ] comment="{6} Ethernet switch port" name="LAN (Switch)" | |
# Again, you likely don't need or want to include this; it's here for reference only. | |
/interface bridge port | |
add bridge=LAN interface=ether5 | |
add bridge=LAN interface="LAN (Switch)" | |
add bridge=LAN interface=ether4 | |
/interface pppoe-client | |
add allow=pap,chap comment="{0A} A&A PPPoE line" disabled=no interface=LAN keepalive-timeout=10 max-mru=1492 max-mtu=1492 name="A&A PPPoE Line 1" password=************ profile=AAISP1 service-name=AAISP1 user=*****@a.1 | |
add allow=pap,chap comment="{0A} A&A PPPoE line" disabled=no interface="A&A Eth" keepalive-timeout=10 max-mru=1492 max-mtu=1492 name="A&A PPPoE Line 2" password=************ profile=AAISP2 service-name=AAISP2 user=*****@a.2 | |
# Duplicate these rules and adjust the "nth=" parameters if bonding more than 2 lines. "nth" defines the ratio of packets | |
# sent up each line. | |
/ip firewall mangle | |
add action=jump chain=prerouting comment="Jump: BONDING" connection-mark=!no-bonding dst-address=!90.x.x.x/26 dst-address-list=!no-bonding in-interface=LAN jump-target=bonding packet-mark=!no-bonding | |
add action=mark-packet chain=bonding comment="[Bonding] Mark-packet 1st of every 2 (based on UPSTREAM speed differences between lines)" new-packet-mark=bonding-one nth=2,1 passthrough=yes | |
add action=mark-packet chain=bonding comment="[Bonding] Mark-packet 2nd of every 2 packets" new-packet-mark=bonding-two nth=2,2 passthrough=yes | |
add action=mark-routing chain=bonding comment="[Bonding] Mark-route 1st of every 2 packets" new-routing-mark=bonding-one packet-mark=bonding-one passthrough=no | |
add action=mark-routing chain=bonding comment="[Bonding] Mark-route 2nd of every 2 packets" new-routing-mark=bonding-two packet-mark=bonding-two passthrough=no | |
/ip route | |
add check-gateway=ping comment="Bonding: 1st of every 2 packets when both lines up" distance=2 gateway="A&A PPPoE Line 1" routing-mark=bonding-one | |
add check-gateway=ping comment="Bonding: 2nd of every 2 packets when both lines up" distance=3 gateway="A&A PPPoE Line 2" routing-mark=bonding-two | |
add comment="Default to A&A (Not sure why this was needed)" distance=5 gateway="A&A PPPoE Line 2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment