A Broadband and ADSL forum. BroadbanterBanter

Welcome to BroadbanterBanter.

You are currently viewing as a guest which gives you limited access to view most discussions and other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today.

Go Back   Home » BroadbanterBanter forum » Newsgroup Discussions » uk.telecom.broadband (UK broadband)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

uk.telecom.broadband (UK broadband) (uk.telecom.broadband) Discussion of broadband services, technology and equipment as provided in the UK. Discussions of specific services based on ADSL, cable modems or other broadband technology are also on-topic. Advertising is not allowed.

Software that will automatically restart your router if adsl connection hangs?



 
 
Thread Tools Display Modes
  #1  
Old May 15th 06, 02:55 PM posted to uk.telecom.broadband
[email protected]
external usenet poster
 
Posts: 16
Default Software that will automatically restart your router if adsl connection hangs?

Hi,

Is there a utility peice of software out there that restarts your
router when if detects that the ADSL connection hangs from your ISP?

Thanks.

  #2  
Old May 15th 06, 03:23 PM posted to uk.telecom.broadband
Tony Hogarty
external usenet poster
 
Posts: 37
Default Software that will automatically restart your router if adsl connection hangs?

On Mon, 15 May 2006 06:55:14 -0700, wrreisen2 wrote:

Hi,

Is there a utility peice of software out there that restarts your router
when if detects that the ADSL connection hangs from your ISP?

Thanks.


Most routers will do this themselves. Normally there is a setting along
the lines of idle timeout and if you set this to zero they will connect
again if they lose the line.

--
Regards
Tony
(Take out the garbage to reply)

  #3  
Old May 15th 06, 04:52 PM posted to uk.telecom.broadband
Nick
external usenet poster
 
Posts: 28
Default Software that will automatically restart your router if adslconnection hangs?

wrote:
Hi,

Is there a utility peice of software out there that restarts your
router when if detects that the ADSL connection hangs from your ISP?

Thanks.

You could always set up a batch file/shell script/etc that pings
somewhere random every minute, and if the ping fails, activates the
'reset' or 'reconnect' feature of the router... you can usually reset
via. the CLI (telnet + an input file should do the trick, IIRC - been a
while since I did this), or a POST or GET form, sent via. a program
called wget.

Since routers are all so different w/rt their web-based control panels &
CLIs, it's hard to give a definite answer - it might work with some, not
with others. The solution will be different for all the different
routers, though... I doubt there's a specific easy-to-use utility out
there, though.

What model of router is it?

If you wanted to be more elegant, you could use SNMP for the monitoring
section... maybe even via. a trap, to avoid the polling. But that's
getting too complex . Of course, a s/w-activated power switch (if such
a thing exists) would be even better, since it'd work whenever the
router freezes up, as well...

So, yes, it's possible - but probably quite a messy job. Automatic
reconnect on the router (as suggested by Tony) is likely to be a lot
easier...

xF,

....Nick
  #4  
Old May 15th 06, 05:14 PM posted to uk.telecom.broadband
Alan J. Flavell
external usenet poster
 
Posts: 126
Default Software that will automatically restart your router if adslconnection hangs?

On Mon, 15 May 2006, Nick wrote:

You could always set up a batch file/shell script/etc that pings
somewhere random every minute, and if the ping fails, activates the
'reset' or 'reconnect' feature of the router...


And if the remote host fails, take care you don't drive your router
demented ;-)

you can usually reset via. the CLI (telnet + an input file should do
the trick, IIRC - been a while since I did this), or a POST or GET
form, sent via. a program called wget.


Yup. I could put in a good word for the flexibility of a Perl script
using Net::Telnet to talk to the router's telnet interface. Can be
done on Windows (I'm using ActiveState Perl, but presumably cygwin
perl would be fine too) as well as on real OSes.

Just at the mo I'm doing that for nothing more than to log the values
of a few parameters (line speed, SNR margin, plusnet gateway IP, etc.)
from my Voyager 205, but the script could just as easily command the
router to take some action if necessary. As long as the router's
telnet server continues to respond, obviously!

Of course, all of these solutions assume that you have a suitable
computer that will be running all the time.
  #5  
Old May 15th 06, 05:28 PM posted to uk.telecom.broadband
Alan J. Flavell
external usenet poster
 
Posts: 126
Default Software that will automatically restart your router if adslconnection hangs?

On Mon, 15 May 2006, Tony Hogarty wrote:

Most routers will do this themselves. Normally there is a setting
along the lines of idle timeout and if you set this to zero they
will connect again if they lose the line.


Yes. But mine was always making one retry, which often failed, and
then giving up.

I found that its first attempt to re-establish the PPP connection
usually got authentication failed. The '205 counted that as its
retry attempt, so then it stopped trying.

See my posting on this group with message-id [1]

for a solution. In practice I'm finding that if it doesn't
succeed at the first try, it now "always" succeeds at the second.

regards

[1] goo-groups can search by message-id too.
  #6  
Old May 15th 06, 07:51 PM posted to uk.telecom.broadband
Alan J. Wylie
external usenet poster
 
Posts: 18
Default Software that will automatically restart your router if adsl connection hangs?

On 15 May 2006 06:55:14 -0700, said:

Hi, Is there a utility peice of software out there that restarts
your router when if detects that the ADSL connection hangs from your
ISP?


Here's some Perl that I've been playing with at home and at work
(being diverted from seeing some friends on Saturday morning to detour
into work to reboot the router provides an incentive to make sure the
ADSL line stays up). I run it from a cron job every 5 minutes.

Work: Vigor2600
Home: SpeedTouch 510

Both of them sometimes need a kick.

Notes: you will need to:
run the script as root if you use ICMP echo requests
change the IP addresses that it pings
change the username and password
change the command to reboot the system
do a bit of tidying up, especially if you are using Windows

Apologies to any Perl hackers out there for the coding style, from an
old fart who still thinks in Algol-60, -68, Fortran and C.

------8------8------8------8------8------8------8------8------8
#! /usr/bin/perl -w

use strict;

use Net::Telnet;
use Net::Ping;
use Sys::Syslog;
use Mail::Mailer;

# RFC1918 IP address of your router
my $localip = "192.168.0.254";

# a list of IP addresses to ping that are 1) few hops away, and 2)
# likely to be stable

# cheapest first
# next IP upstream 0.0.0.0 (from a traceroute)
# Your ISP's DNS servers: 0.0.0.1 & 0.0.0.2
# Your ISP's web server: 0.0.0.3
# i.root-servers.net: 192.36.148.17
# and any others you can think of

my @netips = ("0.0.0.0", "0.0.0.1", "0.0.0.2", "0.0.0.3", "192.36.148.17" );
my $ip;
my $ok = 0;
my $mailer;

my $t; # telnet socket
my $p; # ping

my @lines;
my $i;
my $tmp;

$p = Net::Ping-new("icmp");

# log to syslog
openlog( "routerping", "", "user" );

foreach $ip (@netips)
{
if ( $p-ping($ip) )
{
$ok = 1;
last;
}
else
{
syslog( 'debug', "can't ping %s", $ip );
}
}

if ( ! $ok )
{
syslog( 'debug', "%s", "rebooting router" );

# make sure that there is a route to the ADSL router's local
# IP address
system( "ip route add " . $localip . "/32 dev eth1" );

$t = Net::Telnet-new( Timeout = 10, Prompt = '/ /', Host = $localip );

$t-input_log( "/var/log/router.log" );

# if your router asks for a username and password, use this:
$t-login("Administrator", "zxc314" ) or die "login failed";

# else if it just prompts for a password use this:

$t-waitfor("/Password:/" ) or die "login waitfor 1 failed";
$t-print("fr0gR0utr" ) or die "login print failed";
$t-waitfor("/ /" ) or die "login waitfor 2 failed";

@lines = $t-cmd("adsl status");
# or perhaps
@lines = $t-cmd("adsl info");

$t-print("system reboot");
# or perhaps
$t-print("sys reboot");

$t-close;

$mailer = Mail::Mailer-new("smtp", Server = "localhost") || die "can't new mail";

$mailer-open({ From = 'root',
To = 'root',
Subject= "router reboot",
}) or die "can't open mail";

print $mailer "router reboot";

$mailer-close() || die "can't close mail";
}
------8------8------8------8------8------8------8------8------8

--
Alan J. Wylie
http://www.wylie.me.uk/
"Perfection [in design] is achieved not when there is nothing left to add,
but rather when there is nothing left to take away."
-- Antoine de Saint-Exupery
  #7  
Old May 17th 06, 11:48 AM posted to uk.telecom.broadband
[email protected]
external usenet poster
 
Posts: 16
Default Software that will automatically restart your router if adsl connection hangs?

Thanks for the advice and the script script. I've Installed ActiveState
Perl and will have a go. The router is an Edimax AR-7024-A
http://www.edimax.nl/download/manual/AR-7024_M.zip

The Automatic Reconnect box is checked in the PPP part of "Wan
Configuration" when I click on "Advanced PPP configuration" It isn't
checked there but if I try and check it and Save and Reboot it stays
unchecked.

  #8  
Old May 18th 06, 11:34 AM posted to uk.telecom.broadband
[email protected]
external usenet poster
 
Posts: 16
Default Software that will automatically restart your router if adsl connection hangs?

Thanks for all the advice.

The Script below kindly posted by Alan. J. Wylie

Unfortunately doesn't work in Windows as Sys::Syslog hasn't been ported
to Win32. How would you go about getting something working to do the
job in Windows please?

------8------8------8------8------8------8------8------8------8
#! /usr/bin/perl -w

use strict;

use Net::Telnet;
use Net::Ping;
use Sys::Syslog;
use Mail::Mailer;

# RFC1918 IP address of your router
my $localip = "192.168.0.254";

# a list of IP addresses to ping that are 1) few hops away, and 2)
# likely to be stable

# cheapest first
# next IP upstream 0.0.0.0 (from a traceroute)
# Your ISP's DNS servers: 0.0.0.1 & 0.0.0.2
# Your ISP's web server: 0.0.0.3
# i.root-servers.net: 192.36.148.17
# and any others you can think of

my @netips = ("0.0.0.0", "0.0.0.1", "0.0.0.2", "0.0.0.3",
"192.36.148.17" );
my $ip;
my $ok = 0;
my $mailer;

my $t; # telnet socket
my $p; # ping

my @lines;
my $i;
my $tmp;

$p = Net::Ping-new("icmp");

# log to syslog
openlog( "routerping", "", "user" );

foreach $ip (@netips)
{
if ( $p-ping($ip) )
{
$ok = 1;
last;
}
else
{
syslog( 'debug', "can't ping %s", $ip );
}
}

if ( ! $ok )
{
syslog( 'debug', "%s", "rebooting router" );

# make sure that there is a route to the ADSL router's local
# IP address
system( "ip route add " . $localip . "/32 dev eth1" );

$t = Net::Telnet-new( Timeout = 10, Prompt = '/ /', Host =
$localip );

$t-input_log( "/var/log/router.log" );

# if your router asks for a username and password, use this:
$t-login("Administrator", "zxc314" ) or die "login failed";

# else if it just prompts for a password use this:

$t-waitfor("/Password:/" ) or die "login waitfor 1 failed";
$t-print("fr0gR0utr" ) or die "login print failed";
$t-waitfor("/ /" ) or die "login waitfor 2 failed";

@lines = $t-cmd("adsl status");
# or perhaps
@lines = $t-cmd("adsl info");

$t-print("system reboot");
# or perhaps
$t-print("sys reboot");

$t-close;

$mailer = Mail::Mailer-new("smtp", Server = "localhost") || die
"can't new mail";

$mailer-open({ From = 'root',
To = 'root',
Subject= "router reboot",
}) or die "can't open mail";

print $mailer "router reboot";

$mailer-close() || die "can't close mail";
}
------8------8------8------8------8------8------8------8------8

--
Alan J. Wylie
http://www.wylie.me.uk/
"Perfection [in design] is achieved not when there is nothing left to
add,
but rather when there is nothing left to take away."
-- Antoine de Saint-Exupery

 




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modem dials automatically William uk.comp.home-networking (UK home networking) 2 October 22nd 05 10:33 PM
BT chief hangs up after brawl Irish uk.telecom.broadband (UK broadband) 0 October 31st 04 04:22 AM
Speedtouch 330 hangs PC during Boot Michael Chare uk.telecom.broadband (UK broadband) 3 September 11th 04 10:28 AM
Help anyone? - black screen hangs and ADSL modem prob Antony uk.telecom.broadband (UK broadband) 2 November 2nd 03 08:53 PM
How can I reconnect automatically? [Huge] uk.telecom.broadband (UK broadband) 2 September 12th 03 05:25 PM


All times are GMT +1. The time now is 08:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.Content Relevant URLs by vBSEO 2.4.0
Copyright 2004-2019 BroadbanterBanter.
The comments are property of their posters.