home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Enter 1999 June / enter_06_1999.iso / doc / HOWTO / mini / SLIP-PPP-Emulator < prev    next >
Text File  |  1998-10-14  |  18KB  |  450 lines

  1.  
  2.                             SLIP/PPP EMULATOR HOWTO
  3.                                        
  4. version 3.0 (updated 8/7/97) by Irish
  5.  
  6.     This document will describe how to get your Linux box to connect to a
  7.    generic site via a SLIP/PPP emulator, such as SLiRP or TIA. I take no
  8.    responsibility for your use of this information, but corrections are
  9.    welcome.
  10.    
  11.    I will not attempt to describe all that can be done over this
  12.    connection once established, but I will refer you to other documents
  13.    or sites that will contain the relevant information.
  14.    
  15.    That done, let's do it!
  16.    
  17.    
  18.      _________________________________________________________________
  19.    
  20.      * 1.0 How does an emulator work?
  21.        
  22.        It is important to understand how a SLIP/PPP emulator works in
  23.        general, to be aware of its limitations. First, you do not need to
  24.        install the emulator on your machine. It runs on your remote host
  25.        only. What you need on your machine is the TCP/IP and SLIP or PPP
  26.        protocols installed in your kernel (more on that in a bit), and
  27.        some clients.
  28.        
  29.        Here's what happens: you send network requests from your machine
  30.        to your remote host over the SLIP/PPP link. The emulator grabs
  31.        them and sends them out to the Net at large. Then, incoming data
  32.        is sent back from the Net to your account on the remote host,
  33.        where the emulator grabs it and sends it back over the SLIP/PPP
  34.        link to your machine. So, to the Net it appears as if you are
  35.        working out of your account on the remote host, but to you it
  36.        looks like you are really connected right to the Net.
  37.        
  38.        As you can see, this can confuse stuff that is incoming from the
  39.        Net. For example, talk doesn't work via an emulator, because the
  40.        incoming talk request tries to start the remote hosts talk daemon,
  41.        not yours.
  42.        
  43.        The other big difference between an emulator and real SLIP/PPP is
  44.        you are NOT assigned your own IP address; remember, you are only
  45.        converting a dialup account to a SLIP/PPP connection.
  46.        
  47.      * 1.1 What is TIA?
  48.        
  49.        The Intenet Adaptor was written by the fine folks at
  50.        marketplace.com. They have quit working on it now, and consider it
  51.        a 'mature' product. The last version is 2.05; if you are going to
  52.        use TIA, please get this version. !NOTE! At last report, only site
  53.        licenses are available now.
  54.        
  55.      * 1.2 What is SLiRP? This is a freeware application, covered under
  56.        the GNU Public License. It is out of beta, and is real stable. It
  57.        sports a few more features than TIA, and is (reportedly) easier on
  58.        host resources. Available at fine Linux FTP sites everywhere.
  59.        
  60.      * 1.3 What about Term?
  61.        
  62.        If you don't have root access to your machine for one reason or
  63.        another, and you can't persuade someone who does to install SLIP
  64.        and dip, then you won't have much choice except to use Term. If
  65.        you want to know more about Term, please read the HOWTO on
  66.        Sunsite.
  67.        
  68.      * 1.4 What about real SLIP/PPP?
  69.        
  70.        Hey, a lot of places are offering real SLIP/PPP at reasonable
  71.        prices for non-dedicated dialup nowadays. If you can afford it, or
  72.        feel the need, go for it. The Real Thing is always better than
  73.        emulation. However, one of the things an emulator provides is
  74.        security; it acts as an impregnable firewall, and with it you are
  75.        pretty much as bulletproof as your provider is. You'll pay for it
  76.        though, emulation is slower, and does not fully support every
  77.        protocol. Still and all, emulation is good enough for most people,
  78.        and is a fine way to connect to the Net.
  79.        
  80.    
  81.      _________________________________________________________________
  82.    
  83.    Enough already! How do I set it up?
  84.    
  85.    Alright hotrod, we're getting there, but first there's some info you
  86.    need to get, and a couple of explanations.
  87.    
  88.    First, you need to get the IP address of your provider, if you don't
  89.    have it already. You can do this by typing 'who' at a shell prompt
  90.    there, or reading their /etc/hosts, or even just asking them. While
  91.    your getting that, get the IP address of the POP/SMTP host and the
  92.    NNTP server (if you don't know what those are, trust me and ask for
  93.    them anyway, you'll need 'em).
  94.    
  95.    Next, let me explain quickly about hostnames and domain names. The
  96.    hostname is the first part of a machines name, the domain is the rest
  97.    of it. Like this: hostname.domain.name (a four parter would be
  98.    hostname.do.main.name). Together, they make a Fully Qualified Domain
  99.    Name (FQDN).
  100.    
  101.    The name of your Linux machine is stored in /etc/HOSTNAME, and yes,
  102.    you can change it. In fact, please do (if you're using Slackware,
  103.    it'll be "darkstar.frop.org" by default). Just edit the /etc/HOSTNAME
  104.    file to be whatever you want - remember, if you are using an emulator,
  105.    you are essentially invisible to the Net at large, so you can be
  106.    creative. However, if you plan to get a real SLIP/PPP connection down
  107.    the road sometime, you'll probably want to conform to being a sub-host
  108.    of your provider. For example, if your provider is
  109.    "info.superhiway.com", the domain is "superhiway.com" and the hostname
  110.    is "info". So you could either be "offramp.info.superhiway.com" or
  111.    just "offramp.superhiway.com". Either would work, and in either case
  112.    your hostname is "offramp".
  113.    
  114.      * 2.0 Preparing your Linux machine
  115.        
  116.        In a nutshell, here's what's required. I'll explain the first
  117.        three in detail.
  118.        
  119.        
  120.           + -> Compile your kernel to include SLIP and TCP/IP
  121.           + -> Edit some files in /etc
  122.           + -> Install and configure dip
  123.           + -> Install pppd (optional, for PPP only)
  124.    You will also need to get an emulator binary appropriate for your
  125.        remote host and install it. SLiRP is available at Sunsite and
  126.        other fine Linux FTP sites. All of the relevant info for TIA is
  127.        available at TIAs home site.
  128.        
  129.    That's it! Let's get started.
  130.    
  131.      * 2.1 Compiling your kernel
  132.        
  133.        If you have never done this, you should. And you should read the
  134.        FAQ first, but don't worry, it's easy. If you want, you can e-mail
  135.        me and I'll help.
  136.        
  137.        I'll assume that you have here, for the sake of brevity. When you
  138.        'make config', look for "Network Devices". Say 'y', of course,
  139.        then say 'y' to SLIP, CSLIP, (or PPP) and TCP/IP and 'n' to
  140.        everything else, unless you have ethercards or need some other
  141.        protocol for something else. _If you don't do this, it won't work!
  142.        _Finish compiling and installing the new kernel, then,
  143.        
  144.      * 2.2 Edit some files in /etc
  145.        
  146.        These files will set up your routes to your remote host. /etc is
  147.        the directory for system configurations. Replace everything in
  148.        double quotes with the appropriate values, naturally (but don't
  149.        include the quotes - they are there for reference). There are
  150.        three files you need to edit, they are:
  151.        
  152.           + /etc/hosts:
  153.  
  154. #The next line is required to be EXACTLY as below.
  155. 127.0.0.1       localhost
  156.  
  157. #Note at the end of the next two entries the hostname is repeated.
  158. #This abbreviation is an alias, and is required for the first entry.
  159. #If you're on a LAN, you'll need to substitute your IP address for
  160. #the first one below.
  161. 192.0.2.1       "yourhostname.domain.name  yourhostname"
  162. "XXX.XXX.XX.XX" "remotehostname.domain.name  remotehostname"
  163.                   + /etc/host.conf:
  164.  
  165. order hosts, bind
  166. multi on
  167.                   + /etc/resolv.conf:
  168.  
  169. domain "yourdomain.name"
  170. #The next line usually uses the same remote IP address that's in /etc/hosts
  171. nameserver "XXX.XXX.XX.XX"
  172.                   + To use an NNTPserver, put this line in your
  173.             /etc/profile:
  174.             
  175.             export NNTPSERVER="remote.hosts.nntpservername"
  176.             
  177.      * 2.3.1 DIP
  178.        
  179.        DIP (Dialup Internet Protocol) is what you will use to dial up the
  180.        remote host, start the emulator, and convert the line to SLIP/PPP.
  181.        It comes in the "N" set of Slackware, along with a bunch of
  182.        clients and utilities, some of which you may want to install also
  183.        =). It is also available at Sunsite in an individual tar file
  184.        
  185.        Once you have it installed, you will need to have a dip script,
  186.        Here's a sample, just plug in the appropriate stuff where the
  187.        double quotes are (but don't include the quotes, they are there
  188.        for reference).
  189.        
  190.        ----------CUT HERE--------------------------------
  191.        
  192.  
  193. main:
  194.   get $local "yourhostname.domain.name"
  195.   get $remote "remotehostname.domain.name"
  196.  
  197. #Your port here
  198.   port cua"?"
  199.  
  200. #Use 115200 for 28.8 modems
  201.   speed 57400
  202.   reset
  203.  
  204. #don't use spaces in your AT command string!
  205.   init AT "string of commands"
  206.   wait OK 5
  207.  
  208. # This will redial. If it doesn't work, play with the wait time (listen
  209. # to your modem). If it still doesn't work, mail me.
  210. # _See also; the note at the bottom of the script re: error codes._
  211.  
  212. dial:
  213.   dial "phonenumber"
  214.   print Dialing...
  215.   if $errlvl != 0 goto error
  216.  
  217. #You may need to change this wait time to suit your modem
  218.   wait BUSY 20
  219.   if $errlvl == 0 goto dial
  220.  
  221. login:
  222.   print Connected and Logging in...
  223.  
  224. #This wait and send gets me past my hosts Annex. _Change for your site!_
  225.   wait ==> 60
  226.   send 4\n
  227.   wait ogin: 60
  228.   if $errlvl != 0 goto login_error1
  229.   send "LOGIN"\n
  230.   wait assword: 60
  231.   if $errlvl != 0 goto login_error2
  232.   send "PASSWORD"\n
  233.  
  234. loggedin:
  235.   wait "SYSTEM PROMPT" 60
  236.   if $errlvl != 0 goto shell_error
  237.   print Logged in!
  238.   send "emulator startup command"\n
  239.   wait "emulator startup response" 60
  240.   if $errlvl != 0 goto emu_error
  241.  
  242. #The recommended mtu setting is 1500, but this is faster interactively.
  243. #Ftp may be slower, so adjust to taste.
  244.   get $mtu 296
  245.   default
  246.  
  247. done:
  248.   print CONNECTED to $remote with address $rmtip
  249.   mode CSLIP
  250.   goto exit
  251.  
  252. error:
  253.   print Dialing Error
  254.  
  255. login_error1:
  256.   print No Login
  257.  
  258. login_error2:
  259.   print No Password prompt
  260.  
  261. shell_error:
  262.   print No shell prompt
  263.  
  264. emu_error:
  265.   There was a problem starting the emulator
  266.  
  267. exit:
  268.  
  269. #This will error out when the -v flag is used, but work when run normally
  270. #(ends dip at a local prompt).
  271.   \r
  272.    -------------CUT HERE-----------------------------
  273.        
  274.        
  275.        
  276.      * 2.3.2 Dip notes Newer versions of dip don't return modem status
  277.        codes (BUSY, NO CONNECT, etc.), they use numbers instead. Here's a
  278.        table:
  279.        
  280.           + 0 = OK
  281.           + 1 = CONNECT
  282.           + 2 = ERROR
  283.           + 3 = BUSY
  284.           + 4 = NO CARRIER
  285.             
  286.    This would make your dial section look like this:
  287.  
  288. dial:
  289.   dial "phonenumber"
  290.   print Dialing...
  291.   if $errlvl != 0 goto error
  292.   wait 1 20
  293.   if $errlvl != 1 goto dial
  294.    
  295.        
  296.        Thanks to Lee Olds (lee@eskimo.com) for that bit.
  297.        
  298.        \n = newline, \r = carriage return. You may require one or the
  299.        other (or both) in the appropriate places. If the ones provided
  300.        don't work, experiment.
  301.        
  302.        A word about the form of the wait and sends. If it isn't clear by
  303.        the example, here's what's happening:
  304.  
  305.   wait ogin: 60
  306.         (the script will wait for the remote to send 'ogin:' for 60
  307.          seconds. When it gets it, the script advances. If it doesn't get
  308.          it, it will advance after the timeout of 60 seconds.)
  309.   if $errlvl != 0 goto login_error1 (this whole line is optional)
  310.         (if the script is advancing because it got what it was waiting for,
  311.          this gets skipped. if the script is advancing because it timed out,
  312. o        it will go to where you tell it to ('login_error1' in this case)
  313.   send "LOGIN"\n
  314.         (DIP will send 'LOGIN' and a newline)
  315.    
  316.        
  317.        You can put in sleep statements if you need to, like this: "sleep
  318.        10" This will make the script pause for 10 seconds.
  319.        
  320.        After editing this file, rename it, say, remote.dip and put it in
  321.        /root. Then, as root, run 'dip remote'. Use the -v flag the first
  322.        time to debug it ('dip -v remote'), this will show you all the
  323.        steps dip takes.
  324.        
  325.        Dip will only run as root, but there is a way to make it run from
  326.        a user account. For now, if you need this info, ask. I may include
  327.        it in this file later if enough people want it.
  328.        
  329.        If dip errors out right away, try removing the comments from the
  330.        script.
  331.        
  332.      * 2.4 PPP
  333.        
  334.        The above gets you rolling with CSLIP, which is really fine most
  335.        of the time. It truly is easy to get working, since the protocol
  336.        is supported at the kernel level - just make sure it's in there
  337.        and it works.
  338.        
  339.        However, some of you will want PPP, for what reasons, only you can
  340.        say. I'm not going to tell you how to set it up here, there's a
  341.        whole other HOWTO written just for that. What I will do is tell
  342.        you what the gotchas are when using PPP with an emulator.
  343.        
  344.        First, the latest version of DIP says you can use it to start PPP,
  345.        and you can, BUT it only starts the PPP daemon - no flags,
  346.        nothing. So if you want to use DIP to start PPP, be sure to put
  347.        all of your startup info in the /etc/ppp/options file, or it won't
  348.        work.
  349.        
  350.        Speaking of the options file, one of the things that MUST be in
  351.        there no matter how you start pppd is this:
  352.        '192.0.2.1:XXX.XXX.XX.XX'. What this is is
  353.        'localIPaddress:remoteIPaddress'. You need it there because
  354.        normally pppd can fill in the blank itself, but fails when
  355.        connecting to an emulator.
  356.        
  357.        Be sure to get the latest and greatest pppd package. It seems
  358.        there were a few versions recently that had a bit of trouble.
  359.        
  360.        Lastly, unless you have a good reason to use PPP, or just want to
  361.        learn how it works, you really don't need it. I have tried them
  362.        both, and didn't notice any performance difference with the
  363.        standard set of clients. Of course, Your Mileage May Vary. :)
  364.        
  365.    
  366.      _________________________________________________________________
  367.    
  368.      * 3.0 Now what?
  369.        
  370.        Hey, if all went well, you are now connected to the Net! Try a
  371.        'telnet remotehostname' (remember that abbreviation in your hosts
  372.        file?). You should get the remotes telnet login prompt. Go on, try
  373.        it! You can now telnet/FTP/etc. anywhere on the Net from your
  374.        local machine. How? Your machine is using the remote as a
  375.        nameserver to resolve addresses (resolv.conf). Experiment, find
  376.        out what works and what doesn't.
  377.        
  378.        You will not be able to use services that are not provided already
  379.        on your remote host! For example, if your server doesn't allow
  380.        telnets, chances are you can't do it either. Why? Because the
  381.        emulator is only re-directing what is already available.
  382.        
  383.      * 3.1 Mail
  384.        
  385.        The obvious text based solution is Pine, you can get it from The
  386.        University of Washington.
  387.        
  388.        My pick for 'Best Mail Reader, X Based' has to go to XFmail. This
  389.        has now gotten out of beta, and rocks. Easy to install; requires
  390.        no local mail system be installed (but will work with local
  391.        spools) because it has POP built in - no more popclient/fetchpop!
  392.        Easy to use; totally customizable from the GUI. Also supports
  393.        MIME. Get it from The XFmail Homesite.
  394.        
  395.      * 3.2 News
  396.        
  397.        The text based News Reader SLRN is fairly simple to install and
  398.        use. It is a true NNTP newsreader, which means _no local news
  399.        transport is required_ to make it work (you don't have install
  400.        Cnews or INN). It does require that you have access to an
  401.        NNTPserver, naturally, but most ISPs have this. It is text based,
  402.        but has color and mouse support, and runs fine in an rxvt window.
  403.        
  404.        The X based News Reader KNews is almost perfect. As with SLRN
  405.        above, no local transport is required, but an NNTP server is. It's
  406.        at least worth a look.
  407.        
  408.      * 3.3 Mosaic/Netscape
  409.        
  410.        Obviously, you will need to have X running for this to work, but
  411.        it's a simple matter of FTPing the binary, unpacking it, and
  412.        installing it.
  413.        
  414.    
  415.      _________________________________________________________________
  416.    
  417.      * 4.0 Misc.
  418.        
  419.        If I've left anything out, or you still have questions, I read my
  420.        mail daily. This information gets updated fairly regularly, so
  421.        keep checking back every so often (I'll change the version
  422.        numbers). Naturally, the more you contribute, the more info will
  423.        be included here, so don't hesitate to tell me about whatever you
  424.        have to offer.
  425.        
  426.        If you would like some help, or are having trouble with your
  427.        setup, I'll help _but you must send me the following info:_ 1. A
  428.        copy of your three /etc files. 2. A copy of your script output,
  429.        run with the -v flag (_please_ remove your password from this!)
  430.        Even if you don't have anything to contribute, but used this info
  431.        sucsessfully, PLEASE MAIL ME. I want to know how useful this
  432.        really is.
  433.      * 4.1 References
  434.        
  435.        Sunsite is the FTP site sunsite.unc.edu, a veritable plethora of
  436.        everything Linux, including almost every FAQ, HOWTO, and README
  437.        written.
  438.        
  439.        Marketplace.com is the home of TIA, the only place it is
  440.        available. I am Irish, irish@eskimo.com, available for comment on
  441.        Linux almost everyday, when I'm not petting my cat or hugging my
  442.        kid.
  443.        
  444.        
  445.        
  446.        This HOWTO is available in the following places:
  447.           + http://www.eskimo.com/~irish
  448.           + ftp://ftp.eskimo.com/u/i/irish
  449.           + ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/TIA
  450.