View Full Version : monitoring your connection and bringing it back up, What do you use?
alterego
06-07-2004, 12:44 PM
Just wondering what you guys use on your linux machines to monitor the status of your connection, and what you do to re establish it when it dies, hangs, stops responding, etc: ???
Further does anyone have a base script that covers this.
I believe that the "adsl-start" script is supposed to do this for you to some degree, but it seems to fail if the connection just stops responding.
I am unfortunatly "programingly challenged" and even worse for a linux user "bash scripting challenged" so I wouldn't know where to start to roll my own.:(
But if some one has something that works for them I would probably be able to change it enough to suit my system if needed.
I am running fedora core 1
nb1300 (full bridge mode)
rppp0e
Any help would be appreciated
PS.
I do plan to learn some bash scripting and perl in the next six months.:D
mbottrell
06-07-2004, 10:30 PM
I use a simple bash script... :)
It checks every 5 minutes when my line goes down...
Looks like this:
#!/bin/bash
################################################## #
# Simple script to keep trying to bring up our ADSL
################################################## #
FLAG=TRUE
while [ $FLAG != "FALSE" ];
do
if [ -f /var/run/pppoe-adsl.pid.pppoe ];
then
FLAG=FALSE
else
/sbin/adsl-start
sleep 300
fi
done
Seems to do the trick for me. :)
I just manually run it when I notice the system goes down. I have other visual monitors to pickup when the link is up/down. As I work from home, it's no drama to bring it up manually. :)
Cheers,
Matt.
mbottrell
06-07-2004, 10:40 PM
Also note you can use /sbin/adsl-status to check your actual line is up and connected. :)
It will return a status code of 0 if up, and 1 if down.
You'll see it works like such:
$ adsl-status
adsl-status: Link is up and running on interface ppp0
ppp0 Link encap:Point-to-Point Protocol
inet addr:xxx.xxx.xxx.xxx P-t-P:202.154.95.181 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:413387 errors:0 dropped:0 overruns:0 frame:0
TX packets:341645 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:246215054 (234.8 Mb) TX bytes:80400394 (76.6 Mb)
Using adsl-status with the script above will allow you to write a all-in-one link monitoring script. :)
Cheers,
Matt.
alterego
07-07-2004, 09:34 AM
Thanks Matt,
I don't think I have yet made a post that you have not responded to! Where do you find the time?
I appreciate the fact that you are allways helpfull and polite,That can be a rare thing in forums.
What I am actually after is a small script that will incorperate that plus attempt to clear a broken connection and start a new one.
I need this because I look after three seperate remote locations, each more than 100kms from me running swiftdsl and when it goes down I have to ring and guide someone who knows nothing at all about computers (let alone Linux) through the whole process.
Not impossible just annoying! if you know what I mean!
For my connection at home ( which by the way never seems to go down) I can bring it down and up very quickly so it is not a problem.
My guess is that I need the following but I don't know the correct format and syntax to do it.
adsl-status
ping (remote location)
if no response
then adsl stop
adsl start
else if reply from (remote location)
exit
I have started reading up on bash scripting last night. So I might figure it out over the next three weeks or so.
but it would be good if any one could point me in the right direction here, as my boss is sceaming at me now because his connection keeps going down.
Any help will be greatly appreciated.
axcairns
07-07-2004, 11:06 AM
Originally posted by alterego
I don't think I have yet made a post that you have not responded to! Where do you find the time?
I appreciate the fact that you are allways helpfull and polite,That can be a rare thing in forums.
<shameless plug>Maybe you should check out Matt's own forums - he's even MORE helpful there! Check out his (and my) sig for the link.</shameless plug>
Matt, would this work with a modem router? I use a Netcomm NB1300 and connect via a switch. Works great but every now and again it will lose connection and won't reconnect until I switch it on and off. I would love to get something running to check the status of that router and order it to 'reboot' if no connection.
Allan
mbottrell
07-07-2004, 01:07 PM
Possible...
Though the idea of pinging a site - I'm not so sure on...
What happens if that site goes down for maintenance/outage, etc... :confused:
I don't wanna be bouncing the ADSL connection! :eek:
Is there anything wrong with pinging your static ADSL IP or utilising adsl-status to determine if your link is up/down?
Cheers,
Matt.
PS: Yeah, I'll move this over to the Swiftel-Users website (http://swiftel-users.tk/), as I'll be able to upload some files that you can download. Gimme a few days... bit hectic here.... :(
alterego
07-07-2004, 01:46 PM
Matt,
Thanks. I have just been over and registered on the site and will keep an eye out over there. for your reply.
Note though I cannot manually run the checks you talked about, as they are at remote locations and if the link goes down I can't access them.
I would only be pinging the firewall at work which has a historical uptime of around 99.9%
regards,
Dave
simonb
10-08-2004, 01:03 AM
Hi,
I thought I'd comment, just because I was kind of intrigued...
I don't use any separate connection monitoring. My connection has stayed up (ie. fixed itself) without my interference for... maybe 6-9 months now - through swiftel/telstra auth problems, blackouts, etc.
For blackouts, obviously just have it set to turn on when power comes back (in BIOS options).
For the connection itself, I just have all the PPP persistence options set to never give up.
Particularly, I think this means (in the /etc/ppp/peers/dsl-provider file):
persist
maxfail 0
I also have:
lcp-max-configure 1000000
but aren't sure if it's necessary :)
... my connection re-establishes itself within a minutes or two from service resumption, should the line drop out. I don't think it really drops out often on its own. The current host uptime is 42 days, and the connection uptime is about 30 days (it dropped out once since the last reboot).
So, I'm intrigued because I wonder if there is another use for connection monitoring stuff. Back when I was half-bridging, I was getting tempted to write some real sophisticated things (That could also reboot modem), but tried full bridging first, and haven't gone back.
I think the last outage[1] I actually noticed was when swiftel service was down for over 24hrs (in jan/feb? or so).
[[1] With the possible exception of now - I'm here because I'm losing a lot of packets between here and work, and have a high ping (180+ rather than ~30). I think its a swiftel->sprintlink thing though, looking at a traceroute, rather than my connection. ]
Cheers,
- Simon
jok11n
10-08-2004, 09:18 AM
I think how the distro is configured makes a difference, I have been using E-Smith/SME Server for the last 4 years and have only once in that time had to reboot to get a connection back up, never had to manually get connections going at all, connections do drop from time to time of course but the box will try and initiate a connection again within a few seconds and just keeps hammering away until it connects. For this reason I use these SME boxes at 10 different locations that I look after as they are just so simple and so good at maintaining a connection without any hassle.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.