Back to Home News The FYP Page Linux: The Real OS Projects Links Page
  Linux Topics
    Hints & Tips
    PPP & Tinet
    Apps to Use
    Getting Linux
    Program Development  

Introduction
  One of the most common ways under Win95 of getting on the internet is using the Point to Point Protocol or PPP. This is no different under Linux but it is more difficult to setup. For more information on PPP and other topics check out the Linux Documentation Project's HOWTOs. These provide in-depth information on various topics. On this page I will outline what I use to get on-line and list the scripts used. This applies only to TINet but the scripts can be modified to work with other ISPs.

PPP, PAP, CHAP
  PPP is the basic protocol but PAP and CHAP have added authentication to the protocol. When I first setup my PPP connection I asked a technician on TINet's "technical" help, he didn't know. So using minicom I ruled out PPP, as no "Login:" or "Password:" prompts appeared (as happens with IOL). By setting up both PAP and CHAP, I was able to narrow it down to CHAP.

Fire up the Editor
  The first file to open is /etc/resolv.conf. In this file include the nameserver for TINet. I have the following:

nameserver 159.134.237.6
This is the sever that resolves the likes of http://www.tinet.ie from a URL into an Internet Protocol (IP) address. The next file to edit is /etc/ppp/options. This is read by pppd when it starts. My options file contains the following:
lock                # lock up the device
defaultroute        # add a default route to the routing tables 
noipdefault         # implies we have a dynamic IP
modem               # Use the modem control lines
/dev/cua0           # Com port the modem is on
115200              # Max speed 
crtscts             # Use hardware flow control (i.e. RTS/CTS) 
                    # to control the flow of data on the serial port
debug 7             # log debug messages
passive                  
asyncmap 0
name "clernong"     # Set the name of the local system for 
                    # authentication purposes to "clernong"
                    # Used to extract password later 
ipcp-accept-local
ipcp-accept-remote
0.0.0.0:10.10.10.10
For more information check the Linux HOWTOs on PPP. If you know what com port the modem is on under DOS/Windows, it will map to the corresponding device under Linux, com1 maps to cua0, com2 to cua1 etc. Also the device (e.g. /dev/cua0) should be linked to /dev/modem. This can be done by typing as root ln -sf /dev/cua0 /dev/modem. For authentication of PAP, a pap-secrets file is required. CHAP has a corresponding chap-secrets file. Both are kept in the /etc/ppp directory. pap-secrets contains
# PAP authentication file: /etc/ppp/pap-secrets
# This file should have a permission of 600.
# ~# chmod 600 /etc/ppp/pap-secrets
# Username      Server      Password      IP addresses
"clernong"   *   "your_password"
with chap-secrets having
# CHAP authentication file: /etc/ppp/chap-secrets
# This file should have a permission of 600.
# ~# chmod 600 /etc/ppp/chap-secrets
# Username      Server      Password      IP addresses
"clernong"   *   "your_password"
*   "clernong"   "your_password"
For both files change clernong to your TINet username and your_password to your TINet password.

Two More Scripts
  Once all the above files have been set up we need to have a script that will start pppd and talk to the remote host. I do this by using the following script. It starts pppd and passes the appropriate parameters.

/usr/sbin/pppd connect '/usr/sbin/chat -v -f /etc/ppp/pppscript' \
/dev/modem 115200 && sleep 2 
	    
This script will start pppd, using connect to tell pppd to start chat with the specified script, tell it what device to use and at what speed. The highest possible speed of 115200 (assuming you have 28.8kbps or greater, if not halve this max speed) is used as the actual speed will usually be negotiated between the remote and local hosts. This should allow the connection to run at the highest possible speed. The sleep 2 is useful when the script is run from within a program, it will prevent the process from immediately exiting once pppd has started. chat is used to talk to the modem i.e. to initialize and dial the modem.
The listing below is the contents pppscript, which is passed to chat. This informs chat of what to do in case any of the listed events occur. If everything is ok, the modem is initialised and the number dialed.
ABORT ERROR
ABORT BUSY
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT VOICE
"" ATZ
OK ATDT1891100100
CONNECT 
	    

The Kernel
  For all this to work it is necessary that PPP is built into the kernel. When booting up you should see a message telling you the PPP is being registered. You can also tail -100 /var/log/messages | grep PPP to check if PPP has been registered during bootup. If it hasn't you may be able to add it in as a module. Instead of having to load the module manually, you can re-compile the kernel to include the module required by PPP. Once again a good place to start are the Linux HOWTOs.

Starting and Stopping
  In its current configuration you need to be root to go online. There are several options available to allow other users to go online.

  1. Create a group that has access to these scripts etc. This still does not allow you to kill off pppd. You will need to be root.
  2. Change the permissions on pppd so that it executed as suid root, this gives pppd root privs while being run by an ordinary user. This is a potential security hole but it is more convienent. As root type chmod u+s pppd in the directory containing pppd.
  3. A variant on 2 is to wrap the start and stop of script in a program that can limit access by verifing the user against a file. I use wmppp to achieve this.

The Last Word
  Well, I hope all that made some sense and you're now on-line via Linux. If it works for you or you have any comments or suggestions drop me a line.



[Home | News | FYP | Linux | Projects | Links]

© Copyright 1998, George Clernon
Last modified: Wed Oct 7 20:14:06 IST 1998