Having problems setting up PPP? Mr. Meyers gives us a graphical interface to make it easy.
by Nathan Meyers
PPP, the Point-to-Point Protocol, is today's protocol of choice for network connectivity over a serial line. For Linux users, the tools of choice are the PPP utilities. The utilities--pppd, chat and a collection of scripts and utilities--nicely manage the connection from startup to shutdown: dialing and logging in, starting up the protocol, adding routing information and closing the connection.
What the PPP utilities do not have is a good user interface. If you use the utilities, you know the routine: execute a script called something like /etc/ppp/scripts/ppp-on, listen to your modem make noise and wait while your network connection attempts to start working. If nothing happens, check the process list. If pppd isn't running, the login attempt failed and you need to try again. If the connection goes down, you eventually figure it out by checking the process list and starting a new connection. Things improve after you've used the PPP utilities awhile--you begin to recognize the state of the connection by the sounds of disk activity.
PPPui was written out of my frustration with the utilities' low-tech interface. It's an X-based (specifically, Tcl/Tk-based) GUI that provides very simple control over a PPP connection. The goal was to provide easy startup and shutdown and useful visual feedback about the connection.
The scenario for a PPPui session looks something like this:
PPPui is implemented as a wish (WIndowing SHell--part of the Tcl/Tk package) script and requires wish4.2. It does not replace the PPP utilities, but does require some very minor changes to them--discussed later in detail.
The PPPui script was developed on a Slackware system using the PPP utilities source distribution. In the following description and in the script itself, there are assumptions about locations (scripts and executables) and permissions that do not necessarily apply to other distributions. The script takes two required arguments and two optional arguments. The basic invocation takes a PPP startup command, a PPP shutdown command and optionally the name of the PPP device being opened (defaults to ppp0). For example:
PPPui /etc/ppp/scripts/ppp-on\ /etc/ppp/scripts/ppp-off ppp0The startup and shutdown commands are interpreted by /bin/sh when they are invoked and can contain multiple arguments and anything else the shell will recognize. For example:
PPPui /etc/ppp/scripts/ppp-on\ '/etc/ppp/scripts/ppp-off ppp0' ppp0The other optional argument, -small, is described in the section ``Interacting with the Window Manager''.
After parsing the command line, PPPui sets the shell command to use when interpreting startup and shutdown commands. It then sets up a simple GUI containing a label, a ``quit'' button and a scrolled text console for displaying status information. PPPui also sets up a named pipe to the console, whose purpose is explained in the section ``Changes Required in PPP Utilities'', and it initiates the startup command and captures the output. After setup, PPPui's most important job is to wait around for something to happen. Here are the things it is waiting for:
PPPui works with the existing PPP utilities as is--almost. There is one required change and one optional change to effect the interface from the utilities to PPPui:
exec /usr/sbin/pppd debug lock modem crtscts\ /dev/modem 38400 asyncmap 20A0000 escape FF\ kdebug 0 -detach $LOCAL_IP:$REMOTE_IP\ noipdefault netmask $NETMASK defaultroute\ connect $DIALER_SCRIPT
if [ "$PPPUI_PIPE" != "" ] ; then exec 2>"$PPPUI_PIPE" ; fi exec /usr/sbin/chat -V
Figure 1 is a screen dump of PPPui taken ten seconds after I established a connection with Teleport, my ISP in Portland. The login sequence is captured in the console, and the clock ticks away in the upper left corner and on the title bar. If I iconify the client, the running clock appears with the icon or in the task bar (depending on your choice of window manager).
What about security and permissions? One more change to the utilities seems appropriate, and it is addressed in the sidebar, ``PPP Security and Those Pesky Run-Only Scripts''.
By adding a PPPui action to the window manager, you can make starting your PPP connection a one-click operation. I use FVWM95 as my manager; this line in my .fvwm95rc adds PPP startup to the FvwmButtons panel:
*FvwmButtons(Title 'teleport', \ Action 'Exec "Teleport Connect" \ PPPui -name "Teleport Connect" \ "/etc/ppp/scripts/ppp-on" \ "/etc/ppp/scripts/ppp-off" ppp0 &')PPPui has an additional option to facilitate interaction with FVWM95. The -small windowname argument causes the following two operations to occur after the connection is established:
To support the ``swallowing'' function of FvwmButtons, the following entry is needed in .fvwm95rc:
*FvwmButtons(Title 'teleport', Swallow \ (Useold Respawn) "pppui_swallow"\ Nop, Action 'Exec PPPui -name \ "Teleport Connect" -small pppui_swallow\ "/etc/ppp/scripts/ppp-on" \ "/etc/ppp/scripts/ppp-off" ppp0 &')It creates an invocation of PPPui that is swallowed into the button panel after the connection is established, as shown in Figure 2. (Unfortunately, the semantics of FvwmButtons cause the button to appear in a constantly-pressed state when the connection is not active, which is a bit distracting.)
PPPui replaces a hard-to-use and obscure user interface with a simple, intuitive graphical interface. The code for the PPPui program and the rscript utility are available by anonymous download in the file ftp://ftp.ssc.com/pub/lj/listings/issue50/2491.tgz.
Nathan Meyers is a staff consultant in Portland for a large electronics company, where he specializes in application performance of UNIX-based products. He can be reached at nmeyers@teleport.com.