+-<>-=-<>-=-+ +-<>-=-<>-=-+ GENERIC UCD LINUX PPP HOWTO +-<>-=-<>-=-+ +-<>-=-<>-=-+ Copyright 1999 by Peter Jay Salzman Released under the GNU GPL license WARANTEES: There is no warantee of any kind. You use this information at your own risk. In particular, IT, UCDavis, LUGOD and the authors are not responsible for any damages that result from using this document. WHO SHOULD('NT) USE THIS DOCUMENT: If you run linux on your system and want to make a PPP connection to UCD, this is for you. There are many ways to establish a PPP connection; this one can be considered a generic method which will work with any flavor of Linux. There are probably easier ways to do this; see the other UCD PPP HOWTOs for details. If you need to troubleshoot a PPP connection, there are better sources, although this would be a good place to start. There are a list of resources at the end of this document. OTHER UCD LINUX PPP HOWTO DOCUMENTS: Generic Linux (this one) Redhat specific (not written yet) EZPPP (not written yet) KDE (not written yet) Debian specific (not written yet) Slackware specific (not written yet. is there one?) ================================================ STEP ONE: LOGIN AS ROOT AND CONFIGURE YOUR MODEM ================================================ Login as root; you're going to make a symbolic link between the "modem device" and a com port. If you are running a kernel 2.0.* (see the output of uname -a) then you might need to replace ttyS* with cua* in the following lines: If your modem is connected to the COM1 port, type: ln -s /dev/ttyS0 /dev/modem If your modem is connected to the COM2 port, type: ln -s /dev/ttyS1 /dev/modem If your modem is connected to the COM3 port, type: ln -s /dev/ttyS2 /dev/modem If your modem is connected to the COM4 port, type: ln -s /dev/ttyS3 /dev/modem ================================ STEP TWO: SET UP THE NAMESERVING ================================ Nameserving is the process of converting a hostname (eg landau.ucdavis.edu) into an IP address which computers use (like 169.237.42.71). Computers don't know hostnames and most of can't remember "169.237.42.71". A nameserver converts these names back and forth. Cut out the following lines and save it to a file /etc/resolv.conf: =====================cut here========================== search ucdavis.edu nameserver 169.237.250.250 nameserver 169.237.1.250 =====================cut here========================== The 1st line makes "ucdavis.edu" the default domain to search so when you type "telnet isun", the system will try telnetting to isun.ucdavis.edu. The 2nd and 3rd lines give UC Davis's two nameservers, rand and pula. ================================== STEP THREE: WRITE A CONNECT SCRIPT ================================== Cut out the following script and save it as "connect-UCD" in the directory /usr/local/bin. The \ is a continuation symbol for the shell. It's used to span 1 long line into 2 shorter ones. =====================cut here========================== #!/bin/sh # connect-UCD written by Peter Jay Salzman 1998 # crtscts: enable hardware flow control. Lock: prevent other programs from # using the modem when we're using it. noipdefault: tell pppd to wait for the # IP address from the remote system instead of guessing some kind of default. # passive: wait for a carrier before trying to send packets. /dev/modem:the # device to use. 57600: speed. persist: keep trying on a busy signal or when # the connection gets terminated. holdoff: # of secs to wait before trying to # make the connection again. options can be specified in config files as well # as options to pppd. pppd attempts to read from /etc/ppp/options, # $HOME/.ppprc and /etc/ppp/options.tttyname in that order. /usr/sbin/pppd debug connect /usr/local/lib/chat.sh crtscts lock defaultroute \ passive persist /dev/modem 57600 holdoff 0 =====================cut here========================== ============================== STEP FOUR: WRITE A CHAT SCRIPT ============================== Cut out the following script and save it as /usr/local/lib/chat.sh. =====================cut here========================== chat -v -t 20 "" ATZ OK ATDT754-7720 CONNECT "" \ sername: 'X' assword: 'Y' 'IRAS-1>' ppp =====================cut here========================== Replace X by your username and Y by your password. The script is an expect/send script and is fairly straightforward to understand; see man chat for details. For example, when your system sees CONNECT it sends "" (a return). When your system sees "username" it sends "X", and so on. Some of the expect/send strings have single forward quotes around them. You use single quotes around strings containing a character which can be misinterpreted by the shell, like $ or ". In the above script, my system expects the string IRAS-1>. The > symbol can be misinterpreted by the shell as being the redirection operator. Thus, this string must be quoted. When it doubt, quote the string; it can't hurt. ==================================== STEP FIVE: WRITE A DISCONNECT SCRIPT ==================================== Cut out the following script and save it as "disconnect-UCD" in the directory /usr/local/bin. =====================cut here========================== #!/bin/sh # 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 didn't work then there's 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 =====================cut here========================== ======================================================= STEP SIX: SET THE CORRECT PERMISSIONS ON ALL YOUR FILES ======================================================= a. Make sure that your (dis)connect-UCD script is world executible chmod ugo+x /usr/local/bin/connect-UCD chmod ugo+x /usr/local/bin/disconnect-UCD b. Make sure that /usr/local/bin and /usr/local/lib are in your PATH variable and are world readible. Type echo $PATH and make sure you see these 2 directories somewhere in the output. c. The pppd program needs to access and change networking devices and routing information. If other users besides root will be using PPP, you should make it setuid root. chmod u+s /usr/sbin/pppd ========= RESOURCES ========= If you're stuck, here are some resources you can turn to: 1- The #1 resource for any Linux user is dejanews. Use a friend's computer to go to http://www.dejanews.com/home_ps.shtml. Some good forums to check out are alt.os.linux, comp.os.linux.answers, comp.os.linux.questions. 2- The author will try to answer questions: info@lugod.org 3- The LUGOD homepage: http://lugod.org 4- Look at the voluminous /usr/doc/HOWTO/PPP-HOWTO. 5- The linux mailing list right here on the UCD campus! Send an email to Majordomo@math.ucdavis.edu with the command "subscribe linux". 6- Usenet--too many groups to list. You'll find 'em. DO NOT CONTACT IT FOR SUPPORT UNDER ANY CIRCUMSTANCES.