[wellylug] ihug internet problems
David Antliff
david.antliff at gmail.com
Fri Nov 24 14:07:29 NZDT 2006
On Thu, 23 Nov 2006, Roger Young wrote:
> On Thu, 23 Nov 2006 09:26:14 +1300
> Nic Cave-Lynch <nic at tymar.com> wrote:
>
>> What does it do?
>
> I was hoping David might say...
Hi there,
Roger is correct - thanks for plugging my script :)
The script is useful for rebooting a DSL modem when the connection drops
out but the modem isn't able to recover on its own. Typically, one has to
power-cycle or manually reset the modem for the connection to be restored.
This script will handle this automatically.
http://homepages.ihug.co.nz/~david.antliff/scripts/monitor-dsl504g
GPL2 so you're welcome to modify it and redistribute, etc.
The script monitors a URL by 'pinging' it (via TCP, not ICMP) every 60
seconds. The traffic overhead is extremely small. If no response is
received the script goes into an inner poll-loop where it continues to
poll every five seconds. If no response is received for five minutes, the
script telnets to the router and issues the 'reboot' command. The
connection is usually restored within ten minutes of the initial failure.
I use it on a Dlink 504g router. It can probably be easily modified for
other routers/modems.
The script has a few Perl dependencies - easily installable via your
package manager or perhaps via CPAN:
use Net::Telnet;
use Net::Ping;
use Term::ReadKey;
You can configure the timings in the script.
I run the script inside a 'screen' session with this little front-end
script:
#!/bin/bash
# attaches to an existing screen session if one exists, otherwise creates one
if ! screen -x dsl
then
echo "No session present - starting new irc screen session"
screen -S dsl ~/bin/monitor-dsl504g
fi
# EOF
I hope you find it useful.
>>> Jethro Carr <jethro.carr at jethrocarr.com> wrote:
>>>> Not quite the same problem as you, but I'm getting lots of
>>>> disconnections on my ADSL modem and it won't connect until a power
>>>> restart.
>>>>
>>>> _very_ frustrating! Especially when it decides to disconnect when I'm
>>>> trying to work on another box via SSH. :-/
Jethro, it should solve your problem, at least as far as restoring the
connection automatically.
--
David.
More information about the wellylug
mailing list