PPP-2.4.5

Introduction to PPP

The PPP package contains the pppd daemon and the chat program. This is used for connecting to other machines; often for connecting to the Internet via a dial-up or PPPoE connection to an ISP.

This package is known to build and work properly using an LFS-7.0 platform.

Package Information

PPP Dependencies

Optional

libpcap-1.1.1 (needed to do PPP filtering) and Linux-PAM-1.1.5 (to authenticate incoming calls using PAM - only needed by ISPs).

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/PPP

Installation of PPP

[Note]

Note

PPP support (CONFIG_PPP), the asynchronous line discipline (CONFIG_PPP_ASYNC), the driver for your serial port device and/or the PPP over Ethernet (PPPoE) protocol driver (CONGIG_PPPOE) must be compiled into the kernel or loaded as kernel modules. Udev doesn't load the ppp_generic and pppoe modules automatically. If you compiled them as modules they can be loaded by the modules bootscript if they are mentioned in /etc/sysconfig/modules file.

Create (as root) the group for users who may run PPP:

groupadd -g 52 pppusers

Compile PPP by running the following commands:

rm include/linux/if_pppol2tp.h &&
./configure --prefix=/usr &&
make

This package does not come with a test suite.

Now, as the root user:

make install &&
install -d /etc/ppp/peers

Command Explanations

rm include/linux/if_pppol2tp.h: ppp-2.4.5 contains an out of date copy of the kernel header linux/if_pppol2tp.h. This needs to be removed to force it to use the one installed in /usr. If you don't remove this file the build will still succeed (thanks to a poorly written Makefile) but it will fail to compile the openl2tp.so, pppol2tp.so and rp-pppoe.so plugins:

install -d /etc/ppp/peers: This command creates a directory for PPP peer configuration files.

USE_PAM=y: Add this argument to the make command to compile in support for PAM, usually needed for authenticating inbound calls against a central database.

HAVE_INET6=y: Add this argument to the make command to compile in support for IPv6.

CBCP=y: Add this argument to the make command to compile in support for the Microsoft proprietary Callback Control Protocol.

Configuring PPP

Config Files

/etc/ppp/*

Configuration Information

Add the users who may run PPP to the pppusers group:

usermod -a -G pppusers <username>

Most internet service providers that use ppp give you a username and password for you to use to authenticate yourself when you connect to their servers. These secrets are kept in the files /etc/ppp/pap-secrets or /etc/ppp/chap-secrets. If you don't know whether your ISP uses CHAP or PAP then create both files and put the same content in both files.

If you have more than one ISP account the second column (remotename) is used to identify between the different usernames/passwords needed for the different ISPs. If you only have one ISP account an asterisk will work fine in the second column.

In this example the username given by the ISP is “jdoe”, the password is “guessit”, the ISP uses PAP and the user wants to give this account the remotename “dialup” in order to distinguish it from other PPP accounts:

cat >>/etc/ppp/pap-secrets <<"EOF"
# username      remotename    password
jdoe            dialup        guessit
EOF
chmod 600 /etc/ppp/pap-secrets
DNS Server Configuration

If you don't run your own caching DNS server (like BIND-9.8.1-P1) pppd can ask your ISP for its domain name servers and put them in /etc/ppp/resolv.conf. If you want to use their domain name servers:

mv /etc/resolv.conf{,.orig}
ln -s ppp/resolv.conf /etc
PPPoE connections

In order to configure a PPPoE connection, create a peer file that contains the connection details:

cat >/etc/ppp/peers/peername <<"EOF"
plugin rp-pppoe.so eth0

# Your username at the ISP. This is the same as the first
# column in /etc/ppp/*-secrets:
user "jdoe"

# remotename is not needed if you only have one ISP account and
# hence an asterisk in the second column in pap or chap-secrets:
# remotename "adsl"

# If it's not working and you want pppd to be
# more verbose in /var/log/sys.log, add debug:
# debug

# If you have a static IP address (eg, 12.34.56.78) you
# can specify it by following it with a colon:
# 12.34.56.78:

# Otherwise accept whatever IP address the ISP gives you:
noipdefault

# The settings below usually don't need to be changed
noauth
hide-password
updetach
defaultroute
# create /etc/ppp/resolv.conf:
usepeerdns

### For more details (and more options)
### read man pppd
EOF
chmod 600 /etc/ppp/peers/peername
PPPoATM connections

PPPoA connections are very similar to PPPoE, the main differences are that you use the pppoatm.so plugin instead of rp-pppoe.so, you don't specify the ethernet interface (it uses ppp0) and you need to VP/VC numbers that are used by your ISP (there is a list of VP/VC numbers here )

cat >/etc/ppp/peers/peername <<"EOF"
plugin pppoatm.so

# Your VP/VC numbers. eg, in Britain it is 0.38, in
# France they use 8.35. Google is your friend :)
0.38

# Your username at the ISP. This is the same as the
# first column in /etc/ppp/*-secrets:
user "jdoe"

# remotename is not needed if you only have one ISP account and
# hence an asterisk in the second column in pap or chap-secrets:
# remotename "adsl"

# If it's not working and you want pppd to be
# more verbose in /var/log/sys.log, add debug:
# debug

# If you have a static IP address (eg, 12.34.56.78) you
# can specify it by following it with a colon:
# 12.34.56.78:

# Otherwise accept whatever IP address the ISP gives you:
noipdefault

# The settings below usually don't need to be changed
noauth
hide-password
updetach
defaultroute
# create /etc/ppp/resolv.conf:
usepeerdns

### For more details (and more options)
### read man pppd
EOF
chmod 600 /etc/ppp/peers/peername
Dialup Modem Connection

Dialup connections are established with the help of a modem connected to a computer and the telephone line. The modem dials a telephone number of the ISP's modem, and they exchange data using the signal frequencies 300-4000 Hz. Typical data transfer rate is 40-50 kilobits per second, and the gateway ping time (latency) is up to 300-400 ms. In order to configure the dialup connection, it is required to know the telephone number of the ISP's modem pool, the username and the password.

In order to configure a dialup connection, two files have to be created: a chat script that automates the connection procedure (common for all dialup accounts), and a peer file that provides configuration information about a specific connection to pppd:

cat >/etc/ppp/dialup.chat <<"EOF"
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED
ABORT ERROR ABORT BLACKLISTED

TIMEOUT 5
'' AT
# \T is the phone number, passed from /etc/ppp/peers/dialup
OK-+++\dATH0-OK ATD\T
TIMEOUT 75
CONNECT \d\c
EOF

cat >/etc/ppp/peers/dialup <<"EOF"
# Your username at the ISP
user "jdoe"
# What should be in the second column in /etc/ppp/*-secrets
remotename "dialup"
# Replace TTTTTTT with the ISP phone number
connect "/usr/sbin/chat -T TTTTTTT -f /etc/ppp/dialup.chat"

# Specify your modem serial port and speed below
/dev/ttyS0
115200

# The settings below usually don't need to be changed
updetach
noauth
hide-password
debug
lock
defaultroute
noipdefault
usepeerdns
EOF

The first three lines of the /etc/ppp/dialup.chat file abort the script when it receives an indication of an error from the modem. Then the timeout is set to 5 seconds and the script checks that the modem responds to the dummy AT command. If not, measures are taken to dewedge it (by interrupting the data transfer and going on hook). Then the telephone number is dialed, and the script waits for the answer for 75 seconds. The serial connection is considered established when the modem sends the string CONNECT.

GPRS and EDGE Connections

GPRS and EDGE connections are established with the help of a cellular phone connected to a computer via serial, USB, or Bluetooth. The phone exchanges data packets with the nearest base station, which can be up to 35 kilometers away. The maximum possible data transfer rate is 170 kilobits per second for GPRS and 474 kilobits per second for EDGE, but many cellular operators impose lower limits, such as 64 kilobits per second. The gateway ping time is 900 ms for GPRS, which makes playing many online games impossible and causes connection to ICQ to be unreliable. In order to configure a GPRS or EDGE connection, it is required to know the access point name (APN) and, rarely, the username and the password. In most cases, billing is based on the telephone number, and the username/password pair is not needed, as assumed in the example below.

In order to configure a GPRS connection, two files have to be created: a chat script that automates the connection procedure (common for all GPRS accounts), and a peer file that provides configuration information about a specific connection to pppd:

cat >/etc/ppp/gprs.chat <<"EOF"
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED
ABORT ERROR ABORT BLACKLISTED

TIMEOUT 5
'' AT
OK-+++\dATH0-OK ATZ
# \T is the APN, passed from /etc/ppp/peers/gprs
# This example stores the APN as profile #1 in the phone.
# The "telephone number", *99***<profile_number>#, is always the same.
# If you want to store this as profile #2, change 1 to 2 in the
# following two lines.
OK AT+CGDCONT=1,"IP","\T"
OK "ATD*99***1#"
CONNECT \d\c
EOF

cat >/etc/ppp/peers/gprs <<"EOF"
# Replace inet.example.com with the proper APN for your provider
connect "/usr/sbin/chat -T inet.example.com -f /etc/ppp/gprs.chat"

# Specify your cellphone serial port and speed below
# Note: you must manually send some vendor-specific AT commands
# to certain old cellular phones (such as Sony-Ericsson T200)
# in order to achieve connection speed more than 9600 bits per second.
/dev/ttyS1
115200

# The settings below usually don't need to be changed
noccp
noauth
updetach
debug
lock
defaultroute
noipdefault
usepeerdns
EOF
Establishing the connection manually

In order to establish a PPP connection described by the /etc/ppp/peers/peername file run (as root or as a member of the pppusers group):

pppd call peername

In order to stop the connection, run:

killall pppd

Writing a bootscript that brings up the connection during the boot process is left as an exercise for the reader ;)

Contents

Installed Programs: chat, pppd, pppdump, pppoe-discovery and pppstats
Installed Libraries: Several plugin modules installed in /usr/lib/pppd/2.4.5
Installed Directories: /etc/ppp, /usr/include/pppd and /usr/lib/pppd

Short Descriptions

chat

defines a conversational exchange between the computer and the modem. Its primary purpose is to establish the connection between the Point-to-Point Protocol Daemon (PPPD) and the remote pppd process.

pppd

is the Point to Point Protocol daemon.

pppdump

is used to convert PPP record files to a readable format.

pppoe-discovery

performs the same discovery process as the pppoe plugin, but does not initiate a PPP session.

pppstats

is used to print PPP statistics.

Last updated on 2011-11-17 17:27:16 +0000