pppctl - PPP control program
The utility is passed at least one argument, specifying the socket on which ppp is listening. Refer to the `set server' command of ppp for details. If the socket contains a leading '/', it is taken as an AF_LOCAL socket. If it contains a colon, it is treated as a host : port pair, otherwise it is treated as a TCP port specification on the local machine (127.0.0.1). Both the host and port may be specified numerically if you wish to avoid a DNS lookup or do not have an entry for the given port in /etc/services
All remaining arguments are concatenated to form the command (s) that will be sent to the ppp daemon. If any semi-colon characters are found, they are treated as command delimiters, allowing more than one command in a given `session' For example:
pppctl 3000 set timeout 300\; show timeout
Do not forget to escape or quote the ';' as it is a special character for most shells.
If no command arguments are given, enters interactive mode, where commands are read from standard input. When reading commands, the editline(3) library is used, allowing command-line editing (with editrc(5) defining editing behaviour). The history size defaults to 20 lines
The following command line options are available:
The best way to allow easy, secure access is to create a local server socket in /etc/ppp/ppp.conf (in the correct section) like this:
set server /var/run/internet "" 0177
This will instruct ppp to create a local domain socket, with srw------- permissions and no password, allowing access only to the user that invoked ppp Refer to the ppp(8) man page for further details.
You can now create some easy-access scripts. To connect to the internet:
#! /bin/sh test $# -eq 0 && time=300 || time=$1 exec pppctl /var/run/internet set timeout $time\; dial
To disconnect:
#! /bin/sh exec pppctl /var/run/internet set timeout 300\; close
To check if the line is up:
#! /bin/sh pppctl -p '' -v /var/run/internet quit | grep ^PPP >/dev/null if [ $? -eq 0 ]; then echo Link is up else echo Link is down fi
You can even make a generic script:
#! /bin/sh exec pppctl /var/run/internet "$@"
You could also use to control when dial-on-demand works. Suppose you want ppp to run all the time, but you want to prevent dial-out between 8pm and 8am each day. However, any connections active at 8pm should continue to remain active until they are closed or naturally time out.
A cron(8) entry for 8pm which runs
pppctl /var/run/internet set filter dial 0 deny 0 0
will block all further dial requests, and the corresponding 8am entry
pppctl /var/run/internet set filter dial -1
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |