Review your favorite Linux distribution.
Go Back > Forums > Other *NIX Forums > *BSD
User Name
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.


  Search this Thread
Old 09-02-2004, 04:32 AM   #1
Registered: Apr 2004
Posts: 682

Rep: Reputation: Disabled
PPP disconnect annoyence

I use PPP dial up and I usually do:

"sudo /location/to/ppp -auto isp1" and it dials and gets back to the prompt.
So, when I want to disconnect I have to do:

"ps -aux | grep ppp" && "kill -9 <PID>"

Does anyone know any quick any around this? Like, putting it in the
background or something? I have tried with "&".

Any ideas?

Old 09-02-2004, 11:18 AM   #2
Senior Member
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
The easiest way to do what you are doing is to write some scripts to start the connection and stop it for you. On many systems these could be called different things. We'll use ppp-up and ppp-down for the examples.

In ppp-up we want to place:
sudo /path/to/ppp -auto isp1
The reason we put it there is so you have one simple commend you run and it just works. Now, you just enter your password and away it goes. You might be interested in adding your username to the "network" group (/etc/group) and adding the line "allow user _username_" to the ppp.conf file. If you do that you will be able to avoid the sudo. But that is off-topic.

In ppp-down we want to place:
kill -9 `cat /var/run/tun?.pid`
This makes use of a little trick... ppp always stores its PID in /var/run/ Device is probably going to be tun0 in most cases but we use the ? just in case it starts as tun1 (which would be the wrong thing to do but makes this program kill it anyway).

You could also start up a server from the ppp.conf file by doing something like:
set server /var/run/internet "" 0177

Then you could change ppp-down to use the pppctl command instead. Which will shut it down in a nicer manner.
exec pppctl /var/run/internet set timeout 300\; close
To learn more about the pppctl option read `man pppctl` -- this page is a lot shorter than ppp's.

EDIT: If you use the pppctl command you are going to want to change the ppp-up script. Since ppp will still be running just disconnected. And we need a ppp-start script to start the whole thing.

ppp-start: (same as our original ppp-up ... minus the -auto switch)
sudo /path/to/ppp isp1
We don't use the auto switch because we don't want it restarting as soon as we turn it off.

exec pppctl /var/run/internet set timeout 300\; dial

Last edited by frob23; 09-02-2004 at 11:23 AM.
Old 09-02-2004, 11:51 AM   #3
Registered: Apr 2004
Posts: 682

Original Poster
Rep: Reputation: Disabled
Thanks a bunch!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to link linux ppp client to windows ppp server? cyz Linux - Networking 2 12-11-2008 06:01 AM
Looking for man ppp-on and info ppp-on pages. rvijay Linux - General 1 02-26-2005 09:49 PM
Can't disconnect raysr Linux - Networking 2 05-23-2004 11:00 AM
how to disconnect ppp link to isp checkchan Linux - Newbie 0 08-10-2003 10:21 AM
Can't disconnect!!! Nik Linux - Software 1 12-15-2002 04:32 AM > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 08:48 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration