LINUX PPP Dial-in Scripts for Internet Direct Users:

Click here for an update. (Jul 24/2000)

Before we begin, I would like to have a chance to introduce a software that in my opinion, is superior to the ppp scripts that I describe below, and that is kppp. kppp normally runs in the K-Desktop Environment (KDE) that currently distributes with Caldera, by default. However, be assured that it also runs under other desktops like GNOME/Enlightenment and fvwm (I've tried both). The kppp package encapsulates the configuration and login session in a graphical user interface that makes internet connections both secure and easy. Unlike the ppp scripts below, your password is encrypted. Though configuration is "brain-dead" (meaning that you don't need to use yours), you still need to know some information in advance: 1) the phone number of your ISP; 2) the port number of your modem (where COM1 is /dev/ttyS0 in Linux; COM2 is /dev/ttyS1; COM3 is /dev/ttyS2; and COM4 is /dev/ttyS3 -- Pick the one that is correct for your computer). 3) the IP numbers for your a) gateway, and b) nameserver(s). For those subscribing to Internet Direct, the IP numbers can be found on their website (currently: Click on "Support", then on "Settings" on the sidebar).

I maintain these pages despite my new-found use of kppp, for those who do not use windows, and prefer to stick to a tty-based login session. ppp-on and ppp-off are scripts that are GUI-less and therefore work well in a tty-based login.

Users are advised to debug these scripts as they have been optimised for Internet Direct. This is especially true for the chat scripts. Other users can see the chat script as a "worst-case scenario" in terms of encountering duplicate strings in the host's output, for example. Explanations will be given throughout, to show at least some kind of rationale as to how the scripts work. This is offered to you as just that: a rationale, not an air-tight theoretical foundation.

Please read the LINUX PPP-HOWTO before reading this document. Also recommended but not required (I did OK without it) is the book Running Linux by Welsh and Kaufman (now in its third edition).

The kernel I have been using is version 2.0.33, and more recently 2.0.35. For whatever reason, I did not get consistent behaviour with version 2.0.30, and I recommend you compile any Linux kernel version 2.0.33 or greater. I am not sure as to what happens with the 2.2.x kernels, since I have been mostly using kppp. My own superficial testing has shown that the scripts do not seem to work the way it is expected. But that may be because I hadn't fiddled with it enough.

What to do now (or advice without the detail):
  • If you are NOT running X:
    • Monitor your progress. Run ppp-on to dial in to Internet Direct. Go immediately to /dev/tty10 using LEFT ALT+F10 to watch the output. The ouptut usually "stops" (as far as PPP is concerned) when it reports the remote and local IP numbers. If you haven't switched ttys and used multiple shells before, read this.
    • Test your PPP Connection. If there are no apparent problems (ie, the chat responses appear exactly where you expect and there are no error messages), then test to see if you are really connected by returning to a screen that is running a shell and run the command route -n. You should get a display like this. If you see an output that is similar, you are in business, and you can skip the rest of this table.
      • If you are still not connected double-click on to the remote IP number, now go back to the original screen. If not, log into another tty and issue the " route add ..." command as described in the PPP-HOWTO. In place of the "", simply paste the IP number to the command using the right mouse button.
  • If you are running X,
    • Monitor your progress. xconsole should be running and displayed on the screen. Highlight the remote IP number and paste it to an xterm where you have typed the beginning part of a route add command.
    • If you are running the RedHat distribution 4.0 or later, then another way to see the tail output is not to run tail at all, but to go to the "System Commands" menu, and select "Msgs". This runs a tail output to an xterm in a separate window. This selection was seen in my fvwm2-95 by clicking on the desktop.
    • Either way, if your display looks like this, then you are done.

PPP Tips

Without the Super User permissions set, it should still be possible for any user to run PPP applications like Netscape, nc-ftp, xrn, pine, or nn-tk. However, without pppd being set as suid root, and without other files set as executable, it will be impossible for other users to dial in and hang up the modem. Changing permissions is easy, once you know what to change.

Also, once a user has dialed that modem, the same user has to hang it up. The only other user who can hang it up is root. Conversely, if root does the dialing, no one else can hang it up.

Check out the following sources. These source files come with blow-by-blow descriptions of how they were made, when applicable.


Source for /etc/scripts/ppp-on-dialer

The script pointed to below will work most of the time. In my experience, there are a few times when it misses its cue and inserts my username and password in the wrong parts of the chat session. These occurences are rare, however.

Let's regard chat scripts in the same way as a script for some minimalist play (like say Happy Days, by Samuel Beckett or Waiting For Godot). In a minimalist play, you probably have two "talking heads" on stage, saying their lines without much else in the way of setting or anything else embellishing it. One person says his line, then the other responds. And then you repeat this several times, until the play is over. (So much for an appreciation of modern drama!)

But that is how chat scripts work. Your script dials the number, then when it gets a string from the remote host, it issues the appropriate responses on-cue. In fact, it is an automated login. You need to know how your host is going to respond so that you know what strings to expect. What are your host's prompts for your login name? Your password? At what point do you let your host know that you intend to make a ppp connection? Once you have given the ISP word of your intention that you want to hook up via ppp, you are essentially done. Before that, however, you need to know what strings to expect so that you know what to respond with. They have, in fact, been given the ingenious name "expect strings".

PPP scripts these days tend to work straight out of the box in most Linux distributions. Just about the only thing you need to do nowadays - especially with dedicated PPP lines that most ISPs have - is to edit ppp-on for your username, password, and phone number for the ISP of your choice.

Click here to see how to write your own 'ppp-on-dialer' script.
You might need to do something like this if your login process has a lot of intervening text apart from the usual "login:" and "Password:" prompts. This must be sorted out, since a poorly written PPP script will respond off-cue, and as a result you will not get logged on. This script was written as a result of my first experiences with PPP, before my ISP had dedicated PPP phone numbers to dial into.

Click here to see the script. This script in particular works on my current system, and will be different from the 'write-your-own' version described above.

The version on the following link works for dialups where the ISP has PPP in mind. That is, the ISP does not issue any more text than simply the Username and Password (and probably the FQDN of the machine you are logging on to and thus the script described here is very straightforward.

Source for /etc/scripts/ppp-on:

This is the main script which performs the job of setting and exporting the variables, dialing the number, and calling the chat script through the "pppd" command.

Click here to see the script.

Source for /etc/scripts/ppp-off:

This is the script which, as the name suggests, turns off ppp. This, as far as I can remember, has been un-modified from the original distribution.

Click here to see the script.

Source for /etc/scripts/options:

This file is used to store additional options for the pppd command. This is just a single line, and has the default option that came with the package when it was first installed.

Return to the Main Page

since Apr 1 2007