[plug] pppd redial - variable holdoff time
Steve Boak
sboak at westnet.com.au
Sun Sep 19 14:37:19 WST 2004
On Sun, 19 Sep 2004 01:17 pm, Harry wrote:
> On Sun, 19 Sep 2004 11:00:49 +0800 Steve Boak <sboak at westnet.com.au> wrote:
> > Hi Everyone
> >
> > I am looking for an option in pppd to achieve an exponential redial
> > holdoff time - I don't think it exists, but I think it would be useful.
> >
> > In setting up a (debian) firewall/gateway, I have had to make some less
> > than optimal compromises between fast recovery of a dropped 56k modem
> > link and the cost of failed calls. What I would like in an ideal
> > situation is to have the modem redial every 15 seconds for the first
> > minute, then drop to 60 seconds for the next 5 minutes, and possible
> > every 5 minutes for the next hour. I'd be happy with something as simple
> > as starting off at say a 15 second delay, and doubling the holdoff time
> > after each failed attempt.
> >
> > Has anyone heard of anything like this, in some other package maybe?
>
> Hi Steve
>
> I've been scratting around the internet to figure this out and also on
> the debian box. A start:
>
> http://www.faqs.org/docs/Linux-HOWTO/PPP-HOWTO.html
>
> Do a
> # man pon
> to see that it first looks for a file /etc/ppp/ppp_on_boot
> mine is currently called /etc/ppp/no_ppp_on_boot and it
> says in there to rename it to ppp_on_boot if you want to use it.
> It just runs pppd so you could use
> # man pppd
> to see what it does with no arguments. It may be possible to sense
> 'failure to connect', 'failure to auth', or 'link lost' as exit
> values so you can put a loop around the $PPPD call and either:
>
> - On failure to connect, adjust (extend exponentially) a delay,
> sleep(delay), loop
>
> - On failure to auth, make some other decision about delay then
> sleep(delay), loop
>
> - On link lost (after some time), reset the sleep value and start back at
> a 5 second redial delay, sleep(delay) again, loop.
>
> Does that make sense ? Have a look at all those things anyway. I thought
> the pon stuff was fiddly but it all looks pretty straight forward when
> you start looking over it. I haven't figured out how informative pppd is
> when it exits. You can get it to autoredial in the pppd argunments I think
> bit only with a fixed reconnect period.
>
> Take all this as ideas from a novice :-)
>
> HTH
> Harry
Thanks Harry
That's pretty well what I had come up with, but I didn't want to start coding
if someone else had already done the work :-)
My current thinking is to modify ppp_on_boot, which I am already using in it's
default state. It appears the designer of ppp_on_boot has already thought of
this sort of idea, and has conveniently added the following comment to the
script:
# If you also make this file executable, and replace the first line
# with just "#!/bin/sh", the commands below will be executed instead.
Initially I was having trouble working out how the contents of ppp_on_boot was
used in the default configuration, but now I am pretty sure it's the mere
existence of the file which is important to trigger ppp at boot time, and the
contents are unimportant unless the file is made executable.
If I make ppp_on_boot executable, I think I can replace the '/usr/bin/pppd
call $ISP' with a simple loop and a couple of timing variables, and pppd has
very comprehensive exit codes which should allow me to do the necessary error
checking.
The main thing I am now concerned about is what happens if the ppp_on_boot
script does not return, as would be the case if it is running the pppd
control loop. I guess I will find out shortly :-)
Steve
--
Ph: +61 8 97560662, IP-Phone: FWD# 454566, e164.org# 61897560662
"Most men occasionally stumble over the truth, but most pick themselves
up and continue on as if nothing had happened." - Winston Churchill
More information about the plug
mailing list