1

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?

2
  • Did you set ondemand in your ppd config ? Commented Sep 9, 2012 at 0:35
  • No. I thought it serves different purpose. The thing is that connection is already established. Commented Sep 9, 2012 at 1:36

3 Answers 3

2
+50

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.

2
  • 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. Commented Sep 10, 2012 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. Commented Sep 10, 2012 at 23:14
0

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.

0

So, I came up with this solution.

enable lqr
set lqrperiod 5
1
  • Where are these set? Commented Mar 7, 2022 at 14:02

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.