1999-08-28 01:35:59 +00:00
|
|
|
.\" $FreeBSD$
|
2000-12-11 15:57:16 +00:00
|
|
|
.Dd June 26, 1997
|
2001-07-10 15:12:08 +00:00
|
|
|
.Os
|
1997-06-28 01:04:54 +00:00
|
|
|
.Dt PPPCTL 8
|
|
|
|
.Sh NAME
|
|
|
|
.Nm pppctl
|
2001-04-18 15:54:10 +00:00
|
|
|
.Nd PPP control program
|
1997-06-28 01:04:54 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
|
|
|
.Op Fl v
|
|
|
|
.Op Fl t Ar n
|
|
|
|
.Op Fl p Ar passwd
|
2001-02-01 16:44:04 +00:00
|
|
|
.Xo Oo Ar host : Oc Ns
|
|
|
|
.Ar Port | LocalSocket
|
|
|
|
.Xc
|
|
|
|
.Oo
|
|
|
|
.Sm off
|
|
|
|
.Ar command Oo ; Ar command Oc Ar ...
|
|
|
|
.Sm on
|
|
|
|
.Oc
|
1997-06-28 01:04:54 +00:00
|
|
|
.Sh DESCRIPTION
|
2002-07-14 14:47:15 +00:00
|
|
|
This utility provides command line control of the
|
1997-11-07 02:54:49 +00:00
|
|
|
.Xr ppp 8
|
2004-07-02 23:13:00 +00:00
|
|
|
daemon.
|
|
|
|
Its primary use is to facilitate simple scripts that
|
1997-06-28 01:04:54 +00:00
|
|
|
control a running daemon.
|
1997-12-21 02:37:49 +00:00
|
|
|
.Pp
|
2002-07-14 14:47:15 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is passed at least one argument, specifying the socket on which
|
1997-06-28 01:04:54 +00:00
|
|
|
.Nm ppp
|
2004-07-02 23:13:00 +00:00
|
|
|
is listening.
|
|
|
|
Refer to the
|
1997-11-07 02:54:49 +00:00
|
|
|
.Sq set server
|
|
|
|
command of
|
|
|
|
.Nm ppp
|
2004-07-02 23:13:00 +00:00
|
|
|
for details.
|
|
|
|
If the socket contains a leading '/', it
|
1997-11-07 02:54:49 +00:00
|
|
|
is taken as an
|
|
|
|
.Dv AF_LOCAL
|
2004-07-02 23:13:00 +00:00
|
|
|
socket.
|
|
|
|
If it contains a colon, it is treated as a
|
2001-02-01 16:44:04 +00:00
|
|
|
.Ar host : Ns Ar port
|
1997-11-07 02:54:49 +00:00
|
|
|
pair, otherwise it is treated as a TCP port specification on the
|
2004-07-02 23:13:00 +00:00
|
|
|
local machine (127.0.0.1).
|
|
|
|
Both the
|
1997-11-07 02:54:49 +00:00
|
|
|
.Ar host
|
|
|
|
and
|
|
|
|
.Ar port
|
|
|
|
may be specified numerically if you wish to avoid a DNS lookup
|
2005-02-13 22:25:33 +00:00
|
|
|
or do not have an entry for the given port in
|
1997-06-28 01:04:54 +00:00
|
|
|
.Pa /etc/services .
|
1997-07-28 22:17:48 +00:00
|
|
|
.Pp
|
1997-11-07 02:54:49 +00:00
|
|
|
All remaining arguments are concatenated to form the
|
2001-02-01 16:44:04 +00:00
|
|
|
.Ar command Ns (s)
|
1997-11-07 02:54:49 +00:00
|
|
|
that will be sent to the
|
1997-06-28 01:04:54 +00:00
|
|
|
.Nm ppp
|
2004-07-02 23:13:00 +00:00
|
|
|
daemon.
|
|
|
|
If any semi-colon characters are found, they are treated as
|
1997-11-07 02:54:49 +00:00
|
|
|
.Ar command
|
|
|
|
delimiters, allowing more than one
|
|
|
|
.Ar command
|
1997-11-18 00:20:29 +00:00
|
|
|
in a given
|
|
|
|
.Sq session .
|
|
|
|
For example:
|
1997-12-21 02:37:49 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
pppctl 3000 set timeout 300\\; show timeout
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2005-02-13 22:25:33 +00:00
|
|
|
Do not forget to escape or quote the ';' as it is a special character
|
1997-06-28 01:04:54 +00:00
|
|
|
for most shells.
|
1997-12-21 02:37:49 +00:00
|
|
|
.Pp
|
1997-11-07 02:54:49 +00:00
|
|
|
If no
|
|
|
|
.Ar command
|
|
|
|
arguments are given,
|
|
|
|
.Nm
|
|
|
|
enters interactive mode, where commands are read from standard input.
|
1997-11-07 20:20:15 +00:00
|
|
|
When reading commands, the
|
|
|
|
.Xr editline 3
|
|
|
|
library is used, allowing command-line editing (with
|
|
|
|
.Xr editrc 5
|
2004-07-02 23:13:00 +00:00
|
|
|
defining editing behaviour).
|
|
|
|
The history size
|
1997-11-07 20:20:15 +00:00
|
|
|
defaults to
|
|
|
|
.Em 20 lines .
|
1997-12-21 02:37:49 +00:00
|
|
|
.Pp
|
1997-06-28 01:04:54 +00:00
|
|
|
The following command line options are available:
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl v
|
|
|
|
Display all data sent to and received from the
|
|
|
|
.Nm ppp
|
2004-07-02 23:13:00 +00:00
|
|
|
daemon.
|
|
|
|
Normally,
|
1997-11-18 00:20:29 +00:00
|
|
|
.Nm
|
2004-07-02 23:13:00 +00:00
|
|
|
displays only non-prompt lines received.
|
|
|
|
This option is ignored in
|
1997-11-07 20:20:15 +00:00
|
|
|
interactive mode.
|
1997-06-28 01:04:54 +00:00
|
|
|
.It Fl t Ar n
|
|
|
|
Use a timeout of
|
|
|
|
.Ar n
|
2004-07-02 23:13:00 +00:00
|
|
|
instead of the default 2 seconds when connecting.
|
|
|
|
This may be required
|
1997-11-18 00:20:29 +00:00
|
|
|
if you wish to control a daemon over a slow (or even a dialup) link.
|
1997-06-28 01:04:54 +00:00
|
|
|
.It Fl p Ar passwd
|
|
|
|
Specify the password required by the
|
|
|
|
.Nm ppp
|
2004-07-02 23:13:00 +00:00
|
|
|
daemon.
|
|
|
|
If this switch is not used,
|
1997-06-28 01:04:54 +00:00
|
|
|
.Nm
|
|
|
|
will prompt for a password once it has successfully connected to
|
1997-10-05 14:21:30 +00:00
|
|
|
.Nm ppp .
|
1997-06-28 01:04:54 +00:00
|
|
|
.El
|
2005-01-18 20:02:45 +00:00
|
|
|
.Sh ENVIRONMENT
|
|
|
|
The following environment variables are understood by
|
|
|
|
.Nm
|
|
|
|
when in interactive mode:
|
|
|
|
.Bl -tag -width XXXXXXXXXX
|
|
|
|
.It Dv EL_SIZE
|
|
|
|
The number of history lines.
|
|
|
|
The default is 20.
|
|
|
|
.It Dv EL_EDITOR
|
|
|
|
The edit mode.
|
|
|
|
Only values of "emacs" and "vi" are accepted.
|
|
|
|
Other values
|
|
|
|
are silently ignored.
|
|
|
|
This environment variable will override the
|
|
|
|
.Ar bind -v
|
|
|
|
and
|
|
|
|
.Ar bind -e
|
|
|
|
commands in
|
|
|
|
.Pa ~/.editrc .
|
|
|
|
.El
|
1997-10-05 14:21:30 +00:00
|
|
|
.Sh EXAMPLES
|
1997-11-18 00:20:29 +00:00
|
|
|
If you run
|
1997-10-05 14:21:30 +00:00
|
|
|
.Nm ppp
|
|
|
|
in
|
|
|
|
.Fl auto
|
1997-11-18 00:20:29 +00:00
|
|
|
mode,
|
1997-10-05 14:21:30 +00:00
|
|
|
.Nm
|
1997-11-18 00:20:29 +00:00
|
|
|
can be used to automate many frequent tasks (you can actually control
|
|
|
|
.Nm ppp
|
2004-07-02 23:13:00 +00:00
|
|
|
in any mode except interactive mode).
|
|
|
|
Use of the
|
1997-10-05 14:21:30 +00:00
|
|
|
.Fl p
|
2005-02-13 22:25:33 +00:00
|
|
|
option is discouraged (even in scripts that are not readable by others)
|
1997-10-05 14:21:30 +00:00
|
|
|
as a
|
|
|
|
.Xr ps 1
|
|
|
|
listing may reveal your secret.
|
|
|
|
.Pp
|
1997-11-18 00:20:29 +00:00
|
|
|
The best way to allow easy, secure
|
1997-10-05 14:21:30 +00:00
|
|
|
.Nm
|
1997-11-18 00:20:29 +00:00
|
|
|
access is to create a local server socket in
|
1997-10-05 14:21:30 +00:00
|
|
|
.Pa /etc/ppp/ppp.conf
|
1997-11-18 00:20:29 +00:00
|
|
|
(in the correct section) like this:
|
1997-10-05 14:21:30 +00:00
|
|
|
.Bd -literal -offset indent
|
1997-11-18 00:20:29 +00:00
|
|
|
set server /var/run/internet "" 0177
|
1997-10-05 14:21:30 +00:00
|
|
|
.Ed
|
1997-12-21 02:37:49 +00:00
|
|
|
.Pp
|
1997-10-05 14:21:30 +00:00
|
|
|
This will instruct
|
|
|
|
.Nm ppp
|
1997-11-18 00:20:29 +00:00
|
|
|
to create a local domain socket, with srw------- permissions and no
|
|
|
|
password, allowing access only to the user that invoked
|
|
|
|
.Nm ppp .
|
|
|
|
Refer to the
|
1997-10-05 14:21:30 +00:00
|
|
|
.Xr ppp 8
|
|
|
|
man page for further details.
|
|
|
|
.Pp
|
2004-07-02 23:13:00 +00:00
|
|
|
You can now create some easy-access scripts.
|
|
|
|
To connect to the internet:
|
1997-10-05 14:21:30 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
#! /bin/sh
|
|
|
|
test $# -eq 0 && time=300 || time=$1
|
1997-11-18 00:20:29 +00:00
|
|
|
exec pppctl /var/run/internet set timeout $time\\; dial
|
1997-10-05 14:21:30 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
To disconnect:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#! /bin/sh
|
|
|
|
exec pppctl /var/run/internet set timeout 300\\; close
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
To check if the line is up:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#! /bin/sh
|
1997-12-21 01:21:40 +00:00
|
|
|
pppctl -p '' -v /var/run/internet quit | grep ^PPP >/dev/null
|
1997-10-05 14:21:30 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo Link is up
|
|
|
|
else
|
|
|
|
echo Link is down
|
|
|
|
fi
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
You can even make a generic script:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#! /bin/sh
|
|
|
|
exec pppctl /var/run/internet "$@"
|
|
|
|
.Ed
|
1997-12-21 02:37:49 +00:00
|
|
|
.Pp
|
2000-04-30 22:28:21 +00:00
|
|
|
You could also use
|
|
|
|
.Nm
|
2004-07-02 23:13:00 +00:00
|
|
|
to control when dial-on-demand works.
|
|
|
|
Suppose you want
|
2000-04-30 22:28:21 +00:00
|
|
|
.Nm ppp
|
|
|
|
to run all the time, but you want to prevent dial-out between 8pm and 8am
|
2004-07-02 23:13:00 +00:00
|
|
|
each day.
|
|
|
|
However, any connections active at 8pm should continue to remain
|
2000-04-30 22:28:21 +00:00
|
|
|
active until they are closed or naturally time out.
|
|
|
|
.Pp
|
|
|
|
A
|
|
|
|
.Xr cron 8
|
|
|
|
entry for 8pm which runs
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
pppctl /var/run/internet set filter dial 0 deny 0 0
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
will block all further dial requests, and the corresponding 8am entry
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
pppctl /var/run/internet set filter dial -1
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
will allow them again.
|
1997-06-28 01:04:54 +00:00
|
|
|
.Sh SEE ALSO
|
1998-08-31 16:41:09 +00:00
|
|
|
.Xr ps 1 ,
|
1997-11-07 20:20:15 +00:00
|
|
|
.Xr editline 3 ,
|
|
|
|
.Xr editrc 5 ,
|
1998-08-31 16:41:09 +00:00
|
|
|
.Xr services 5 ,
|
2001-07-15 08:06:20 +00:00
|
|
|
.Xr ppp 8
|
1997-06-28 01:04:54 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
2002-07-14 14:47:15 +00:00
|
|
|
utility first appeared in
|
2000-11-14 11:20:58 +00:00
|
|
|
.Fx 2.2.5 .
|