I am doing ping to google and to a dns server, if it does not come back 3 times in 2 minutes, I reboot the router (*)
All done through a "netbooter"..
http://www.synaccess-net.com/. It is completely self contained i.e. independent of anything else
But there are many ways to skin that cat. e.g. an indigo script to test the ping response .. then toggle a insteon/zwave power outlet for the modem/ router one after the other. If you need help don't hesitate to ask.
Karl
(*) using charter as internet provider. It was a weekly occurrence, but they have become better, now it is once per month.