Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I run FreeBsd box with pppd over Ethernet. Everything works just fine with only one exception. Sometimes, not too often, the connection becomes stale. Everything looks like if it is ok: ifconfig shows it is up, ppp says that the link is ok, but traffic does not come through. What I do is run killall pppd and then restart ppp manually. It reconnects and things are great again.

My question is: is there a setting in pppd (or mpd5, or anywhere else) that if set, makes ppp detect that the link is stale and reconnect automatically?

If there isn't such a setting, maybe there is another solution?

share|improve this question
    
Did you set ondemand in your ppd config ? –  warl0ck Sep 9 '12 at 0:35
    
No. I thought it serves different purpose. The thing is that connection is already established. –  akond Sep 9 '12 at 1:36
add comment

3 Answers 3

I'd add a simple shell script to the crontab, that would periodically ping a known host, and restart service if the host cannot be reach.

Something like this:

#!/bin/sh
ping -q -c3 google.com &> /dev/null
if [[ $? != "0" ]]
  then
    ppp_restart_command
fi

Name it for example conn_check.sh, add it to crontab and let it run every 60 sec.

share|improve this answer
add comment

Have you configured the following pppd Link Control Protocol options? They control whether and how often pppd sends out LCP echoes to check whether the link is still alive or not, and how it responds if it isn't.

lcp-echo-failure n
lcp-echo-interval n
lcp-echo-adaptive

They combine well with the following options, which control whether pppd will try to restart a connection after termination, how long to delay before re-connecting, and how many times it will restart after failures:

persist
holdoff n
maxfail n

If maxfail is non-zero, you may also want a wrapper script or cron-job to restart pppd if it has exited completely (i.e. failures > maxfail setting). A common reason for having maxfail > 0 is that a wrapper script can be written to have more intelligent responses (than just retry over and over again) to, e.g, a prolonged outage.

See the pppd man page for more details on these and other config options.

share|improve this answer
    
It sounds as a viable solution, but FreeBsd's pppd does not have these options. They are available on Linux only. But now that I know about LCP my chances to get it working are growing. –  akond Sep 10 '12 at 17:01
    
sorry, i thought freebsd used the same pppd as linux, based on a (faulty) vague recollection from years ago when i last used freebsd. wrong. maybe the set redial and set reconnect options would help. lqr and echo also look relevant. –  cas Sep 10 '12 at 23:14
add comment
up vote 0 down vote accepted

So, I came up with this solution.

enable lqr
set lqrperiod 5
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.