Page 1 of 1

[SOLVED] Configure ppp to auto-reconnect

Posted: 19. Nov 2011, 06:41
by Dennola4
I am going to be leaving town soon and will be accessing my laptop remotely. Currently I use an autostart script to connect to ppp at start-up, but my worry is that if this ppp connection drops I will lose access to it for the rest of the trip. I would like to know how to set it so that ppp automatically reconnects if dropped.

>> I tried these instructions but they didn't work: http://www.linuxjournal.com/article/2109?page=0,2

I am using Salix 13.1, my PCMCIA is a Sierra Wireless AirCard 580 [1199:112], and these are my relevant files:

/etc/ppp/ip-up ----------------------------------------> http://pastie.org/2886995
/etc/ppp/ip-up.local ----------------------------------> http://pastie.org/2887001
/etc/ppp/options --------------------------------------> http://pastie.org/2887004
/etc/ppp/ip-down -------------------------------------> http://pastie.org/2887009
/etc/ppp/ip-down.local ------------------------------> http://pastie.org/2887012
/etc/ppp/peers/cdma --------------------------------> http://pastie.org/2887016
/etc/ppp/peers/cdma_chat --------------------------> http://pastie.org/2887020
/etc/sudoers -----------------------------------------> http://pastie.org/2887023
/home/dennis/.config/autostart/Connect.desktop --> http://pastie.org/2887031

Salix Wizards, I await your wizardry. :idea:

EDIT: Not sure if this is relevant, but it may help you to know that I have a static ip address through my service provider.

Re: Configure ppp to auto-reconnect if connection is dropped

Posted: 19. Nov 2011, 11:33
by Shador
Does any process die when the connection is lost? Or is there any other way to catch this event?
It should be fairly simple to write a script that checks the connection every now and then and if it's lost calls the command used to open the connection. I'm not familiar with ppp myself (never used it), so I can't say whether there's such a feature anywhere yet. But in the past I've e.g. used such a simple loop to shutdown my computer:

Code: Select all

while true; do
  if ! pgrep <pname>; then
    shutdown -h +1
    break
  fi
  sleep 1m
done 

Re: Configure ppp to auto-reconnect if connection is dropped

Posted: 20. Nov 2011, 01:02
by Dennola4
Hi Shador,

You asked:
Does any process die when the connection is lost?
Is this what you are asking for?

Code: Select all

dennis[~]$ ps aux | grep [p]pp
root 4464 0.0 0.1 2988 1104 ? S Nov18 0:00 /usr/sbin/pppd call cdma
I am still learning simple bash commands and bash scripting is currently beyond my scope. Thanks for your help. Hopefully you can suggest a solution or point me in the right direction. :oops:


- Dennis in New Orleans

Re: Configure ppp to auto-reconnect if connection is dropped

Posted: 20. Nov 2011, 06:41
by Dennola4
Ok, I got it.

I needed to add two AT commands to the /etc/ppp/peers/cdma file (persist & holdoff):

Code: Select all

-detach
lcp-echo-failure 0
noauth
/dev/ttyUSB0
115200
debug
defaultroute
ipcp-accept-local
ipcp-accept-remote
usepeerdns
crtscts
lock
persist        # redials upon disconnect
holdoff 5      # pauses for 5 seconds between disconnect and redial

connect '/usr/sbin/chat -v -t6 -f /etc/ppp/peers/cdma_chat'
Simple solution -- not so simple finding it. ;)