TP-Link TL-R470T+ WAN Refresh Script

This is part 3 of 3… See the first post here.

In the first post of this series, I posted a script to login to the router’s web management page. The second post detailed the script that checks the status of each WAN connection.  The script below will refresh the WAN connections as needed.

This script depends on the second script “wan_status.sh”, they should be placed in the same directory. This is the script to call to initiate a full check/refresh cycle.

At a prompt or via cron, you run this script: wan_refresh.sh

$ ./wan_refresh.sh

wan_refresh.sh sources wan_status.sh which sources login.sh

This script assumes two WAN connections. If you have more or less, you’ll have to make the appropriate changes. We use Google’s public DNS servers for the ping tests. This script alternates between the two, which is essential for this to work.

Leave a Reply