xref: /freebsd/usr.sbin/pppctl/pppctl.8 (revision 02f2e93b60c2b91feac8f45c4c889a5a8e40d8a2)
1.\" $Id: pppctl.8,v 1.3 1997/09/29 19:11:45 wosch Exp $
2.Dd 26 June 1997
3.Os FreeBSD
4.Dt PPPCTL 8
5.Sh NAME
6.Nm pppctl
7.Nd
8PPP control program
9.Sh SYNOPSIS
10.Nm
11.Op Fl v
12.Op Fl t Ar n
13.Op Fl p Ar passwd
14.Ar [host:]Port | LocalSocket
15.Ar command
16.Op Ar ;command
17.Ar ...
18.Sh DESCRIPTION
19This program provides command line control of the
20.Nm ppp
21daemon.  Its primary use is to facilitate simple scripts that
22control a running daemon.
23
24.Nm Pppctl
25expects at least two arguments.  The first is interpreted as the
26socket on which the
27.Nm ppp
28daemon is listening.  If the socket contains a leading '/', it
29is taken as an AF_LOCAL socket.  If it contains a colon, it is
30treated as a host:port pair, otherwise it is treated as just a
31port specification on the local machine (127.0.0.1).  Both the
32host and port may be specified numerically if you wish to avoid
33a DNS lookup or don't have an entry for the given port in
34.Pa /etc/services .
35
36.Pp
37All remaining arguments are concatenated to form the command(s) that
38will be sent to the
39.Nm ppp
40daemon.  If any semi-colon characters are found, they are treated
41as command delimiters, allowing more than one command in a given
42"session".  For example;
43
44  pppctl 3000 set timeout 300\\; show timeout
45
46Don't forget to escape or quote the ';' as it is a special character
47for most shells.
48
49The following command line options are available:
50.Bl -tag -width Ds
51.It Fl v
52Display all data sent to and received from the
53.Nm ppp
54daemon.  Normally,
55.Nm pppctl
56displays only non-prompt lines received.
57.It Fl t Ar n
58Use a timeout of
59.Ar n
60instead of the default 2 seconds.  This may be required if you
61wish to control a daemon over a slow (or even a dialup) link.
62.It Fl p Ar passwd
63Specify the password required by the
64.Nm ppp
65daemon.  If this switch is not used,
66.Nm
67will prompt for a password once it has successfully connected to
68.Nm ppp .
69.El
70
71.Sh EXAMPLES
72Assuming you want to run
73.Nm ppp
74in
75.Fl auto
76mode,
77.Nm
78can be used to automate many frequent tasks.  Use of the
79.Fl p
80option is discouraged (even in scripts that aren't readably by others)
81as a
82.Xr ps 1
83listing may reveal your secret.
84.Pp
85In order to have
86.Nm ppp
87create a socket for use with
88.Nm pppctl ,
89you will need to define a password for your local system:
90.Bd -literal -offset indent
91# touch /etc/ppp/ppp.secret
92# chown root.wheel /etc/ppp/ppp.secret
93# chmod 400 /etc/ppp/ppp.secret
94# echo "`hostname -s` MyPassword" >>/etc/ppp/ppp.secret
95.Ed
96
97.Pp
98The most secure way to allow easy, secure
99.Nm
100access, and to make sure you can distinguish between multiple invocations
101of
102.Nm ppp
103is to create a local server socket in
104.Pa /etc/ppp/ppp.conf
105(in the correct section):
106
107.Bd -literal -offset indent
108set server /var/run/internet 0666
109.Ed
110
111This will instruct
112.Nm ppp
113to create a local domain socket rather than the tcp socket that's created
114by default.  Refer to the
115.Xr ppp 8
116man page for further details.
117
118.Pp
119You can now create some easy-access scripts.  To connect to the internet:
120
121.Bd -literal -offset indent
122#! /bin/sh
123test $# -eq 0 && time=300 || time=$1
124exec pppctl -t 60 /var/run/internet set timeout $time\\; dial
125.Ed
126
127.Pp
128To disconnect:
129.Bd -literal -offset indent
130#! /bin/sh
131exec pppctl /var/run/internet set timeout 300\\; close
132.Ed
133
134.Pp
135To check if the line is up:
136.Bd -literal -offset indent
137#! /bin/sh
138pppctl -p '' -v /var/run/internet '' | grep ^PPP >/dev/null
139if [ $? -eq 0 ]; then
140  echo Link is up
141else
142  echo Link is down
143fi
144.Ed
145
146.Pp
147You can even make a generic script:
148.Bd -literal -offset indent
149#! /bin/sh
150exec pppctl /var/run/internet "$@"
151.Ed
152
153.Sh SEE ALSO
154.Xr services 5 ,
155.Xr ppp 8
156
157.Sh HISTORY
158The
159.Nm
160command first appeared in FreeBSD 2.2.5.
161