How To Setup PPP for ISP Dial-Up Under Linux


This document covers my experience configuring a Toshiba Satellite Pro 400CS laptop computer running RedHat Linux version 6.0. Other systems and linux versions may require different procedures than those described here. Any multi-user system would probably need to install things differently and worry about some security issues that I don't care about since I am the only user, usually logged in as root.

My system is primarily used for web application development. I normally am NOT connected to the internet and need to test html pages and scripts which access my internet domain name within this disconnected environment. I run the Apache http server on the laptop and access my domain, www.proliberty.com, at the localhost IP address: 127.0.0.1. Obviously, the static IP addressof my domain, on the internet, is different from localhost, so when I connect to the internet and want to access www.proliberty.com, my hosts file configuration must change.

My needs were very simple and require no fancy gateways, firewalls or other connectivity issues. I do not understand DNS administration well and have only learned enough to manage to do what I need. I simply require switching between two distinct states:

  1. PPP-DOWN. I am DISCONNECTED from the internet. Connected to a local network of computers using bogus IP numbers, none of which is connected to the internet.
  2. PPP-UP. I am CONNECTED to the internet via serial PPP link, at which time no other computers are connected to my laptop.
This simple setup was not addressed in any single document that I could find. No wonder many people throw up their hands and get fed up with linux! My solution required piecing together bits of information I found in many documents. I have tried to assemble them all here in a (hopefully) easy to follow procedure for getting a system online as quickly as possible. I am leaving out many details about linux system administration that can be found elsewhere.


PPP Operation

  • You must have a kernel compiled with PPP support, among other things, and the PPP rpm installed. Required version information, compatibility issues, etc. can be found in various reference documents.
  • Edit and install all the necessary files according to: General Instructions On How To Get PPP Working
  • To start PPP, execute the script: pppup
  • To stop PPP, execute the script: pppdown


  • My System Configuration and Files For PPP

  • Toshiba Satellite Pro 400CS laptop, 75MHz Intel Pentium PC; 40MB RAM
  • kernel 2.2.5-15 rpm installation from the RedHat 6.0 CD with PPP and PCMCIA support enabled
  • ppp.2.3.7 rpm installation from the RedHat 6.0 CD.
  • PCMCIA rpm installed; for some stupid reason, RedHat installs PCMCIA in a DISABLED state!
  • Enable PCMCIA services by editing the file /etc/sysconfig/pcmcia to include the line: PCMCIA=yes
  • /etc/hosts.pppdown
  • /etc/hosts.pppup
  • /etc/resolv.conf.pppdown
  • /etc/resolv.conf.pppup
  • /usr/sbin/pppup
  • /usr/sbin/pppdown


  • General Instructions On How To Get PPP Working

    If you have a laptop, like I do, you will need PCMCIA support, if you use a PCMCIA modem; otherwise, if you have an ordinary PC, you don't need PCMCIA.
     
  • Install RedHat 6.0 or other version with PPP support, or compile your own kernel
  • Install PPP rpm, if it didn't get installed already
  • Create symbolic link to the serial port where the modem is installed: ln -s /dev/modem  /dev/ttyS1
  • Launch X-Windows (startx)
  • From a terminal window, type: linuxconf
  • Click on the item: Conf/Networking/Client tasks/Routing and Gateways/PPP/SLIP/PLIP
  • Click "Add" button, to add a PPP configuration, ppp0
  • Fill in the fields in the ppp0 configuration:
  • Hardware: line (modem) speed = <your modem speed>; modem port = /dev/modem
  • Communication: init string = ATZ; modem dial dial command = ATDT<your ISP dial-up phone number>; other script items for loggin on (send/expect).... (see man pppd or man chat for details on connect scripts)
  • Quit linuxconf; when prompted, choose 'activate changes'
  • Edit the files listed above in  My System Configuration to fit the details of your own system: your own domain names, IP numbers, name servers, ISP dial-up numbers, username, password, etc.
  • Copy the above files you have edited to the locations where they belong.
  • Change the permissions on the files as follows:
  • chmod 755 /usr/sbin/pppup
  • chmod 755 /usr/sbin/pppdown
  • Now you are ready to fire away and start PPP. From any xterm window, type: pppup
  • If all goes well, the modem should dialup your ISP and a PPP connection should be established. You can confirm this by typing the command: ifconfig; if PPP is up, you should see a listing for ppp0.
  • When you want to terminate the connection, type pppdown
  • For further help troubleshooting, see the references section.

  • /etc/hosts.pppdown

    # /etc/hosts.pppdown
    # these are just some made up IP numbers for my local network, when disconnected from the internet
      1.1.1.1 pc
      1.1.1.2 duo
      1.1.1.3 ppc
    # I use this for ftp between my laptop and other machines on  my local network
      1.1.1.5 proliberty.com
    # I run apache on the laptop and access my web site files at www.proliberty.com
      127.0.0.1 laptop localhost localhost.localdomain www.proliberty.com


    /etc/hosts.pppup

     # /etc/hosts.pppup

    127.0.0.1       localhost


    /etc/resolv.conf.pppdown

    # /etc/resolv.conf.pppdown

    domain proliberty.com
    search proliberty.com

    # I don't run any nameservers locally when not connected to the internet


    /etc/resolv.conf.pppup

    # /etc/resolv.conf.pppup

    domain proliberty.com
    search proliberty.com

    # Substitute the nameservers you use; these are from oro.net :
    nameserver 198.68.62.2
    nameserver 198.68.62.42


    /usr/sbin/pppup

    #!/bin/bash

    # /usr/sbin/pppup

    # Edit these values for your own case in the chat command, below:

    # <USERNAME > replace with your username
    # <PASSWORD> replace with   your password
    # <MODEM_SPEED> replace with  your modem speed
    # <ISP_DIALUP> replace with your isp dial-up number

    # WARNING - if you have multiple users on your system, it is probably not a good idea to put
    # username and password in this file if it is readable by others!

    # copy config file templates needed for pppup state:

    cp -f /etc/hosts.pppup /etc/hosts
    cp -f /etc/resolv.conf.pppup /etc/resolv.conf

    # start the PPP process and dialup your ISP
    # your ISP's login procedure may be different from this.
    pppd connect 'chat -v "" ATDT <ISP_DIALUP> CONNECT "" ogin: <USERNAME >  word: <PASSWORD>' \
          /dev/modem <MODEM_SPEED> noipdefault debug crtscts modem defaultroute


    /usr/sbin/pppdown


    #!/bin/sh

    #/usr/sbin/pppdown

    # by Ian Goldberg <iang@cs.berkeley.edu>
    # modified by Greg Keraunen <gk@proliberty.com>

    # restore config files to pppdown state:

    cp -f /etc/hosts.pppdown /etc/hosts
    cp -f /etc/resolv.conf.pppdown /etc/resolv.conf

    ######################################################################
    #
    # Determine the device to be terminated.
    #
    if [ "$1" = "" ]; then
            DEVICE=ppp0
    else
            DEVICE=$1
    fi

    ######################################################################
    #
    # If the ppp0 pid file is present then the program is running. Stop it.
    if [ -r /var/run/$DEVICE.pid ]; then
            kill -INT `cat /var/run/$DEVICE.pid`
    #
    # If the kill did not work then there is no process running for this
    # pid. It may also mean that the lock file will be left. You may wish
    # to delete the lock file at the same time.
            if [ ! "$?" = "0" ]; then
                    rm -f /var/run/$DEVICE.pid
                    echo "ERROR: Removed stale pid file"
                    exit 1
            fi
    #
    # Success. Let pppd clean up its own junk.
            echo "PPP link to $DEVICE terminated."
            exit 0
    fi
    #
    # The ppp process is not running for ppp0
    echo "ERROR: PPP link is not active on $DEVICE"
    exit 1


    Reference Documents

    The files and paths described below are where they happen to exist on MY system, or how I accessed them. Hopefully you won't have to read any of this stuff if my directions are any good.
     
  • Ian's PPP Primer for Linux 2.0: http://www.cs.berkeley.edu/~iang/ppp/primer.html
  • PPP read-me: /usr/doc/ppp.2.3.7/README.linux
  • Linux PPP HOWTO: /usr/doc/HTML/ldp/PPP-HOWTO.html
  • DNS-HOWTO: /usr/doc/HTML/ldp/DNS-HOWTO.html
  • man pppd
  • man chat

  •