Re: Keeping pppd alive--how?

From: Phisherman (nobody_at_noone.com)
Date: 10/30/04


Date: Sat, 30 Oct 2004 11:44:26 GMT

On Sat, 30 Oct 2004 09:12:44 GMT, chris@nospam.com wrote:

>On Fri, 29 Oct 2004 18:54:00 GMT, Phisherman <nobody@noone.com> wrote:
>
>>I have yet to solve this problem and I'm no Linux expert. I use
>>Fedora Core One (text only!) running Squid as my proxy server. I
>>wrote a script to dial up my ISP, wait 40 seconds, then start up Jay's
>>Firewall. It goes offline periodically, so I re-run this script
>>manually. (All I do is type ./s on the keyboard without using the
>>monitor.) Sometimes a family member will startup this script if I am
>>not present. I always have this computer logged in as root--I know
>>this not a good idea, but physical security is not a big concern.
>>What I have not been successful is writing a script to automate this
>>process.
>>
>>
>>Here's my script (called s) that dials up the ISP and starts the
>>firewall:
>>
>>#!/bin/sh
>>#
>>./ppp-on
>>sleep 40s
>>./fire
>>
>>
>>Here's a hangup script I use to disconnect (works great!):
>>
>>#!/bin/sh
>>#
>>killall pppd
>>
>>
>>What I want Linux to do (automatically) is to run the "s" script if
>>the modem loses the connection. What is the best way to do this? A
>>cron job? A looping script? Perhaps using the netstat command to do
>>the "test?"
>>
>>Another thought. I need to easily disable running the s script if I
>>need to take the modem offline to make a phone call.
>>
>>I appreciate any detailed suggestions. Thanks!
>
>
>I'm not sure what your ppp-on script has in it, but you're trying to
>make this harder than it has to be.

My ppp-on script contains only one (rather tricky with the single and
double quotes) command:

/usr/sbin/pppd name "xxxxxxxxx@worldnet.att.net" -d connect
'/usr/sbin/chat -t 45 ABORT BUSY "" ATDT824xxxx CONNECT ""' /dev/modem
115200 noipdefault modem defaultroute crtscts
>
>Run redhat-config-network-gui and edit the connection. Under the
>options tab is an option to redial is connection is lost. If you
>can't run the gui (even if you send the display to your local
>computer) you will need to edit the ifcfg-*** script and set
>persist=yes.
>

My Linux machine is text only--no GUIs. And even with that I need to
carefully watch my hard drive space with a tight budget.

>That way when the connection comes up, ppp-watch will be spawned which
>will redial the connection on it's own if the connection dies. You'll
>need to kill ppp-watch instead of pppd to hangup, btw.
>
>Another question is why are you stopping/starting the firewall with
>the connection. Just start it and leave it running.
>
The firewall needs the IP address assigned by my ISP. It is not
stopped, just restarted.

>For easier control of the connection, download Putty and run SSH on
>the linux box (listen on the inside interface or firewall port on ppp
>interface). Then create a shortcut to run the plink command to run
>your scripts on the firewall. Something like:
>
>C:\putty\PLINK.EXE -load "firewall" -batch /root/start_ppp.sh &
>
Thanks. If i need to, I'll use Putty but it must be text-based to run
on my vintage machine.
>
>My custom solution was to write a daemon in perl that runs on the
>linux box listening for commands and returning output to the client.
>The client is a perltray app with a popup list of commands like
>dialing, hangup, show connected speed, etc. It also changes the icon
>to reflect the connection state. The tray program needs to be compiled
>with the ActiveState perltray tool.
>
>Before you ask, no I don't feel like posting the code. It's got a
>bunch of custom stuff that I don't feel like ripping out and
>reverifying it'll work. Stuff like altering my firewall depending on
>where I'm dialed (only let my computer out if dialed into work) and
>different menu options depending on user (ie wife can't dial work).
>
>-Chris

Perhaps there is an option in the pppd command that will keep my
connection alive? Anyone know?