Configuration Information
The PPP daemon requires some
configuration. The main trick is scripting the connection. For
dialup and GPRS connections, this can be done either using the
chat program which
comes with this package, or by using external tools such as
WvDial
or KPPP from kdenetwork-3.5.9. The text below explains
how to set up dialup and GPRS and PPPoE connections using only
tools provided with the PPP
package. All configuration steps in this section are executed as
root
user.
Add the users who may run PPP to
the pppusers
group:
usermod -a -G pppusers <username>
Warning
Instructions in this section result in your password
appearing on the screen in a visible clear-text form. Make
sure that nobody else looks at the screen.
Passwords are stored in /etc/ppp/pap-secrets
and /etc/ppp/chap-secrets
files, depending on the
authentication method used by the ISP. If in doubt, place the
password into both files. E.g., if the username given by the
ISP is “jdoe”, the
password is “guessit”,
the ISP uses PAP and the user wants to name this account
“dialup” in order to
distinguish it from other PPP accounts, the following file has
to be created:
touch /etc/ppp/pap-secrets
chmod 600 /etc/ppp/pap-secrets
cat >>/etc/ppp/pap-secrets <<"EOF"
# username remotename password IP for the peer
jdoe dialup guessit *
EOF
If you don't run your own caching DNS server, create a simple
ip-up script (to
be called by pppd
automatically once the connection is brought up) that populates
the /etc/resolv.conf
file with
nameservers specified by the ISP.
cat >/etc/ppp/ip-up <<"EOF"
#!/bin/sh
if [ "$USEPEERDNS" = "1" ] && [ -s /etc/ppp/resolv.conf ]
then
install -m 644 /etc/ppp/resolv.conf /etc/resolv.conf
fi
EOF
chmod 755 /etc/ppp/ip-up
If you use a caching DNS server such as BIND-9.4.1-P1
or Pdnsd, the
script above is wrong for you. In such case, write your own
script that tells your caching nameserver to forward queries to
upstream DNS servers specified in the $DNS1 and $DNS2
environment variables.
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 at all. 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 or USB cable,
or using 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 ber second.
/dev/ttyS1
115200
# The settings below usually don't need to be changed
noccp
noauth
updetach
debug
lock
defaultroute
noipdefault
usepeerdns
EOF
PPPoE connections are established over Ethernet, typically
between a computer and an ADSL router (usually installed in the
same room) that forwards the packets down the telephone line
using frequencies 25-2500 kHz, thus not interfering with voice
calls. Although the router can, in theory, forward any Ethernet
packet, PPP encapsulation is used for password-based
authentication, so that the ISP can limit the bandwidth and
charge money according to the chosen tariff. The maximum data
transfer rate on ADSL is 24 megabits per second, and the
gateway ping time is typically less than 10 ms. In order to
configure a PPPoE connection, it is required to know the
username, the password, and, sometimes, the service name and/or
the access concentrator name.
In order to configure a PPPoE connection, only the peer file
has to be created:
cat >/etc/ppp/peers/adsl
<<"EOF"
plugin rp-pppoe.so
# Ethernet interface name
eth0
# Your username at the ISP
user "jdoe
"
# What should be in the second column in /etc/ppp/*-secrets
remotename "adsl
"
# If needed, specify the service and the access concentrator name
# rp_pppoe_service "internet
"
# rp_pppoe_ac "ac1
"
# The settings below usually don't need to be changed
noauth
hide-password
updetach
debug
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:
pon peername
In order to tear the connection down, run:
poff peername
Bringing up PPPoE
connection at boot time
If your service provider does not charge by the minute, it is
usually good to have a bootscript handle the connection for
you. You can, of course, choose not to install the following
script, and start your connection manually with the
pon command, as
described above. If you wish your PPPoE connection to be
brought up at boot time, run:
make install-service-pppoe
The above command installs the pppoe
service script and the /etc/ppp/peers/pppoe
file with some settings
that make sense for most PPPoE connections. The bootscript
calls pppd with
the the following options:
pppd call pppoe ${1} linkname ${1} ${PPP_OPTS}
Here “${1}” is the
network interface name, “linkname
${1}” is added for creation of the /var/run/ppp-${1}.pid
file with the
pppd process ID
(to be used when bringing the connection down), and the
“${PPP_OPTS}” variable
contains user-specified options such as “user” and “remotename”.
Now create the config file for use with the pppoe
service script:
install -v -d /etc/sysconfig/network-devices/ifconfig.eth0 &&
cat > /etc/sysconfig/network-devices/ifconfig.eth0/pppoe << "EOF"
ONBOOT="yes"
SERVICE="pppoe"
PPP_OPTS="user jdoe
remotename adsl
"
EOF
Note
Instead of specifying additional options in the $PPP_OPTS
variable, you can also edit the /etc/ppp/peers/pppoe
file, but then your
configuration will be lost when upgrading BLFS bootscripts.