home *** CD-ROM | disk | FTP | other *** search
/ PC World 1999 August / PCWorld_1999-08_cd.bin / doc / HOWTO / unmaintained / mini / PPP-over-minicom < prev    next >
Text File  |  1998-02-28  |  10KB  |  262 lines

  1. [ 1 March 1998
  2.   The Linux PLIP mini-HOWTO is being converted to HTML or SGML,
  3.   and will rejoin the mini-HOWTO collection as soon as this is done. ]
  4.   -- Greg Hankins <gregh@sunsite.unc.edu> ]
  5.  
  6. PPP-over-minicom mini-HOWTO                  Winfried Trⁿmper <winni@xpilot.org>
  7. ---------------------------                  v0.0  09 December 1996
  8.  
  9. You want a menu-driven tool for dealing with PPP? An easy but powerful
  10. database with telephone numbers of your ISP? Want to see what happens
  11. when logging in? Then this mini-HOWTO is for you!
  12.  
  13.  
  14.   1. Introduction
  15.  
  16.         PPP has become the standard network protocol for hooking up
  17.         to the internet via dial-in connections. The associated
  18.         daemon "pppd" ships with a very primitive tool for dialing
  19.         which handles only very simple setups well.
  20.         I will describe an alternate solution on the basis of "minicom".
  21.  
  22.         This document is a short version of the German "Internetanbindung
  23.         mit PPP" ("http://www.uni-koeln.de/themen/linux/ppp/")
  24.  
  25.  
  26.   1.1. The terminal program "minicom"
  27.  
  28.         "minicom" is a very sophisticated tool for dialing into
  29.         other computers (ISPs or BBSs). It has a fancy colored menu,
  30.         a telephone database and a powerful scripting language. Thus
  31.         it is ideally suited for use in conjunction with "pppd".
  32.  
  33.         BTW, if you run "/sbin/mgetty /dev/modem" everyone with a
  34.         valid account on your machine can dial in (e.g. using
  35.         "minicom"). But thats another story. Please see the docs of
  36.         "mgetty" for details.
  37.  
  38.  
  39.   1.2. Feedback
  40.  
  41.         I'm only interested in feedback that improves this mini-HOWTO.
  42.         I won't answer general questions about Linux, PPP, SLIP or
  43.         networking.
  44.  
  45.  
  46.   1.3. Known bugs
  47.  
  48.         At the time of writing, there seem to be some bugs in
  49.         "minicom", "runscript" and the method described below:
  50.  
  51.               - "runscript" does not wait for external programs to
  52.                 finish 
  53.  
  54.                         print "blah"
  55.                         ! sleep 10
  56.                         print "blup"
  57.  
  58.                 This script exits immediatly (but not when straced
  59.                 ...)
  60.  
  61.               - "pppd" takes the serial device away from minicom
  62.                 (when not fed via stdin)
  63.  
  64.  
  65.         It seems that Miquel van Smoorenburg (the author of minicom)
  66.         is too busy to get his fingers on the above. So volunteers
  67.         are welcome.
  68.  
  69.  
  70.  
  71.   2.0. Dialing with minicom
  72.  
  73.         Many guides on PPP recommend to leave minicom after it's been
  74.         used for dialing. But there is really no need to leave this
  75.         comfortable program ...
  76.  
  77.  
  78.   2.1. Configure minicom
  79.  
  80.         Execute "minicom -s" and choose the menu item "Serial port
  81.         setup". The first entry should be "Serial Device" this is
  82.         the most important setting: the serial device your
  83.         modem is attached to. (Any volunteers to mess up minicom to
  84.         handle several serial devices at once?)
  85.         Press <return> to confirm and <esc> to exit to the initial
  86.         setup menu. Choose "Exit to minicom" and type "atdt99999".
  87.         Your modem should start to dial immediatly and you should
  88.         hear a click when the modem hooks up to the line. Of course
  89.         "99999" is no valid telephone number.
  90.  
  91.  
  92.   2.2. Starting PPP manually
  93.  
  94.         Maybe you've already tried to dial the telephone number of
  95.         your ISP instead of "99999". Did you see funny characters
  96.         on the screen after login in (if not, type "ppp")? They
  97.         result from the "pppd" (or equivalent) started at the other
  98.         end of the line. If so you can try to start the
  99.         "pppd"-daemon on your side and evaluate the log-files
  100.         afterwards.
  101.  
  102.         To start "pppd" inside minicom, you can define a new
  103.         upload method (figure out yourself) or re-define the
  104.         setting "kermit programm" from the configuration menu
  105.         "Filename and paths":
  106.  
  107.                 A - Download directory :
  108.                 B -   Upload directory :
  109.                 C -   Script directory :
  110.                 D -     Script program : /usr/bin/runscript
  111.                 E -     Kermit program : /usr/sbin/pppd file /etc/ppp/mini_options
  112.  
  113.         Now if you see those funny characters next time you dial
  114.         to your ISP you can press <Alt-K> to start "pppd".
  115.  
  116.         The rest of this mini-HOWTO deals with automating the task
  117.         of logging in and starting "pppd".
  118.  
  119.  
  120.   2.3. Evaluating logfiles
  121.  
  122.         Although I do not want to explain how PPP is to be configured,
  123.         I give a short tip how to read the log-file. To extract the
  124.         essential information from the logfile "/var/log/debug" (or
  125.         alternative "/var/log/daemon.log") execute the commands
  126.  
  127.                 tail -n 40  /var/log/debug |\
  128.                         grep -E " pppd\[[0-9]*\]:" |\
  129.                         sed -e "s/^.*pppd\[/[/" 
  130.  
  131.         You should see messages like
  132.  
  133.                 sent [LCP ConfReq id=0x1 <mru 296>]
  134.                 rcvd [LCP ConfRej id=0x1 <mru 296>]
  135.  
  136.         which indicate that we sent a config-request to set the maximum
  137.         recieve unit (mru) to 296. The other side refects this setting
  138.         ("configuration rejected"). In this case I just removed the
  139.         option "mru" from "/etc/ppp/options" (see below).
  140.  
  141.  
  142.   2.4. Configure a telephone number
  143.  
  144.         If the above was successful you may want to store a telephone
  145.         number in minicoms database. Press <Alt-D> to pop up the
  146.         dialing menu and use the cursor keys to select "Edit":
  147.  
  148.                 A -  Name                : Xeno
  149.                 B -  Number              : 022039697303
  150.                 C -  Dial string #       : 1
  151.                 D -  Local echo          : No
  152.                 E -  Script              : /etc/ppp/login.script
  153.                 F -  Username            : ppp-382
  154.                 G -  Password            : top-secret
  155.                 H -  Terminal Emulation  : VT102
  156.                 I -  Backspace key sends : Delete
  157.                 J -  Linewrap            : Off
  158.                 K -  Line Settings       : Curr 8N1
  159.  
  160.         This is a sample entry to dial to one of my ISPs. The script
  161.         "/etc/ppp/login.script" is shown below. Two special variables
  162.         are passed to this script: $(LOGIN) and $(PASS) which are
  163.         set to the values submitted as username (F) and password (G).
  164.         This feature makes minicom somewhat flexible because you
  165.         need only one script to automate your login to several ISPs.
  166.  
  167.  
  168.   2.5. A login script
  169.  
  170.         "minicom" starts the login-script after it recieves the string
  171.         "CONNECT". To be precise, "minicom" does not execute the script
  172.         itself but calls the utility "runscript" as a sub-process for that.
  173.  
  174.         Below is a example I use for my ISPs.
  175.  
  176.                 # v1.0, 20.08.96 Winfried Trⁿmper <winni@xpilot.org>
  177.                 print ""
  178.                 print "Automatic login via /etc/ppp/login.script"
  179.         
  180.                 ## uncomment if you need to press enter to get the prompt
  181.                 #send ""
  182.         
  183.                 expect {
  184.                         "ogin:"
  185.                         "ogin>"
  186.                         "sername:"
  187.                         "sername>"
  188.                         "NO CARRIER" exit 1
  189.                 }
  190.                 send "$(LOGIN)"
  191.                 expect {
  192.                         "assword:"
  193.                         "assword>"
  194.                         timeout 20
  195.                 }
  196.                 send "$(PASS)"
  197.                 expect {
  198.                         "port"  send "ppp"
  199.                         "Start your PPP now"
  200.                         "}!}!}"
  201.                         timeout 10
  202.                 }
  203.                 print ""
  204.                 print "Now switching into ppp-mode ..."
  205.                 print ""
  206.  
  207.                 ! /usr/sbin/pppd  file /etc/ppp/mini_options
  208.  
  209.                 print ""
  210.                 print "the command   killall -TERM pppd   terminates pppd"
  211.  
  212.  
  213.         The ability of "runscript" to call external programs is used
  214.         to start "pppd". Copy your original options-file for ppp
  215.         to "/etc/ppp/options.ttyS1"  (where you have to replace "ttyS1"
  216.         with the device your modem is attached to) and delete  all
  217.         lines from /etc/ppp/options that are specific to your modem
  218.         (like "connect", "crtscts" or "modem").
  219.         Put the options that should be specific to the ppp-connection
  220.         via minicom in "/etc/ppp/mini_options". One of these options
  221.         should be
  222.  
  223.                 disconnect "chat '' '\d\d+++\d\dATH\r\c'"
  224.  
  225.         This is a must because "pppd" is fed via stdin and can't hang
  226.         up the modem via "crtscts".
  227.  
  228.  
  229.   2.6. Automated dialing on startup
  230.  
  231.         Use the option "-d" to dial a certain telephone number on
  232.         startup of minicom.
  233.         You may also try
  234.  
  235.                 open -sl -- minicom -d 1
  236.  
  237.         To throw minicom at another console (see the Consoles-Many
  238.         mini-HOWTO for details).
  239.  
  240.  
  241.   2.7. Future extensions
  242.  
  243.         Because "pppd" is a daemon it is not designed for
  244.         user-interaction or observation. Thats ok. After all, we're
  245.         using a unix-like os ...
  246.  
  247.         The canonical solution is a backend. Any volunteers to hack
  248.         up minicom?
  249.         Fancy extensions would be:
  250.  
  251.               - automatic generation of the login-script by watching
  252.                 the user dialing in manually
  253.  
  254.               - automatic evalutaion of the log-files with
  255.                 correction of options
  256.  
  257.               - extraction of messages like shown in 2.3.
  258.  
  259.  
  260. End of the PPP-via-minicom mini-HOWTO
  261.  
  262.