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
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
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
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 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 ;)