TPLink Time Load Balancing Guide with B315 LTE Routers

Kosmik

Honorary Master
Joined
Sep 21, 2007
Messages
19,155
Ok so quite a few folks have asked about my home setup with time based routing, so here's a brief guide. I may update as I go so please bear with me.

The Need:

Cost is obviously a factor for folks these days and I wanted to see how best I can leverage my bang for buck. ADSL became a pain with the reduction in copper and local exchange limitations , not to mention Telkom's spotty infrastructure support, Fibre is unavailable at this time and I went the LTE route originally with Telkom 20+20 and the after hours 500Gb. We could cope with this as we did mainly browsing and I played online. Traffic was low except in the case of game downloads which are bigger and bigger every year ( Doom was a whopping 60+ gigs ). Then Telkom decided to can their 500Gb availability and this set the old brain churning. And also along came Rain with the offer of uncapped days and a great off peak uncapped service. Fibre was coming but I was looking at a good couple of months, not to mention a decent 20mbps connection was around R800pm anyway which I really wasn't going to spend.

The Kit:

I already had a B315 with my Telkom contract ( 1 year left to go! ) and I asked a few mates who recently got fibre if they could spare their old routers. One mate obliged, even lent me a huge antennae which I haven't setup yet. So now I had two routers but how to control traffic between them. I looked into devices like a microtek router but it just seemed overkill. I could do software routing by a server I have on my lan but that would require all traffic going to the box and it doing the routing plus my other requirements. I wanted something relatively simple to manage and ideally a nice dedicated separate hardware solution. In steps the TP-LINK R470t+ load balancing router. This little package, and I do mean small, could control multiple connections for me from load balancing, fail over and even bonding as well as qos and traffic optimization. It was also relatively cheap, paid about R650 for it from www.buyanthing.co.za ( free punt chaps, had good service ).

Note: I'm not including a separate switch or dedicated AP but ideally those would be in here too for a clean solution on the lan side and full propagation via wifi and 2.4/5Ghz bands.

The Design:

So basic topology is each router would configured stock standard as per their sim and the load balancer would send traffic, depending on time of day. I stuck to basic network ranges and planned as below:

LAN - 192.168.1.0 range with Load Balancer configured as 192.168.1.1 It also distributed DHCP on the same range between 100-200.
WAN1 Lan - 192.168.2.0 range with the router being 192.168.2.1
WAN2 Lan - 192.168.3.0 range with the router being 192.168.3.1

From the research I did, due to these being LTE the routers were slightly limited, it was required to configure a DMZ on each to allow traffic to the Load Balancer which would impersonate a endpoint on each WAN LAN. I chose the .5 address for my DMZ's and configured as 192.168.2.5 and 192.168.3.5 The loadbalancer would have time groups configured and route the traffic to the respective wans based on time of day.

The Guide

Configure Router 1 - Capped

WAN1Master.JPG

So here is the normal LTE router home screen. If you haven't by now, please ensure your password has been changed from default and you secured the router. First we need to setup the LAN. Strangely on these routers, you find the static lan address and wifi and DHCP

Wan1 - DHCP and IP.JPG

I'm utilizing the wifi direct on the devices so left the dhcp running. Will explain later, now the DMZ.

WAN1DMZ.JPG

Lastly I read that one should disable the firewall to enable these routers to enter a light "bridge" mode as they don't support full bridging but I actually found that I tried both options, one on each router and it had no effect so up to you. I rely on the LoadBalancers firewall which seems more powerful to handle threats. Keep in mind, anything on the LAN of the individual AP's wifi, will be DIRECTLY exposed, hence why I would rather have a dedicated AP lan side but other reasons too.

B315EnableFireWall.JPG

Now repeat the process with the second Router.

WAN2Master.JPG
Wan2 - DHCP and IP.JPG
WAN2DMZ.JPG
B315DisableFireWall.JPG

Like I said, on one of the router I disabled the firewall but both seem to run fine.

Next post, the magic happens.
 
Last edited:

Kosmik

Honorary Master
Joined
Sep 21, 2007
Messages
19,155
The LoadBalancer:

Again, as with any device please ensure you secure it with your own password. This device actually forces you too which is quite nice. If you are unsure where to find the respective options, the first pic in every segment shows the menu path.

Configure the Lan and DHCP
LBLan.JPG
LBLanDHCP.JPG

Next we need to specify that there are TWO wans active. The device allows up to 4 and still keeps a dedicated lan port. On the below page, you can configure the number of WANs by selecting the correct radio button.

LBWans.JPG

Now configure each WAN to match the respective routers. Ensure that you configure it correctly and don't mix them up otherwise you may have a nasty bill shock. And of course ensure you connect the lan cables correctly, each port to each respective router. For me the only critical ports were on the load balancer, I used whatever was conveniant on the router. So for the layman, plug a cable into port 1 of the Load Balancer. It's clearly marked WLAN and is the port on the left most side, next to the power and status LED's. Connect the other end to Router 1 which in my scenario is the router dealing with the CAPPED account. Connect the next port in line to Router 2 which is the off peaked UNCAPPED. You should see lights on both ports on the LoadBalancer. Note the device can take a bit of time for initial startup from a off state. I utilized the three other ports to run my lan devices but as suggested prior, a good point would be to connect a separate switch if your lan is large and a dedicated WIFI AP. They will then talk to the LoadBalancer and be routed correctly for any internet traffic. Now configure the WANs as below, impersonating the respective DMZ ports on the routers. I can use either static or dynamic with this configuration but kept it static.

LBWan1.JPG

LBWan2.JPG

And that should be it from a hardware point. Now we need to configure the time groups and routing. Note there are many many routing and load balancing options for this device but I am using it primarily based on TIME.

The time group configuration is pretty easy. You create a basic rule , giving it a name, specify to which wan port it applies and a time range.

LBTimeRange.JPG

Click Add and see below"

LBPeakTime.JPG
Clicking on the little calendar lets you specify the periods easily.

LBPeakTimeFull.JPG

Repeat the same with the Uncapped Offpeak

LBOffPeakTime.JPG
LBOffPeakTimeFull.JPG

And lastly we set the actual routing
 
Last edited:

Kosmik

Honorary Master
Joined
Sep 21, 2007
Messages
19,155
You can also classify ip ranges if you chose but I haven't gone that far yet. And protocols via service, effectively ports.

IpOptions.JPG

Go to Transmission and select "Policy Routing". Here click add and specify the rules

LBPolicyRouting.JPG

Rule #1

LBPolicyRoutingRule1.JPG

Rule #2

LBPolicyRoutingRule2.JPG
The final routing table should look like this.

LBMasterRoutingTable.JPG

And thats it. You should now be good to go. Just please ensure that the TIME on the device is correct as I setup mine up offline and once plugged in, couldn't work out why the rules were reversing and it was just me being stupid and the system time either not being set or nntp configured. You should be greeted with the below:

LBStatus.JPG

LBStatistics.JPG

And thats all for now, happy trails folks. This setup can obviously apply to ANY type of WAN connections be it LTE, Fibre or Copper. The balancer can actually perform the dial up actions on the Fibre and Copper routers for you and me personally I might expand later with some form of Fibre, especially if the LTE scenarios change and the load balancer can also prioritise traffic ie: gaming etc maybe via fibre.

Current monthly cost with this setup is ~R550 ( R 303 telkom + R250 Rain ). On Rain I run between 25-40Mbps and Telkom 15-22Mbps, netflix streams @ 23Mbps according to my tv which is international traffic.
 
Last edited:

Speedster

Executive Member
Joined
May 2, 2006
Messages
7,797
Thanks for this thread. Really appreciate your effort!

Just to check, are you able to us wifi from one of the LTE routers, or does one then require a separate Wi-Fi router?
 

Kosmik

Honorary Master
Joined
Sep 21, 2007
Messages
19,155
Thanks for this thread. Really appreciate your effort!

Just to check, are you able to us wifi from one of the LTE routers, or does one then require a separate Wi-Fi router?
You can use wifi from a router BUT it will be like a direct out ie: not going through the load balancer. Nothing stopping you from switching between ap's based on time of day but it would be a pain for a permanent wifi item vs a phone. It has advantages though, like I don't want Netflix on my TV to ever go through my capped account so it is pointed directly to the uncapped routers wifi which only has internet between 11pm and 6pm. No bill shock.

But for a full solution, a good ap is cheap, I'm looking at this one from Toto-Link ( https://shop.dbg.co.za/to-a800r.html ) , they have it for about R550 and it can double as your switch for lan devices and covers both 2.4Ghz and 5Ghz spectrums.
 

Attachments

biometrics

Honorary Master
Joined
Aug 7, 2003
Messages
70,932
@Kosmik

My setup is very similar but I want to load balance both WAN ports during the day. So I've got one Time Range and that is 11 pm to 6pm.

My Policy Routing is set up like this:

Capture.PNG

The idea being that both WAN ports will be used during the day and that only Telkom/WAN2 in the evenings. It works to an extent, during the day it mostly uses Rain and at night it uses Telkom. But it doesn't load balance during the day. With the above setup I get this from speedtest.net:

With policy routing.png

When I delete the Policy Routing I get this from speedtest.net:

No policy routing.png

I can see the same from the Interface Stats page (stats cleared before each test):

With policy routing:

Interface stats with policy routing.png

No policy routing:

Interface stats without policy routing.png

I'm in contact with TP-Link support but so far no resolution. They wanted me to not use Policy Routing but rather Load Balancing/Link Backup but that produces the same result.

I've tried changing the Load Balancing settings but it makes no difference, this is my setup:

Capture2.PNG

I'm close to giving up and just waiting for Monday. Then I'll remove the Policy Routing and rely on Rain's spend limit. I want maximum speed god dammit! ;)
 

biometrics

Honorary Master
Joined
Aug 7, 2003
Messages
70,932
My setup:

Antennas:
2 x Poynting XPOL-6-10

LTE Routers:
1 x Huawei B315
1 x Huawei B525

Load Balancer:
1 x TP-Link TL-R470T+

Access Point (I had this old one lying around):
1 x TP-Link TL-WA5110G

16 Port Switch:
1 x D-Link DGS1016A

DSC_0003.jpg

DSC_0002.jpg
 

biometrics

Honorary Master
Joined
Aug 7, 2003
Messages
70,932
Interesting. It should work but I can only thing that there's a conflict between the routing and load balancing policy. I know theres the whole seperate section for loadbalancing.
Yes it's enabled. You can see without the routing policy my speed is more than double.
 
Last edited:

Kosmik

Honorary Master
Joined
Sep 21, 2007
Messages
19,155
Ah, this makes sense.

How does Load Balance feature works?

Actually, Load Balance selects which WAN port is session-based. If you use FTP to download a video, PC will establish only one session with end-point. When you have a lot of sessions with end-points, Load Balance router can assign these connections to different WAN ports according to router’s policy, in this way all the bandwidths of WAN links are in good use to speed up the whole traffic. That is why Load Balance router can aggregate several WAN links together.

Speedtest.net speed test for each test is one single TCP session, so a speedtest.net test could only make use of one single WAN port (one ISP). So the above test mechanism is essentially wrong.
Rather test with a steam download or something. Maybe Free download manager that allows multi streams? They do suggest a correct means via speed test.net but this makes sense to me. I did wonder how it would work with two routers and traffic but all the LB is doing is splitting the packet requests to the endpoint and then re-combining them back to the clients. So yes, a single stream/packet will only leverage one particular port at a time.
 

biometrics

Honorary Master
Joined
Aug 7, 2003
Messages
70,932
Ah, this makes sense.

Rather test with a steam download or something. Maybe Free download manager that allows multi streams? They do suggest a correct means via speed test.net but this makes sense to me. I did wonder how it would work with two routers and traffic but all the LB is doing is splitting the packet requests to the endpoint and then re-combining them back to the clients. So yes, a single stream/packet will only leverage one particular port at a time.
Multi threaded download with Policy Routing enabled, you can see only WAN1 is in use (I paused the download after it started to clear the stats so the downloader shows 540 MB and WAN1 270 MB).

Capture.PNG
 

biometrics

Honorary Master
Joined
Aug 7, 2003
Messages
70,932
Ok then it's definitely not firing. Maybe try flash firmware?
It has the latest SA firmware. Also tried latest US firmware. Same problem. Find it hard to believe no one else has noticed this. Perhaps time based routing is unusual, like Rain Mobile. Anyway, will delete the routing Monday and rely on Rain's spend limit (with photo for evidence).
 

biometrics

Honorary Master
Joined
Aug 7, 2003
Messages
70,932
Left field idea, but something tells me that the 2300_to_1800 rule is breaking things. Maybe try breaking it down to two rules - 11pm until midnight and then midnight until 6pm? I could be totally off, but I won't be totally surprised if that overnight instruction is confusing things.
Will give it a try.

Currently it does stop Rain during the evening. Just doesn't load balance during the day.
 

Speedster

Executive Member
Joined
May 2, 2006
Messages
7,797
Will give it a try.

Currently it does stop Rain during the evening. Just doesn't load balance during the day.
I see you replied before I was able to delete my post. I initially misunderstood how the time-schedule was set up on this device and don't think my suggestion is a good one anymore.
 

biometrics

Honorary Master
Joined
Aug 7, 2003
Messages
70,932
I see you replied before I was able to delete my post. I initially misunderstood how the time-schedule was set up on this device and don't think my suggestion is a good one anymore.
Yeah, it will probably moan if I add two separate routing time rules to the same WAN port.

But I might replace the existing rule with a 00:00-18:00 rules and skip 23:00-00:00.

Worth a try.
 

Kosmik

Honorary Master
Joined
Sep 21, 2007
Messages
19,155
Yeah, it will probably moan if I add two separate routing time rules to the same WAN port.

But I might replace the existing rule with a 00:00-18:00 rules and skip 23:00-00:00.

Worth a try.
It will moan if you try do 2 rules same wan if they cover the extent between them ie a deny and a allow.
 

Speedster

Executive Member
Joined
May 2, 2006
Messages
7,797
Has anyone played around with load-balancing on an OpenWRT / DD-Wrt router? What would be the benefit of using a dedicated load-balancer over this?

For example, could @biometrics have cut out the R470T+ by using the TP-Link TL-WA5110G as a load balancer?
 
Top