Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Debian GNU/Linux Reference Guide
Prev Home Next

10.2.4 Configuring a PPP interface

If you access the Internet through a modem connected to a dial-up telephone line then the connection is negotiated using the Point-to-Point Protocol (PPP). Such connections are accessed as network interface ppp0, ppp1, and so on.

A PPP interface is managed by the PPP daemon pppd which comes in the ppp package. Thus, for the user, configuring a PPP interface means configuring pppd.


10.2.4.1 Configuring pppd manually

For a network link to be established, a communication port (usually a serial port) needs to be opened, commands have to be sent to a communication device (usually a modem), a telephone number may have to be dialed, identity has to be authenticated to a foreign PPP daemon, a PPP interface has to be created by the kernel and then routing tables have to be modified so that traffic can be sent over the link. pppd can do all of this and consequently has a very long list of operating options. These options are described in pppd(8).

On a Debian system, global options are set up in /etc/ppp/options. User-specific options are set up in ~/.ppprc. Options that must depend on the communication port used are stored in /etc/ppp/options.portname. For example, suppose you have two modems—a built-in Lucent LT modem accessed through /dev/LT-modem and an external modem accessed through /dev/ttyS0. Create the following two options files.

     # cat > /etc/ppp/options.LT-modem <<EOF
     115200
     init "/usr/sbin/chat -f /etc/chatscripts/setup-LT-modem"
     EOF
     # cat > /etc/ppp/options.ttyS0 <<EOF
     115200
     init "/usr/sbin/chat -f /etc/chatscripts/setup-ttyS0"
     EOF

These refer to the following chat scripts. First, /etc/chatscripts/setup-LT-modem.

     ABORT ERROR
     '' ATZ
     OK 'ATW2X2 S7=70 S11=55'
     OK AT

Second, /etc/chatscripts/setup-ttyS0.

     ABORT ERROR
     '' ATZ
     OK 'ATL1M1Q0V1W2X4&C1&D2 S6=4 S7=70 S11=55 S95=63 S109=1 +FCLASS=0'
     OK AT

The contents of these files must depend on your hardware, of course.

Options can also be given to pppd as arguments.

In Debian pppd is usually started using the pon command. When pon is used its first argument names an options file in /etc/ppp/peers/ which is also read by pppd. [ 54] This is where you set up options that are specific to a particular peer—for example, a particular Internet Service Provider (ISP).

Suppose for example you commute between Amsterdam and Den Haag. In each city you have access to two ISP services—Planet and KPN. First create a basic options file for each ISP.

     # cat > /etc/ppp/peers/KPN <<EOF
     remotename KPN
     noauth
     user kpn
     noipdefault
     ipparam KPN
     EOF
     # cat > /etc/ppp/peers/Planet <<EOF
     remotename Planet
     auth
     user [email protected]
     noipdefault 
     mru 1000
     mtu 1000
     ipparam Planet
     EOF

These files set options that differ between the two ISPs. Options common to both ISPs can be placed in /etc/ppp/options or in one of the interface-specific options files as appropriate.

Now create options files for each ISP in each city. In our example the only difference between connecting to an ISP in one location versus connecting in another is the chatscript that is required. (The chatscript is different because the local access telephone number is different.)

     # cat > /etc/ppp/peers/KPN-Amsterdam <<EOF
     connect "/usr/sbin/chat -v -f /etc/chatscripts/KPN-Amsterdam"
     file /etc/ppp/peers/KPN
     EOF
     # cat > /etc/ppp/peers/KPN-DenHaag <<EOF
     connect "/usr/sbin/chat -v -f /etc/chatscripts/KPN-DenHaag"
     file /etc/ppp/peers/KPN
     EOF
     # cat > /etc/ppp/peers/Planet-Amsterdam <<EOF
     connect "/usr/sbin/chat -v -f /etc/chatscripts/Planet-Amsterdam"
     file /etc/ppp/peers/Planet
     EOF
     # cat > /etc/ppp/peers/Planet-DenHaag <<EOF
     connect "/usr/sbin/chat -v -f /etc/chatscripts/Planet-DenHaag"
     file /etc/ppp/peers/Planet
     EOF

The file directives each include one of the options files shown earlier. The connect directive specifies the command that pppd uses to make the connection. Normally one uses the chat program for this, adapting the chatscript to the ISP. Here are the chatscripts for Den Haag; the chatscripts for Amsterdam might be similar except for the telephone number or they might be different if the ISP offers service through another company there.

     # cat > /etc/chatscripts/KPN-DenHaag <<EOF
     ABORT BUSY
     ABORT 'NO CARRIER'
     ABORT VOICE
     ABORT 'NO DIALTONE'
     ABORT 'NO DIAL TONE'
     ABORT 'NO ANSWER'
     ABORT ERROR
     OK-AT-OK ATDT 0676012321
     CONNECT \d\c
     EOF
     # cat > /etc/chatscripts/Planet-DenHaag <<EOF
     ABORT BUSY
     ABORT 'NO CARRIER'
     ABORT VOICE
     ABORT 'NO DIALTONE'
     ABORT 'NO DIAL TONE'
     ABORT 'NO ANSWER'
     ABORT ERROR
     OK-AT-OK ATDT 0676002505
     CONNECT \d\c
     EOF

To be able to connect to these ISPs you need client names and passwords that pppd can supply to the peer on demand. This information is stored either in /etc/ppp/pap-secrets (if the PAP protocol is used) or in /etc/ppp/chap-secrets (if the CHAP protocol is used). Although CHAP is more secure, PAP is still more widely used. Because these files contain secrets, group and world should not have permission to read or write them. The format of these files is explained in pppd(8). A "secret" (third field) is looked up in the file by finding the client name (first field) and/or the server name (second field). When connecting to an ISP one generally doesn't know the server name, so one supplies a client name instead; this was done on the user lines in peers/KPN and peers/Planet above.

     # client name       server name  secret
     kpn                 *            kpn
     [email protected]  *            myfavoritepet

See /usr/share/doc/ppp/README.Debian.gz for more information.


10.2.4.2 Configuring pppd using pppconfig

A quick way to configure pppd is to use the pppconfig program which comes in the package of the same name. pppconfig sets up files like those above after asking the user questions through a menu interface.


10.2.4.3 Configuring a PPP interface using wvdial

A different approach to using pppd is to run it from wvdial which comes in the wvdial package. Instead of pppd running chat to dial in and negotiate the connection, wvdial does the dialing and initial negotiating and then starts pppd to do the rest. Given only phone number, username, and password wvdial succeeds in making the connection in most cases.


Debian GNU/Linux Reference Guide
Prev Home Next

 
 
  Published under the terms of the GNU General Public License Design by Interspire