[ Contents ]
[ Prev ]
[ Next ]
The PPP Daemon
- The PPP daemon - pppd - is the program that handles the PPP connection,
even if you use a graphical front-end, such as kppp.
- pppd manages the dialing process (often using a separate program) and
then negotiates the connection with your ISP.
- The negotiation process includes a set of steps, using a set of protocols
such as LCP (Link Control Protocol), authentication protocols, NCP
(Network Control Protocol) and IPCP (Internet Protocol Control Protocol).
- Each of these "curses" denotes a step in the PPP connection setup. If the
connection fails, determining which sub-protocol caused the failure is
half the way to locating the configuration problem.
Command-Line Arguments For pppd
- pppd is usually invoked with two command line parameters:
pppd /dev/ttyS0 57600
- The first parameter denotes the name of the modem device. 'ttyS0' stands
for COM1, 'ttyS1' stands for COM2, etc ('S' is short for
'serial', for the 'serial port').
- The second parameter is the speed of the communications between your
computer and your modem. Note that the connection speed between your modem
and the modem of your ISP might be different.
- By supplying only these two parameters, we assume that the rest of the
parameters are supplied via standard pppd configuration files.
pppd Configuration Files
- The configuration files of pppd are stored under directory /etc/ppp/.
- The 'options' file contains commands-line options to be used when pppd
runs. These complement the options actually supplied to pppd on the
command line.
- The 'pap-secrets' file contains information used to authenticate with
an ISP that uses the PAP method. This information contains the user's
password in clear text, and thus this file should be made readable only
by root.
- The 'chap-secrets' file contains similar information for authenticating
using the CHAP method, and should be protected in a similar manner.
- The 'ip-up' file may contain a script that will be executed by pppd, after
it establishes a connection. The 'ip-down' file may contain a script that
will be invoked by pppd after it closes the connection.
Typical pppd 'options' File
A typical pppd 'options' file might look like the following. Lines beginning
with '#' are comments.
# lock the modem device, to avoid another process trying
# to use it.
#
lock
#
#
# after connecting to the ISP, make the default route of
# the system go via this PPP connection. This means all
# packets not meant for the local network, will go out
# via the modem.
#
defaultroute
#
#
# use the given chat script in order to perform the dialing
# and possibly the login script as well.
#
connect '/usr/sbin/chat -v -f /etc/ppp/chat-script'
#
#
# use hardware flow-control between the computer and the
# _local_ modem, to avoid data loss.
#
crtscts
#
#
# the name of the user with which we intend to login to
# the remote system. This will be used when looking up
# the password in the 'pap-secrets' or 'chap-secrets'
# file.
#
user choo
#
#
# do not require the remote side to authenticate to us.
#
noauth
#
Note: this setup is good if you only want to connect to one ISP using one
account. If your linux system is used by several users with several accounts,
or you have more then one account, a more complicated setup is needed.
Typical chat Script File
The chat script described above looks like this:
# define inputs after which we should abort the connection.
#
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"
ABORT "BUSY"
#
# the following is a set of 'expect' and 'send' sequences.
# chat waits for the first string, and if received, sends
# the second string.
#
# expect - nothing. send - modem reset command (atz).
"" "atz"
# expect - OK. send - modem initialization string.
OK "at&d0&c1"
# expect - OK. end dial command with ISP's modems number.
OK "atdt8319000"
# expect a connection string (CONNECT) and then we're done.
"CONNECT"
Typical pppd 'pap-secrets' File
The 'pap-secrets' file would contain lines, each containing a user name,
the '*' sign, and a password (in clear text). Here is an example:
# Secrets for authentication using PAP
# client server secret IP addresses
choo * mypasswd
Note that the 'choo' is my login name on the ISP's system, which is not
necessarily the same as my login name on my Linux system.
Dialing, Logging And Debugging And Disconnecting
- When we launch pppd, it immediately sets itself in to the background,
and only then starts dialing.
- pppd logs all its operations to the system log file, /var/log/messages .
- chat also logs all the dial sequence into the same file, due to the
usage of the '-v' flag.
- Running the command 'tail -f /var/log/messages' in a terminal, right
after launching pppd, would show us the connection's progress.
- If the connection is not made properly - look at the log messages and try
to understand where the problem is - and what the problem is about.
- Note that using the log messages could be useful also for figuring out
problems when dialing out using kppp.
- In the worst case, pppd supports an option called 'debug', that causes
much more verbose printing of messages. Using this option requires
configuration of the system log daemon (syslogd). For more info, read
the man pages of 'pppd', 'syslogd' and 'syslog.conf'.
- When we want to disconnect, we need to kill the 'pppd' process. An
easy way to do that:
killall pppd
[ Contents ]
[ Prev ]
[ Next ]