TP-Link TL-R470T+ Automated Login Script

TP-LINK TL-R470T+The TP-Link TL-R470T+ Load Balance Broadband Router performs mostly as desired and advertised. This is one of the very few load balancing routers under $150, coming in at about $55. As you might expect at that price point, it’s not perfect. One major limiting factor for my application is the limit of 16 (16?!) load balance policy rules. The only major flaw I’ve encountered in my use of this hardware is it’s “Online Detection” service.

The Problem: Online Detection
Determining if each WAN connection is online is an important feature of the router. Without this there would be no reliability. My connections are not the most reliable, hence the need for this router and two ISPs. I was often getting false positives and false negatives in online detection. Both false negatives and false positives are fairly disastrous for my network. I noticed that keeping the servers set to “manual” I would only receive false negatives (connection DOWN.) When I manually updated the settings for Online Detection, I could force the router to correctly refresh the status as long as the server addresses changed. I started using Google’s Public DNS hosts for ping and name resolution (in Online Detection settings) as I couldn’t trust the “Auto” setting. This was partially due to one WAN connection being a private subnet (double NAT).

Online Detection settings page

The Solution: Automatically Update the Settings Every 5 Minutes
It’s crazy I know, but it’s been working for many months now. Requests for help from tech support and community forums received no serious answers. I crafted a couple Bash shell scripts on a local Linux (Ubuntu) machine to run every 5 minutes, automating the change in settings for Online Detection’s servers. This way a WAN connection is incorrectly marked online or offline for no longer than 5 minutes. The single disadvantage I’ve experienced from this method is normal access of the admin web page. The router only allows access to the admin pages from one IP at a time. This means you have to load and make changes between those automated accesses every 5 minutes. The interval can be changed at your discretion of course.

The script below is one part of this solution, it authenticates with the router’s web interface. The following scripts use the cookie generated by this script to access the Online Detection page. I kept the scripts separate for functionality.


This is part 1 of 3… See the next post here.

3 thoughts on “TP-Link TL-R470T+ Automated Login Script”

  1. Are you going to publish further scripts? I am very interested in them as I am having the same problems with false negatives as you are.

    1. Hi there. Obviously I let this fall by the wayside. Now that I see there’s interest, I will post more scripts very soon!

  2. Modified the script a little bit, yet not able to login

    cookie=$(cat cookies.txt | grep -o “COOKIE.*” | cut -f2)
    hash=”$(echo -n “$ADMIN_USER:$ADMIN_PASS:$cookie” | md5sum | cut -f1 -d ‘ ‘ | tr ‘a-z’ ‘A-Z’)”


Leave a Reply