Linux PPP Setup
These instructions were tested on an out of the box workstation installation
of Red Hat 5.2, however they should work on different flavors and versions of
Linux as well. Many of the commands that you will need to issue will require you
to have root access.
First you will need to find out which COM port your modem uses. If you
have Windows9x installed you can determine what COM port your modem is on by
doing the following:
- Double-click "My Computer" icon.
- Double-click "Control Panel."
- Double-click "Modems."
- Left-click on the "Diagnostics" tab at the top.
- The COM port that your modem is using will be listed next to the
name of your modem.
COM ports in Linux are referred to by /dev/ttySX (where X is the device number).
The basic way to remember the number following "ttyS" is to subtract one from
the number following "COM" in DOS or Windows.
| COM1 |
/dev/ttyS0 |
| COM2 |
/dev/ttyS1 |
| COM3 |
/dev/ttyS2 |
| COM4 |
/dev/ttyS3 |
You need to refer to that device using /dev/modem by making a symbolic link
from /dev/ttySX ('X' representing whatever that number is) to /dev/modem. You
would type the following if your modem was on COM2:
ln -s /dev/ttyS1 /dev/modem
If you are using a 56k modem you may want to add the following line into your
/etc/rc.d/rc.local file so that your port will use 57.6kb instead of
38.4kb:
setserial /etc/modem spd_hi
Now you will need to create/edit several files. Make sure that you don't copy
these files word for word without reading the comments first, some of the files
will need information regarding your dialup account and your computer
configuration.
/etc/resolv.conf
search qis.net nameserver 209.150.96.20 nameserver 209.150.96.21
/etc/ppp/pap-secrets
In the /etc/ppp/pap-secrets file you will want to replace
"your username," and "your password" with your actual username and
password.
# Secrets for authentication using PAP # client server secret IP addresses your username * your password
/etc/ppp/options
In the /etc/ppp/options file you will want to replace "your username"
with your actual username.
lock name your username
/etc/ppp/ppp-on
In the /etc/ppp/ppp-on script you will want to replace the telephone
number, and if you have a 56k modem you will want to change the port speed
from 38400 to 57600.
#!/bin/sh # # Script to initiate a ppp connection. This is the first part of the # pair of scripts. This is not a secure pair of scripts as the codes # are visible with the 'ps' command. However, it is simple. # # These are the parameters. Change as needed. TELEPHONE=555-1212 # The telephone number for the connection LOCAL_IP=0.0.0.0 # Local IP address if known. Dynamic = 0.0.0.0 REMOTE_IP=0.0.0.0 # Remote IP address if desired. Normally 0.0.0.0 NETMASK=255.255.255.0 # The proper netmask if needed # # Export them so that they will be available at 'ppp-on-dialer' time. export TELEPHONE # # This is the location of the script which dials the phone and logs # in. Please use the absolute file name as the $PATH variable is not # used on the connect option. (To do so on a 'root' account would be # a security hole so don't ask.) # DIALER_SCRIPT=/etc/ppp/ppp-on-dialer # # Initiate the connection # # I put most of the common options on this command. Please, don't # forget the 'lock' option or some programs such as mgetty will not # work. The asyncmap and escape will permit the PPP link to work with # a telnet or rlogin connection. You are welcome to make any changes # as desired. Don't use the 'defaultroute' option if you currently # have a default route to an ethernet gateway. # exec /usr/sbin/pppd debug lock modem crtscts /dev/modem 38400 \ asyncmap 20A0000 escape FF kdebug 0 $LOCAL_IP:$REMOTE_IP \ noipdefault netmask $NETMASK defaultroute connect $DIALER_SCRIPT
/etc/ppp/ppp-on-dialer
In the /etc/ppp/ppp-on-dialer script you may need to add the init string
for you modem on the line that has AT in quotes.
#!/bin/sh # # This is part 2 of the ppp-on script. It will perform the connection # protocol for the desired connection. # exec chat -v \ TIMEOUT 3 \ ABORT '\nBUSY\r' \ ABORT '\nNO ANSWER\r' \ ABORT '\nRINGING\r\n\r\nRINGING\r' \ '' \r"AT" \ 'OK-+++\c-OK' ATH0 \ TIMEOUT 30 \ OK ATDT$TELEPHONE \ CONNECT ''
Now that you have created all of the required configuration files
you can initiate a dialup connection by typing the command:
/etc/ppp/ppp-on
You can monitor the progress of your dial-up connection by typing:
tail -f /var/log/messages
The results of the connection should look similar to this:
Aug 13 08:13:49 mycomputer pppd[5191]: pppd 2.3.5 started by root, uid 0 Aug 13 08:13:50 mycomputer chat[5192]: timeout set to 3 seconds Aug 13 08:13:50 mycomputer chat[5192]: abort on (\nBUSY\r) Aug 13 08:13:50 mycomputer chat[5192]: abort on (\nNO ANSWER\r) Aug 13 08:13:50 mycomputer chat[5192]: abort on (\nRINGING\r\n\r\nRINGING\r) Aug 13 08:13:50 mycomputer chat[5192]: send (rAT^M) Aug 13 08:13:50 mycomputer chat[5192]: expect (OK) Aug 13 08:13:50 mycomputer chat[5192]: rAT^M^M Aug 13 08:13:50 mycomputer chat[5192]: OK Aug 13 08:13:50 mycomputer chat[5192]: -- got it Aug 13 08:13:50 mycomputer chat[5192]: send (ATH0^M) Aug 13 08:13:50 mycomputer chat[5192]: timeout set to 30 seconds Aug 13 08:13:50 mycomputer chat[5192]: expect (OK) Aug 13 08:13:50 mycomputer chat[5192]: ^M Aug 13 08:13:51 mycomputer chat[5192]: ATH0^M^M Aug 13 08:13:51 mycomputer chat[5192]: OK Aug 13 08:13:51 mycomputer chat[5192]: -- got it Aug 13 08:13:51 mycomputer chat[5192]: send (ATDT*70,4108486493^M) Aug 13 08:13:51 mycomputer chat[5192]: expect (CONNECT) Aug 13 08:13:51 mycomputer chat[5192]: ^M Aug 13 08:14:11 mycomputer chat[5192]: ATDT*70,4108486493^M^M Aug 13 08:14:11 mycomputer chat[5192]: CONNECT Aug 13 08:14:11 mycomputer chat[5192]: -- got it Aug 13 08:14:11 mycomputer chat[5192]: send (^M) Aug 13 08:14:11 mycomputer pppd[5191]: Serial connection established. Aug 13 08:14:12 mycomputer pppd[5191]: Using interface ppp0 Aug 13 08:14:12 mycomputer pppd[5191]: Connect: ppp0 <--> /dev/modem Aug 13 08:14:18 mycomputer pppd[5191]: Remote message: Login Succeeded Aug 13 08:14:19 mycomputer pppd[5191]: local IP address 209.150.96.155 Aug 13 08:14:19 mycomputer pppd[5191]: remote IP address 209.150.96.2
When you are done monitoring your connection you can press at the
same time to take to back to the prompt.
You can also verify that you have a ppp connection by typing:
ifconfig
The results of the command should display interfaces that looks similar to this
(depending on your configuration there may be other interfaces listed such as eth0):
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:3924 Metric:1 RX packets:106 errors:0 dropped:0 overruns:0 frame:0 TX packets:106 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0
ppp0 Link encap:Point-to-Point Protocol inet addr:209.150.96.155 P-t-P:209.150.96.2 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:1372 errors:5 dropped:0 overruns:0 frame:5 TX packets:1435 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10
When you are ready to disconnect from the internet type the command:
/etc/ppp/ppp-off
If you follow these instructions and you are still unable to connect, you
may want to read the Linux
PPP-HOWTO at the Linux
Documentation Project. The documentation and example scripts that come
with the ppp can also be very helpful.
|