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:
Code:
#!/bin/sh
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:
Code:
#!/bin/sh
kill -9 `cat /var/run/tun?.pid`
This makes use of a little trick... ppp always stores its PID in /var/run/DEVICE.pid. 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.
Code:
#!/bin/sh
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)
Code:
#!/bin/sh
sudo /path/to/ppp isp1
ppp-up
We don't use the auto switch because we don't want it restarting as soon as we turn it off.
ppp-up:
Code:
#!/bin/sh
exec pppctl /var/run/internet set timeout 300\; dial