A solution for Teksavvy modem connection drops in FreshTomato

A family member has struggled in past months with an issue where their Teksavvy cable modem’s WAN connection will drop irregularly (usually overnight), cutting their network off from the Internet and necessitating a power-cycle of the connected router. Neither the cable modem or the router appear to be overheating, crashing, or freezing at the time the issue occurs. It is not necessary to reset the cable modem, nor does resolving the modem alone resolve the issue. Nothing useful is noted in the router logs at the time the issue occurs, and a couple of previous tech support calls have yielded very little help in pinpointing the issue’s root cause. Beyond the inconvenience of reaching behind a router to toggle a power switch, the power cycle usually takes 3-4 minutes to complete and also affects local network connectivity between their many household devices while the router is restarting.

Based on some of my previous advice, this family member began using FreshTomato and naturally came calling for a simpler solution within the router’s web config.

With some basic initial troubleshooting, we verified that a DHCP release/renew of the WAN connection on the router was enough to restore connectivity. Though this drastically reduced the time and effort needed to bring the connection back online, we decided to automate the process, using the router’s Scheduler panel to set up a task that ensures the connection stays up wherever possible.

Our solution was a simple bash script that pings a known external IP address or domain (say, Google) every 3 minutes – if the ping fails, the script restarts the router’s WAN service and “bounces” the corresponding interface.

ping -w 2 -c 1 google.com > /dev/null; if [[ $? != 0 ]]; then service wan restart; fi

The -w and -c switches specify a 2-second timeout (we don’t want the command hanging too long) and 1-packet ping (lest we be stuck pinging forever when using the Linux ping command).

This approach has seemingly worked well for the affected individual thus far, but doesn’t come without its own caveats. If the target of the ping experiences issues of its own and stops responding, the router’s WAN connection will stop/restart every 3 minutes as result. As a fail-safe, we can account for this flaw by implementing an OR statement to ping an extra IP/domain and keep the WAN connection up as long as one of the two respond. Alternatively, you can simply tune the frequency of the command to run less frequently – once or twice a day may be sufficient depending on your use case.

Though we made use of FreshTomato’s web config, you could always use a similar approach on any Linux/Unix-based router via crontab (FreshTomato is Busybox-based and doesn’t use cron specifically). I’ve now heard of this issue a few times as it pertains to Teksavvy and hope this post will catch the eye of a few perplexed Googlers as a result – however, this can just as easily apply to any cable modem with the same issue as those described.