detect lost ppp connection
hey folks!
i make a connection with the company through a pptp connection. They have the server, i'm the client... sometimes, i loose my connection (every 4 days). i don't know why... does someone has a script (cron?) to detect when connection has been lost and to reconnect over ppp? now, i use 'pon companyname' to connect and use ifconfig to check connectivity... thx! |
It'd be pretty trivial to throw together a small shell script which could be called from cron to check the network status, I've used fping (www.fping.com ) to do pretty much this same thing (can't use normal ping on this one as we need (preferably) an easy way to get the results back to the shellscript..fping does this nicely ;)
Install fping, then create a shell script: Code:
#!/bin/bash |
I suggest you take a look at /etc/ppp/options.
Specifically, these options: persist maxfail holdoff Here's a nice description: http://www.linux.com/guides/nag2/x7297.shtml You can put these options in the relevant peers file rather than specifying it globaly in 'options'. |
hey guys, thx for the solutions!
the persist option was allready there in my peers file, i add the other ones too! maxfail 0 holdoff 20 to be sure this goddamn connection never goes down again, i'll apply previous script to my cron... :) |
Watch out for your call costs with maxfail=0!!!
|
You might want to grep your syslog to find out why it's hanging up.
Is it server timeout, hangup on inactivity ... ? You might find, as your persist option was already set that maxfail was defaulting to 10 and that 10 x (max session time) = ~4 days ??? With maxfail=0, for example, a problem at their end would mean constant redials (until you're poor ;) ) |
if everthing else fails, add this to crontab (crontab -e as root)
0 * * * * poff <provider> && pon <provider> this will terminate $ reinitialize the ppp connection every day @ 00:00, change crontab to your liking ;) ...or you could use a script like this: Code:
#!/usr/bin/perl |
Iceman, this one is so cool! thx mate, i owe you a beer!
Ubernut: it's a free connection... :D and for you a beer too ;) |
All times are GMT -5. The time now is 02:57 AM. |