OpenMPTCProuter is an open source project which aimed to aggregate multiple internet connections into a single one which results higher bandwidth, failover, security and latency optimization. It uses MPTCP under the hood. So if you have multiple internet connections (Fiber, ADSL, VDSL, 3G, 4G, 5G…) which you are currently using only for load balancing or failover purpose, you can now bond those connections and get maximum throughput.

You can setup OpenMPTCProuter in various devices. In this tutorial I will show you how to setup it in Raspberry Pi 4B (RPI4). I will also use a managed switch (TL-SG108E) for VLAN functionality. The primary purpose of using VLAN is to reduce wiring and utlize single network interface of RPI4.

If you want to follow this tutorial, you need following things:

  1. Raspberry Pi 4 (2GB RAM will suffice)
  2. Any managed switch. I will use TL-SG108E
  3. KVM VPS (Debian 10. At least 1 GB RAM & 1 vCPU). Choose any provider listed here. Make sure the location is closest to you and doesn’t have any transfer limitation
  4. At least 2 internet connections for aggregate. In my case, I will aggregate two ISP
  5. Access point (AP) or router
  6. Wiring done by at least CAT-5e/Cat-6 cables

That’s it, we don’t need any ethernet adapters for our Raspberry PI 4. We will use VLAN in our switch for sending different traffics to PI’s physical network interface.

Here how our setup will look like at the end

<img class="aligncenter size-full wp-image-920" src="/uploads/2022/02/openmptcprouter2.png" alt="" width="816" height="421" srcset="/uploads/2022/02/openmptcprouter2.png 816w, /uploads/2022/02/openmptcprouter2-768x396.png 768w" sizes="(max-width: 816px) 100vw, 816px" /> Maybe I threw you off a bit but don’t worry, I will explain what is going on in above picture along the way. One of the most important component here is switch. All the end devices are point to the switch. I don’t know why but the setup reminds me this meme. Lol

<img class="aligncenter size-full wp-image-921" src="/uploads/2022/02/spidey.png" alt="" width="781" height="712" srcset="/uploads/2022/02/spidey.png 781w, /uploads/2022/02/spidey-768x700.png 768w" sizes="(max-width: 781px) 100vw, 781px" />

Anyway, back to the game. Let’s begin

Setup VPS

First, we will setup VPS. Aggregation/bonding will happen in VPS side. Follow this guide for setting up VPS for OpenMPTCProuter. The script will do all the heavy lifting for you so don’t worry. The script is meant to be run as root in a clean VPS (no 3rd party packages are installed). Also reboot when done. You will find some keys after installation in
/root/openmptcprouter_config.txt file. Note down the keys. We need those later.

Setup OpenMPTCProuter in Rpi4

Head over to the official OpenMPTCProuter site and download ext4 image (openmptcprouter——rpi4-sysupgrade.img.gz) for Raspberry PI 4B. Download Raspberry Pi Imager or balenaEtcher to flash the ext4 image in microSD card. Put the card into Rpi4.

part 1 – setup switch

Now we will setup switch. Mostly we will setup VLAN. Since I am using TP-Link TL-SG108E (v6.6), there are 8 gigabit ports. I will use port 1 & 2 for wan connections (ISP 1 & ISP 2) and port 3 to 8 for LAN devices.

Connections:

First, connect the switch as below diagram

  • ISP 1 cable to port 1
  • ISP 2 cable to port 2
  • A cable from RPI4’s physical interface to port 3
  • A cable from your PC to port 7 (or any port from 4 to 8)

<img class="aligncenter size-medium wp-image-924" src="/uploads/2022/02/openmptcprouter3.png" alt="" width="1956" height="946" srcset="/uploads/2022/02/openmptcprouter3.png 1956w, /uploads/2022/02/openmptcprouter3-768x371.png 768w, /uploads/2022/02/openmptcprouter3-1536x743.png 1536w" sizes="(max-width: 1956px) 100vw, 1956px" />

It looks like this in my side. Note: my RPI4 is enclosed with Argon ONE M.2 case so it looks different 😀

<img class="aligncenter size-full wp-image-929" src="/uploads/2022/02/2022-02-13-09-14-03-scaled.jpg" alt="" width="2560" height="1152" srcset="/uploads/2022/02/2022-02-13-09-14-03-scaled.jpg 2560w, /uploads/2022/02/2022-02-13-09-14-03-768x346.jpg 768w, /uploads/2022/02/2022-02-13-09-14-03-1536x691.jpg 1536w, /uploads/2022/02/2022-02-13-09-14-03-2048x922.jpg 2048w" sizes="(max-width: 2560px) 100vw, 2560px" />

Now power up both switch and RPI4, wait a minute. Now visit the following url from your PC: http://192.168.100.1 You should see a login page

<img class="aligncenter size-full wp-image-925" src="/uploads/2022/02/router1.png" alt="" width="2312" height="849" srcset="/uploads/2022/02/router1.png 2312w, /uploads/2022/02/router1-768x282.png 768w, /uploads/2022/02/router1-1536x564.png 1536w, /uploads/2022/02/router1-2048x752.png 2048w" sizes="(max-width: 2312px) 100vw, 2312px" />

There is no password set at the beginning. Simply click login. Next, go to System > Administration and set a password and click save.

<img class="aligncenter size-full wp-image-926" src="/uploads/2022/02/router2.png" alt="" width="2134" height="895" srcset="/uploads/2022/02/router2.png 2134w, /uploads/2022/02/router2-768x322.png 768w, /uploads/2022/02/router2-1536x644.png 1536w, /uploads/2022/02/router2-2048x859.png 2048w" sizes="(max-width: 2134px) 100vw, 2134px" />

Now go to Status > Overview page. Here you should see your switch IP address.

<img class="aligncenter size-full wp-image-927" src="/uploads/2022/02/switch1.png" alt="" width="2308" height="1008" srcset="/uploads/2022/02/switch1.png 2308w, /uploads/2022/02/switch1-768x335.png 768w, /uploads/2022/02/switch1-1536x671.png 1536w, /uploads/2022/02/switch1-2048x894.png 2048w" sizes="(max-width: 2308px) 100vw, 2308px" />

Visit that address and login to your switch. For me, the default password is admin.

<img class="aligncenter size-full wp-image-928" src="/uploads/2022/02/switch2.png" alt="" width="673" height="504" />

Now go to VLAN > 802.1Q VLAN. Enable the configuration and click Apply

<img class="aligncenter size-full wp-image-930" src="/uploads/2022/02/switch3.png" alt="" width="1833" height="729" srcset="/uploads/2022/02/switch3.png 1833w, /uploads/2022/02/switch3-768x305.png 768w, /uploads/2022/02/switch3-1536x611.png 1536w" sizes="(max-width: 1833px) 100vw, 1833px" />

Next we need to configure the VLAN. Put VLAN ID 10, VLAN Name set to ISP1 (or any name). Since I will use port 1 for ISP1, so untagged port 1 and tagged port 3. Click Add/Modify. So for VLAN ID 10, the result will look like this:

<img class="aligncenter size-full wp-image-931" src="/uploads/2022/02/switch4.png" alt="" width="1066" height="603" srcset="/uploads/2022/02/switch4.png 1066w, /uploads/2022/02/switch4-768x434.png 768w" sizes="(max-width: 1066px) 100vw, 1066px" />

We configured port 1 & port 3 in way that they are in same (V)LAN. We will do similar configuration for ISP2. So I put 20 as VLAN ID for ISP2, name can be ISP2 or anything. Next again, untagged port 2 and tagged port 3. Click Add/Modify. So here how it looks like

<img class="aligncenter size-full wp-image-932" src="/uploads/2022/02/switch5.png" alt="" width="1060" height="596" srcset="/uploads/2022/02/switch5.png 1060w, /uploads/2022/02/switch5-768x432.png 768w" sizes="(max-width: 1060px) 100vw, 1060px" />

Here, traffic from port 2 will pass to port 3. So port 3 now getting traffic from both port 1 and port 2. Got the picture? Great! Let’s move on.

Now we need to setup VLAN for LAN devices. So put 1 as VLAN ID, name it anything and keep port 1 and 2 not member and port 3 to 8 untagged.

<img class="aligncenter size-full wp-image-933" src="/uploads/2022/02/switch6.png" alt="" width="1046" height="599" srcset="/uploads/2022/02/switch6.png 1046w, /uploads/2022/02/switch6-768x440.png 768w" sizes="(max-width: 1046px) 100vw, 1046px" />

Since port 3 have traffic for both ISP1 and ISP2, we untagged/merge other ports with it. Now port 3 can share traffic with others. Make sense? Nice! Here is the final result

<img class="aligncenter size-full wp-image-935" src="/uploads/2022/02/switch7.png" alt="" width="1054" height="829" srcset="/uploads/2022/02/switch7.png 1054w, /uploads/2022/02/switch7-768x604.png 768w" sizes="(max-width: 1054px) 100vw, 1054px" />

So to recap:

  • port 1     –> VLAN 10 (For ISP1)
  • port 2     –> VLAN 20 (For ISP2)
  • port 3-8  –> VLAN 1  (For LAN devices)

NOTE: For some switches, port 1 & 2 needs to be tagged instead of untagged. In TL-SG108E (v6.6) switch, I had to untagged port 1 & 2 in order to make things work. For you mileage may vary. So play around with tagged and untagged and see which one works for you.

Let’s move on to next setup. Go to VLAN > 802.1Q PVID Setting, put 10 in PVID field and select port 1. Click Apply.

<img class="aligncenter size-full wp-image-936" src="/uploads/2022/02/switch8.png" alt="" width="1561" height="759" srcset="/uploads/2022/02/switch8.png 1561w, /uploads/2022/02/switch8-768x373.png 768w, /uploads/2022/02/switch8-1536x747.png 1536w" sizes="(max-width: 1561px) 100vw, 1561px" />

Similarly, put 20 as PVID, select port 2 and click Apply.
<img class="aligncenter size-medium wp-image-937" src="/uploads/2022/02/switch9.png" alt="" width="1038" height="633" srcset="/uploads/2022/02/switch9.png 1038w, /uploads/2022/02/switch9-768x468.png 768w" sizes="(max-width: 1038px) 100vw, 1038px" />

Here is our final result. Port 1 & 2 can now be identified with ID 10 & 20 respectively.

<img class="aligncenter size-medium wp-image-938" src="/uploads/2022/02/switch10.png" alt="" width="1109" height="706" srcset="/uploads/2022/02/switch10.png 1109w, /uploads/2022/02/switch10-768x489.png 768w" sizes="(max-width: 1109px) 100vw, 1109px" />

That concludes switch setup. However we are not done yet 😀 Le’ts take a short coffee break and move on to the next part 😀

part 2 – setup interfaces in router

Previously, we logged in to router, So open the router tab again and navigate to Network > Interfaces. Delete default WAN1 and WAN2 interfaces. Leave LAN, OMRVPN & OMR6IN4 as it is. Save & Apply.

<img class="aligncenter size-full wp-image-940" src="/uploads/2022/02/router3.png" alt="" width="1987" height="1041" srcset="/uploads/2022/02/router3.png 1987w, /uploads/2022/02/router3-768x402.png 768w, /uploads/2022/02/router3-1536x805.png 1536w" sizes="(max-width: 1987px) 100vw, 1987px" />

Click Add new Interface. Name anything you like. Set correct protocol. For my ISP1, it is DHCP. Next set interface type as normal. As for interface, type eth0.10. Let’s break it down why it is eth0.10.

eth0 is the physical interface of RPI4. We set VLAN ID 10 in our switch for port 1. Now in order to access port 1 from RPI4, we need to type eth0.10. Here 10 is…yeah you guessed it right, VLAN ID. That’s how we can access port 1 in switch from router.

<img class="aligncenter size-full wp-image-941" src="/uploads/2022/02/router4.png" alt="" width="1339" height="796" srcset="/uploads/2022/02/router4.png 1339w, /uploads/2022/02/router4-768x457.png 768w" sizes="(max-width: 1339px) 100vw, 1339px" />

Click create interface. Make sure to add this interface in wan firewall. Click save.

<img class="aligncenter size-full wp-image-943" src="/uploads/2022/02/router5.png" alt="" width="1363" height="426" srcset="/uploads/2022/02/router5.png 1363w, /uploads/2022/02/router5-768x240.png 768w" sizes="(max-width: 1363px) 100vw, 1363px" />

Similarly for ISP2, add another interface. For me, the protocol will be PPPoE so I selected the correct protocol and put username password. As for interface, type eth0.20. We are accessing port 2 in our switch where VLAN ID is 20. Click create/save.

<img class="aligncenter size-full wp-image-944" src="/uploads/2022/02/router7.png" alt="" width="1347" height="907" srcset="/uploads/2022/02/router7.png 1347w, /uploads/2022/02/router7-768x517.png 768w" sizes="(max-width: 1347px) 100vw, 1347px" />

Also attach this interface to wan in firewall settings. Click save. Finally click save and apply for applying all the changes that we made.

<img class="aligncenter size-full wp-image-945" src="/uploads/2022/02/router8.png" alt="" width="1348" height="427" srcset="/uploads/2022/02/router8.png 1348w, /uploads/2022/02/router8-768x243.png 768w" sizes="(max-width: 1348px) 100vw, 1348px" />

Finally, both interfaces should up. As you can see below both got IPv4 address. All good!

<img class="aligncenter size-full wp-image-946" src="/uploads/2022/02/router9.png" alt="" width="1909" height="1225" srcset="/uploads/2022/02/router9.png 1909w, /uploads/2022/02/router9-768x493.png 768w, /uploads/2022/02/router9-1536x986.png 1536w" sizes="(max-width: 1909px) 100vw, 1909px" />

part 3 – setup OpenMPTCProuter

This is our final step. In this step we will setup OpenMPTCProuter. Remember I told you to note the keys after setting up VPS? We will utilize those keys here. First go to System > OpenMPTCProuter

<img class="aligncenter size-full wp-image-947" src="/uploads/2022/02/router10.png" alt="" width="1731" height="1086" srcset="/uploads/2022/02/router10.png 1731w, /uploads/2022/02/router10-768x482.png 768w, /uploads/2022/02/router10-1536x964.png 1536w" sizes="(max-width: 1731px) 100vw, 1731px" /> Put your server IP. Default username is openmptcprouter. Get server key from your note and paste corresponding field.

<img class="aligncenter size-full wp-image-948" src="/uploads/2022/02/router11.png" alt="" width="1343" height="1011" srcset="/uploads/2022/02/router11.png 1343w, /uploads/2022/02/router11-768x578.png 768w" sizes="(max-width: 1343px) 100vw, 1343px" />

Scroll down a bit. You need to setup Multipath TCP to either master or enabled for ISP1 or ISP2. I set ISP1 as Master as it gives me stable bandwidth. I put other as Enabled.

<img class="aligncenter size-full wp-image-951" src="/uploads/2022/02/router12.png" alt="" width="1911" height="1990" srcset="/uploads/2022/02/router12.png 1911w, /uploads/2022/02/router12-768x800.png 768w, /uploads/2022/02/router12-1475x1536.png 1475w" sizes="(max-width: 1911px) 100vw, 1911px" />

Click Save and apply from bottom.

If all goes well, you should see this screen

<img class="aligncenter size-full wp-image-952" src="/uploads/2022/02/router13.png" alt="" width="1587" height="1170" srcset="/uploads/2022/02/router13.png 1587w, /uploads/2022/02/router13-768x566.png 768w, /uploads/2022/02/router13-1536x1132.png 1536w" sizes="(max-width: 1587px) 100vw, 1587px" />

 

Test

Let’s test our setup. I get avg 60 Mb/s from ISP1 and 50 Mb/s from ISP2. Now I should get nearly 100+ Mb/s right? Let’s test our speed from speedtest.net

<img class="aligncenter size-full wp-image-953" src="/uploads/2022/02/result1.png" alt="" width="1118" height="668" srcset="/uploads/2022/02/result1.png 1118w, /uploads/2022/02/result1-768x459.png 768w" sizes="(max-width: 1118px) 100vw, 1118px" />

Getting nearly 100 Mb/s 😀 😀 Perfect! Let’s test download speed with IDM

<img class="aligncenter size-medium wp-image-954" src="/uploads/2022/02/result2.png" alt="" width="877" height="666" srcset="/uploads/2022/02/result2.png 877w, /uploads/2022/02/result2-768x583.png 768w" sizes="(max-width: 877px) 100vw, 877px" /> Marvellous! 😀 😀

Now you can connect your normal router/AP with switch (connect with any LAN port). Router should be in DHCP so that it can grab IP from OpenMPTCProuter device/RPI4. In that way we can share our combined internet speed to other end devices.

Profit!