Linux Step By Steps
 
PPP Client
TESTED ON COL2.2 

Author: mikea@norfolk.nf

This write-up uses no fancy icon or gui. Just a simple enough shell script of a dozen lines or so, to get you connected.  It works inside or outside the gui just as well. More importantly, it gets over the dreaded 'user /root' conflict of attempting such a simple thing as dialling your ISP.. 

BUT.....  Your mileage will vary using this StepByStep. It works for me, and most standard ISP implementations. It is 
tested for PAP and SCRIPT based logins. You are on your own for CHAP and MSCHAP. It also assumes no static IP #'s. 


Some background (sadly) before you go Stepping. You can safely skip this waffle if you're impatient. 

PPP, Point to Point Protocol is, additionally, a peer to peer connection. It is a nightmare to setup because of these two reasons. Most documentation confuses you between being a client, and a server. You, my child are a client. Perversely, ppp doesn't care which you are. 

You can't go over it, can't go past it, can't go under it. PPP is *the* IP component of TCP / IP and is your connection to the outside world. Don't bother looking for 'easier' software to install, ppp is inside your kernel! 

pppd is the dIALLER / dAEMON portion of ppp. It assumes a serial connection, using modems. (this is a white lie, but let's move on). 

pppd proper very simply connects ppp in the kernel to your machine's existing environment. As in, your hostname and your current ip address(es), then establishes routing, changes permissions on serial lines, etc. It has sufficient additional smarts to look for scripts for pre and post processing. It's this, that makes it complex. 

pppd becomes complicated because 

1) it is part of the kernel, runs as root, and you as a user, not root, have to jump through hoops to get 'at it'.
2) It is agnostic which way a connection is established. A dial in can initiate ppp as much as a dial out.
   You have to jump through hoops to work the dial out side of ppp. 

The files you are most interested in are the shell scripts. These scripts can be located anywhere and called anything, but, the accepted location is 

/etc/ppp/ppp-on
/etc/ppp/ppp-off

additional files called 

/etc/ppp/options
/etc/ppp/pap-secrets
/etc/ppp/chap-secrets

can be useful to you, should you choose to use them. 

Finally, a third set of files 

/etc/ppp/ip-up
/etc/ppp/ip-down 

are used to do post processing after a connection has been made. Entries like "sendmail now" could be placed in there. 

and lastly 

/etc/ppp/ppp-errors 

provides diagnostics fail messages. 

If you concentrate on the files ppp-on/off and ignore the rest, things will become clear as they aren't required.


STEP ONE: Get your facts right. 

You need 

1) your login name to your ISP. Do not confuse this with your username(s) on your computer.
2) your password.   "ditto"
3) the ISP tel #
4) the ttyS? that your modem is connected to. (internal / external, both are the same) 

ttyS0= (com1)
1 (com2)
2 (com3)
3 (com4) 

and that's IT. 

STEP TWO: Tidy up. 

This step is not necessary, but..... 

/var/log/messages is the hidey hole for kernal messages. It's big. Filter out the stuff you want to see as follows 

Edit /etc/syslog.conf and place somewhere near the top 

daemon.*/var/log/ppp  # use TAB *not* spaces 

/etc/rc.d/init.d/syslog reload

However, having done this, the remaining Steps are going to avoid every attempt at diagnostic messages to keep the noise levels down. Where appropriate, a footnote is added to show you how to turn on warnings. 

STEP 3: fix resolv.conf 

cat /etc/HOSTNAME 

or simply type

hostname 

In my example it comes back to me saying 

"mikea.home"

edit /etc/resolv.conf 

add alter or change the following entry 

domain home 

(there is an additional requirement here to have your DNS server's entry, it is outside the scope of this SxS). For now it's not going to assist you one jot in getting connected, and that's what's bothering you right?) 

STEP 4: fix security 

enter the following into 

/etc/host.conf
order hosts,bind
multi on

don't be surprised if the above two steps are already 'ok' 

STEP 5:

As Monty Python  have said, there is no rule #5 so let's move on to rule #6. 

STEP 6: Change Permissions and chowns 

This is quite a large step because it does need some explanation. 

ppp(d) is a kernel process. It runs as root. You, as a user, not root, would like to dial an ISP. To do so you have to massage some permissions and chowns to get that to happen. You can ignore this step if you always dial in as root.  People who do also like Russian Roulette as a pastime. 

There are two 'methods'

1) Set SUID or 

2) chown 'user' groups so that (nearly) all processes belong to a 'group' that the user can belong to as well. 

This Step basically follows the SUID approach, (the other will be detailed in a later edition of this SxS) 

chmod 666 /dev/ttyS* (initially set to 660 on install)
chown root /dev/ttyS* 

Regardless of specific modem port, do the lot. (Later on, unknown to you, ppp alters the specific serial port to 644) 

do NOT use the /dev/modem link even if you have one. 

chmod 755 /usr/sbin/pppd
chmod u+s /usr/sbin/pppd 

What you are doing here is, regardless of your user name, you are temporarily becoming root user to bring the line up. 

STEP 7: running script 

Scripts which come with the ppp package do *not* work. The major reason is they assume you have path to /usr/sbin.  Use this one. 

The file we are interested in is 

/etc/ppp/ppp-on 

You can place this script-file anywhere you like and call it anything you like 'my-isp' might suffice, but this SxS
refers to ppp-on (and -off).

scrap what's there and enter the following: 

For Script Based ISP's 

#!/bin/sh 

TELEPHONE=12345
ACCOUNT=fred
PASSWORD=nirks
MODEM=/dev/ttySX 
SPEED=57600
export TELEPHONE ACCOUNT PASSWORD # for chat use 

exec /usr/sbin/pppd $MODEM $SPEED  lock crtscts modem defaultroute \
connect '/usr/sbin/chat "" ATDT$TELEPHONE CONNECT "" ogin: $ACCOUNT   word: $PASSWORD' 

MAKE CERTAIN 'connect' IS ONE CONTINUOUS LINE, OR CHAT WILL FAIL. 

There are methods to avoid this, but this StepByStep is big enough as it is. 

X == 0,1,2 or 3 defined in Step One 

No further comment should be necessary about the phone, account, and password entries. 

For PAP Based ISP's 

#!/bin/sh 

TELEPHONE=12345
MODEM=/dev/ttySX 
SPEED=57600
ACCOUNT=fred
export TELEPHONE # for chat use 

exec /usr/sbin/pppd $MODEM $SPEED  lock crtscts modem defaultroute \
user $ACCOUNT \
connect '/usr/sbin/chat "" ATDT$TELEPHONE CONNECT "" ' 
 

On Sprint based ISP's
user $ACCOUNT noauth noipdefault demand \

The ONLY tricky thing here is you need one more Step for PAP 

STEP 8: PAP ONLY

edit /etc/ppp/pap-secrets 

insert the line 

fred * nirks 

STEP 9: Permissions cleanup 

chmod 600 /etc/ppp/pap-secrets
chmod 600 /etc/ppp/options (more on this file later)
chmod 750 /etc/ppp/ppp-on
chmod 750 /etc/ppp/ppp-off
chown root.users /ppp-o*

Here is the output of my /etc/ppp
-rw-------   1 root     daemon          78 Apr 29  1999 chap-secrets
-rwxr-xr-x   1 root     root           315 Apr 29  1999 ip-down
-rwxr-xr-x   1 root     root           312 Apr 29  1999 ip-up
-rw-------   1 root     daemon          58 Jan 23 01:25 options
-rw-------   1 root     daemon          98 Jan 23 01:25 pap-secrets
-rwxr-x---   1 root     users          967 Jan 23 01:24 ppp-off
-rwxr-x---   1 root     users          500 Jan 23 01:24 ppp-on 

STEP 10: Become a Groupie 

edit /etc/group

find the entry 'users' 

add your username (not your ISP login, your USER name[s] to this group. Ie the names you use on YOUR computer).
It should resemble:

users::100:ted,pete,mary,joe 

If you have trouble here understanding the syntax type man group 

STEP 11: Ready Set GO.

from a console login type 

/etc/ppp/ppp-on

The modem should start chattering, and should connect. To test it try a ping to a known ip number such as the one for yahoo.com

STEP 12: Ready Set STOP. 

/etc/ppp/ppp-off

I am not mentioning anything further about this script file, it should already be in /etc/ppp, otherwise do a locate ppp-off

STEP 13: (Lucky last). Adding desktop icons 

From your home page kde browser button hunt down /etc/ppp

Simply drag and drop shorcuts (links) from ppp-on ppp-off to the desktop. It's that simple.
 

ADDENDA #1: When things go bang.

The above scripts are written to create minimal blurb. If you need to look at /var/log/ppp (mentioned right at the beginning of this SxS) you can enhance the messages adding options to the scripts as follows 

chat add the option -v (or -s)
pppd add the option debug (or kdebug=2)

Additional error info is stored in /etc/ppp/ppp-errors 

ADDENDA #2: /etc/ppp/options.

/etc/ppp/options is a useful file for you to go further 

The options mentioned in step 7 can be placed here instead. Items like 

lock
crtscts
modem 
defaultroute 

This 'feature' can be useful when you have multiple isp accounts.