<?xml version="1.0"?>
<article><articleinfo><title>SLIP/PPP Emulator mini-HOWTO</title><author><firstname>Irish</firstname><affiliation><address format="linespecific"><email>irish@eskimo.com</email> </address></affiliation></author><pubdate>2001-02-21</pubdate><revhistory><revision><revnumber>3.1</revnumber><date>21 February 2001</date><authorinitials>GCR</authorinitials></revision><revision><revnumber>3.0</revnumber><date>7 August 1997</date><authorinitials>Irish</authorinitials></revision></revhistory><othercredit><firstname>Glen</firstname><surname>Reesor</surname><contrib>      Converted document from HTML to DocBook v4.1 (SGML)
   </contrib></othercredit><abstract><para>     This document will describe how to get your Linux box to connect
     to a generic site via a SLIP/PPP emulator, such as SLiRP or TIA. I take no
     responsibility for your use of this information, but corrections are
     welcome.
    </para><para>     I will not attempt to describe all that can be done over this 
     connection once established, but I will refer you to other documents or 
     sites that will contain the relevant information.
    </para><para>     That done, let's do it!
    </para></abstract></articleinfo><sect1 id="intro"><title>Introduction</title><para>   I am Irish, <email>irish@eskimo.com</email>, available for comment on 
   Linux almost everyday, when I'm not petting my cat or hugging my kid.
  </para><para>   This HOWTO is available in the following places:
   <itemizedlist><listitem><para>        <ulink url="http://www.linuxdoc.org">http://www.linuxdoc.org</ulink>
      </para></listitem><listitem><para>        <ulink url="ftp://ftp.eskimo.com/u/i/irish">ftp://ftp.eskimo.com/u/i/irish</ulink>
      </para></listitem><listitem><para>        <ulink url="ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/TIA">ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/SLIP-PPP-Emulator</ulink>
      </para></listitem></itemizedlist>
  </para><sect2 id="copyright"><title>Copyright Information</title><para>    This document is copyrighted (c) 2001 Irish and is
    distributed under the terms of the Linux Documentation Project
    (LDP) license, stated below.
   </para><para>    Unless otherwise stated, Linux HOWTO documents are
    copyrighted by their respective authors. Linux HOWTO documents may
    be reproduced and distributed in whole or in part, in any medium
    physical or electronic, as long as this copyright notice is
    retained on all copies. Commercial redistribution is allowed and
    encouraged; however, the author would like to be notified of any
    such distributions.
   </para><para>    All translations, derivative works, or aggregate works
    incorporating any Linux HOWTO documents must be covered under this
    copyright notice. That is, you may not produce a derivative work
    from a HOWTO and impose additional restrictions on its
    distribution. Exceptions to these rules may be granted under
    certain conditions; please contact the Linux HOWTO coordinator at
    the address given below.
   </para><para>    In short, we wish to promote dissemination of this
    information through as many channels as possible. However, we do
    wish to retain copyright on the HOWTO documents, and would like to
    be notified of any plans to redistribute the HOWTOs.
   </para><para>    If you have any questions, please contact 
    <email>irish@eskimo.com</email>
   </para></sect2><sect2 id="disclaimer"><title>Disclaimer</title><para>    No liability for the contents of this documents can be accepted.
    Use the concepts, examples and other content at your own risk.
    As this is a new edition of this document, there may be errors
    and inaccuracies, that may of course be damaging to your system.
    Proceed with caution, and although this is highly unlikely,
    the author(s) do not take any responsibility for that.
   </para><para>    All copyrights are held by their by their respective owners, unless
    specifically noted otherwise.  Use of a term in this document
    should not be regarded as affecting the validity of any trademark
    or service mark.
   </para><para>    Naming of particular products or brands should not be seen 
    as endorsements.
   </para><para>    You are strongly recommended to take a backup of your system 
    before major installation and backups at regular intervals.
   </para></sect2><sect2 id="newversions"><title>New Versions</title><para>    The latest version number of this document can be found at:
   <itemizedlist><listitem><para>        <ulink url="http://www.linuxdoc.org">http://www.linuxdoc.org</ulink>
      </para></listitem><listitem><para>        <ulink url="ftp://ftp.eskimo.com/u/i/irish">ftp://ftp.eskimo.com/u/i/irish</ulink>
      </para></listitem><listitem><para>        <ulink url="ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/TIA">ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/SLIP-PPP-Emulator</ulink>
      </para></listitem></itemizedlist>

  </para></sect2><sect2 id="feedback"><title>Feedback</title><para>    Feedback is most certainly welcome for this document. Without
    your submissions and input, this document wouldn't exist. Please
    send your additions, comments and criticisms to the following
    email address : <email>irish@eskimo.com</email>.
   </para></sect2></sect1><sect1 id="how-does-it-work"><title>How Does an Emulator Work?</title><para>   It is important to understand how a SLIP/PPP emulator works in
   general, to be aware of its limitations. First, you do not need to install
   the emulator on your machine. It runs on your remote host only. What you
   need on your machine is the TCP/IP and SLIP or PPP protocols installed in 
   your kernel (more on that in a bit), and some clients.
  </para><para>   Here's what happens: you send network requests from your machine
   to your remote host over the SLIP/PPP link. The emulator grabs them and
   sends them out to the Net at large. Then, incoming data is sent back from
   the Net to your account on the remote host, where the emulator grabs it
   and sends it back over the SLIP/PPP link to your machine. So, to the Net
   it appears as if you are working out of your account on the remote host,
   but to you it looks like you are really connected right to the Net.
  </para><para>   As you can see, this can confuse stuff that is incoming from the
   Net. For example, talk doesn't work via an emulator, because the incoming 
   talk request tries to start the remote hosts talk daemon, not yours.
  </para><para>   The other big difference between an emulator and real SLIP/PPP is
   you are NOT assigned your own IP address; remember, you are only
   converting a dialup account to a SLIP/PPP connection.
  </para><sect2 id="what-is-tia"><title>What is TIA?</title><para>    <ulink url="http://www.marketplace.com/tia/tiahome.html">The Intenet Adaptor</ulink> 
    was written by the fine folks at marketplace.com. They have 
    quit working on it now, and consider it a 'mature' product. The last 
    version is 2.05; if you are going to use TIA, please get this version. 
    
    <note><para>      At last report, marketplace.com have gone out of business.
    </para></note>
   </para></sect2><sect2 id="what-is-slirp"><title>What is SLiRP?</title><para>    This is a freeware application, covered under the GNU Public 
    License. It is out of beta, and is real stable. It sports a few more 
    features than TIA, and is (reportedly) easier on host resources. 
    Available at fine Linux FTP sites everywhere.
   </para></sect2><sect2 id="what-about-term"><title>What about Term?</title><para>    If you don't have root access to your machine for one reason or
    another, and you can't persuade someone who does to install SLIP and dip,
    then you won't have much choice except to use Term. If you want to know
    more about Term, please read the HOWTO on Sunsite.
   </para></sect2><sect2 id="what-about-real-slip"><title>What about real SLIP/PPP?</title><para>    Hey, a lot of places are offering real SLIP/PPP at reasonable 
    prices for non-dedicated dialup nowadays. If you can afford it, or feel 
    the need, go for it. The Real Thing is always better than emulation. 
    However, one of the things an emulator provides is security; it acts as 
    an impregnable firewall, and with it you are pretty much as bulletproof 
    as your provider is. You'll pay for it though, emulation is slower, and 
    does not fully support every protocol. Still and all, emulation is good 
    enough for most people, and is a fine way to connect to the Net.
   </para></sect2></sect1><sect1 id="prerequisites"><title>Prerequisites</title><para>    Enough already! How do I set it up?
   </para><para>    Alright hotrod, we're getting there, but first there's some info 
    you need to get, and a couple of explanations.
   </para><para>    First, you need to get the IP address of your provider, if you don't 
    have it already. You can do this by typing 'who' at a shell prompt there, 
    or reading their <filename moreinfo="none">/etc/hosts</filename>, or even just asking 
    them. While your getting 
    that, get the IP address of the POP/SMTP host and the NNTP server (if you 
    don't know what those are, trust me and ask for them anyway, you'll need 
    'em).
   </para><para>    Next, let me explain quickly about hostnames and domain names. 
    The hostname is the first part of a machines name, the domain is the rest 
    of it. Like this: hostname.domain.name (a four parter would be 
    hostname.do.main.name). Together, they make a Fully Qualified Domain 
    Name (FQDN).
   </para><para>    The name of your Linux machine is stored in 
    <filename moreinfo="none">/etc/HOSTNAME</filename>, and 
    yes, you can change it. In fact, please do (if you're using Slackware, 
    it'll be "darkstar.frop.org" by default). Just edit the 
    <filename moreinfo="none">/etc/HOSTNAME</filename>
    file to be whatever you want - remember, if you are using an emulator, 
    you are essentially invisible to the Net at large, so you can be 
    creative. However, if you plan to get a real SLIP/PPP connection down the 
    road sometime, you'll probably want to conform to being a sub-host of 
    your provider. For example, if your provider is "info.superhiway.com", 
    the domain is "superhiway.com" and the hostname is "info". So you could 
    either be "offramp.info.superhiway.com" or just "offramp.superhiway.com". 
    Either would work, and in either case your hostname is "offramp".
   </para></sect1><sect1 id="preparing-your-machine"><title>Preparing your Linux Machine</title><para>	In a nutshell, here's what's required. I'll explain the first three
in detail.
   </para><itemizedlist><listitem><para>           Compile your kernel to include SLIP and TCP/IP
        </para></listitem><listitem><para>           Edit some files in <filename moreinfo="none">/etc</filename>
        </para></listitem><listitem><para>           Install and configure dip
        </para></listitem><listitem><para>           Install pppd (optional, for PPP only)
        </para></listitem></itemizedlist><para>    You will also need to get an emulator binary appropriate for your
    remote host and install it.  SLiRP is available at 
    <ulink url="ftp://sunsite.unc.edu/pub/Linux/index.html">Sunsite</ulink> 
    and other
    fine Linux FTP sites. All of the relevant info for TIA is available at 
    <ulink url="http://marketplace.com/tiahome/tia.html">TIAs home site</ulink>. 

   </para><para>    That's it!  Let's get started.
   </para><sect2 id="compiling-your-kernel"><title> Compiling your Kernel </title><para>    If you have never done this, you should. And you should read the 
    FAQ first, but don't worry, it's easy. If you want, you can e-mail me and 
    I'll help.
   </para><para>    I'll assume that you have here, for the sake of brevity. When you
    'make config', look for "Network Devices". Say 'y', of course, then say
    'y' to SLIP, CSLIP, (or PPP) and TCP/IP and 'n' to everything else, unless
    you have ethercards or need some other protocol for something else. 
    <emphasis>If
    you don't do this, it won't work! </emphasis>Finish compiling and 
    installing 
    the new kernel, then,
   </para></sect2><sect2 id="edit-some-files"><title> Edit some files in <filename moreinfo="none">/etc</filename> </title><para>    These files will set up your routes to your remote host. 
    <filename moreinfo="none">/etc</filename> is
    the directory for system configurations. Replace everything in double
    quotes with the appropriate values, naturally (but don't include the
    quotes - they are there for reference). There are three files you need to
    edit, they are:
   </para><para>      <itemizedlist><listitem><para>         <filename moreinfo="none">/etc/hosts</filename>
      <programlisting format="linespecific">#The next line is required to be EXACTLY as below.
127.0.0.1       localhost

#Note at the end of the next two entries the hostname is repeated. 
#This abbreviation is an alias, and is required for the first entry.
#If you're on a LAN, you'll need to substitute your IP address for 
#the first one below.
192.0.2.1       "yourhostname.domain.name  yourhostname"
"XXX.XXX.XX.XX"	"remotehostname.domain.name  remotehostname"  
      </programlisting>
      </para></listitem><listitem><para>         <filename moreinfo="none">/etc/host.conf</filename>
      <programlisting format="linespecific">order hosts, bind
multi on
      </programlisting>
      </para></listitem><listitem><para>         <filename moreinfo="none">/etc/resolv.conf</filename>
      <programlisting format="linespecific">domain "yourdomain.name" 	
#The next line usually uses the same remote IP address that's in /etc/hosts
nameserver "XXX.XXX.XX.XX"
      </programlisting>
      </para></listitem><listitem><para>         To use an NNTPserver, put this line in your 
         <filename moreinfo="none">/etc/profile</filename>
      <programlisting format="linespecific">export NNTPSERVER="remote.hosts.nntpservername"
      </programlisting>
      </para></listitem></itemizedlist>
   </para></sect2><sect2 id="dip"><title> DIP </title><para>    DIP (Dialup Internet Protocol) is what you will use to dial up the
    remote host, start the emulator, and convert the line to SLIP/PPP. It
    comes in the "N" set of Slackware, along with a bunch of clients and
    utilities, some of which you may want to install also =). It is also
    available at
    <ulink url="ftp://sunsite.unc.edu/pub/Linux/index.html">Sunsite</ulink> 
    in an individual tar file
   </para><para>    Once you have it installed, you will need to have a dip script, 
    Here's a sample, just plug in the appropriate stuff where the double 
    quotes are (but don't include the quotes, they are there for reference).
   </para><programlisting format="linespecific">main:
  get $local "yourhostname.domain.name"
  get $remote "remotehostname.domain.name"

#Your port here
  port cua"?" 

#Use 115200 for 28.8 modems 
  speed 57400
  reset

#don't use spaces in your AT command string! 
  init AT "string of commands" 
  wait OK 5

# This will redial. If it doesn't work, play with the wait time (listen 
# to your modem). If it still doesn't work, mail me.
# <emphasis>See also; the note at the bottom of the script re: error codes.</emphasis>

dial:
  dial "phonenumber"
  print Dialing...
  if $errlvl != 0 goto error

#You may need to change this wait time to suit your modem
  wait BUSY 20
  if $errlvl == 0 goto dial	

login:
  print Connected and Logging in...

#This wait and send gets me past my hosts Annex. <emphasis>Change for your site!</emphasis>
  wait ==ent 60
  send 4\n
  wait ogin: 60
  if $errlvl != 0 goto login_error1
  send "LOGIN"\n
  wait assword: 60
  if $errlvl != 0 goto login_error2
  send "PASSWORD"\n

loggedin:
  wait "SYSTEM PROMPT" 60
  if $errlvl != 0 goto shell_error
  print Logged in!
  send "emulator startup command"\n
  wait "emulator startup response" 60
  if $errlvl != 0 goto emu_error

#The recommended mtu setting is 1500, but this is faster interactively. 
#Ftp may be slower, so adjust to taste.
  get $mtu 296
  default

done:
  print CONNECTED to $remote with address $rmtip
  mode CSLIP
  goto exit

error:
  print Dialing Error

login_error1:
  print No Login

login_error2:
  print No Password prompt

shell_error:
  print No shell prompt

emu_error:
  There was a problem starting the emulator

exit:

#This will error out when the -v flag is used, but work when run normally 
#(ends dip at a local prompt).
  \r		

   </programlisting><sect3 id="dip-notes"><title> DIP Notes</title><para>    Newer versions of dip don't return modem status codes (BUSY, NO 
    CONNECT, etc.), they use numbers instead. Here's a table:
   <itemizedlist><listitem><para>         0 = OK
      </para></listitem><listitem><para>         1 = CONNECT
      </para></listitem><listitem><para>         2 = ERROR
      </para></listitem><listitem><para>         3 = BUSY
      </para></listitem><listitem><para>         4 = NO CARRIER
      </para></listitem></itemizedlist>
   </para><para>    This would make your dial section look like this:
    <programlisting format="linespecific">dial:
  dial "phonenumber"
  print Dialing...
  if $errlvl != 0 goto error
  wait 1 20	
  if $errlvl != 1 goto dial
   </programlisting>
   </para><para>    Thanks to Lee Olds <email>lee@eskimo.com</email> for that bit.
   </para><para>    \n = newline, \r = carriage return. You may require one or 
    the other (or both) in the appropriate places. If the ones provided don't 
    work, experiment.
   </para><para>    A word about the form of the wait and sends. If it isn't clear by 
    the example, here's what's happening:

    <variablelist><varlistentry><term>wait ogin: 60</term><listitem><para>         The script will wait for the remote to send 'ogin:' for 60 
         seconds. When it gets it, the script advances. If it doesn't get 
         it, it will advance after the timeout of 60 seconds.
       </para></listitem></varlistentry><varlistentry><term>if $errlvl != 0 goto login_error</term><listitem><para>       (This whole line is optional.)
        If the script is advancing because it got what it was waiting for, 
        this gets skipped. if the script is advancing because it timed out, 
	it will go to where you tell it to ('login_error1' in this case.
       </para></listitem></varlistentry><varlistentry><term>send "LOGIN"\n</term><listitem><para>        DIP will send 'LOGIN' and a newline
       </para></listitem></varlistentry></variablelist>
   </para><para>    You can put in sleep statements if you need to, like this:
    "sleep 10" This will make the script pause for 10 seconds.
   </para><para>    After editing this file, rename it, say, remote.dip and put it in 
    <filename moreinfo="none">/root</filename>.  Then, as root, run 
    'dip remote'. Use the -v flag the first 
    time to debug it ('dip -v remote'), this will show you all the steps 
    dip takes.
   </para><para>    Dip will only run as root, but there is a way to make it run from 
    a user account. For now, if you need this info, ask. I may include it in 
    this file later if enough people want it.
   </para><para>    If dip errors out right away, try removing the comments from the 
    script.
   </para></sect3></sect2><sect2 id="ppp"><title>PPP</title><para>    The above gets you rolling with CSLIP, which is really fine 
    most of the time. It truly is easy to get working, since the protocol is 
    supported at the kernel level - just make sure it's in there and it 
    works.
   </para><para>    However, some of you will want PPP, for what reasons, only you can
    say. I'm not going to tell you how to set it up here, there's a whole
    other HOWTO written just for that. What I will do is tell you what the 
    gotchas are when using PPP with an emulator.
   </para><para>    First, the latest version of DIP says you can use it to start PPP,
    and you can, BUT it only starts the PPP daemon - no flags, nothing. So if
    you want to use DIP to start PPP, be sure to put all of your startup info
    in the <filename moreinfo="none">/etc/ppp/options</filename> file, or it won't work.
   </para><para>    Speaking of the options file, one of the things that MUST be in 
    there no matter how you start pppd is this: '192.0.2.1:XXX.XXX.XX.XX'. 
    What this is is 'localIPaddress:remoteIPaddress'. You need it there 
    because normally pppd can fill in the blank itself, but fails when 
    connecting to an emulator.
   </para><para>    Be sure to get the latest and greatest pppd package. It seems 
    there were a few versions recently that had a bit of trouble.
   </para><para>    Lastly, unless you have a good reason to use PPP, or just want to 
    learn how it works, you really don't need it. I have tried them both, and 
    didn't notice any performance difference with the standard set of 
    clients. Of course, Your Mileage May Vary. :)
   </para></sect2></sect1><sect1 id="now-what"><title>Now What?</title><para>    Hey, if all went well, you are now connected to the Net! Try a 
    'telnet remotehostname' (remember that abbreviation in your hosts file?). 
    You should get the remotes telnet login prompt. Go on, try it! You can now 
    telnet/FTP/etc. anywhere on the Net from your local machine. How? Your 
    machine is using the remote as a nameserver to resolve addresses 
    (<filename moreinfo="none">resolv.conf</filename>). Experiment, find out what works and 
    what doesn't.
   </para><para>    You will not be able to use services that are not provided 
    already on your remote host! For example, if your server doesn't allow 
    telnets, chances are you can't do it either. Why? Because the emulator is 
    only re-directing what is already available.
   </para><sect2 id="mail"><title>Mail</title><para>    The obvious text based solution is Pine, you can get it from
    <ulink url="ftp://ftp.cac.washington.edu">The University of Washington </ulink>.
   </para><para>    My pick for 'Best Mail Reader, X Based' has to go to XFmail. This
    has now gotten out of beta, and rocks. Easy to install; requires no local
    mail system be installed (but will work with local spools) because it has
    POP built in - no more popclient/fetchpop! Easy to use; totally 
    customizable 
    from the GUI. Also supports MIME. Get it from
    <ulink url="http://burka.netvision.net.il/xfmail/xfmail.html">The XFmail Homesite</ulink>.
   </para></sect2><sect2 id="news"><title>News</title><para>    The text based News Reader
    <ulink url="ftp://space.mit.edu/pub/davis/slrn">SLRN</ulink> is fairly simple to
    install and use.  It is a true NNTP newsreader, which means 
    <emphasis>no local news transport is required</emphasis> to make it work 
    (you don't have install
    Cnews or INN). It does require that you have access to an NNTPserver,
    naturally, but most ISPs have this. It is text based, but has
    color and mouse support, and runs fine in an rxvt window.
   </para><para>    The X based News Reader
    <ulink url="http://www.matematik.su.se/~kjj/">KNews</ulink> is 
    almost perfect. As with SLRN above, no local transport is required, but 
    an NNTP server is. It's at least worth a look.
   </para></sect2><sect2 id="mosaic-netscape"><title>Mosaic/Netscape</title><para>    Obviously, you will need to have X running for this to work, but 
    it's a simple matter of FTPing the binary, unpacking it, 
    and installing it.
   </para></sect2></sect1><sect1 id="miscellaneous"><title>Miscellaneous</title><para>    If I've left anything out, or you still have questions, I read my 
    mail daily. This information gets updated fairly regularly, so keep 
    checking 
    back every so often (I'll change the version numbers). Naturally, the more 
    you contribute, the more info will be included here, so don't hesitate to 
    tell me about whatever you have to offer.
   </para><para>    If you would like some help, or are having trouble with your
    setup, I'll help 
    <emphasis>but you must send me the following info:</emphasis>
    <orderedlist inheritnum="ignore" continuation="restarts"><listitem><para>        A copy of your three <filename moreinfo="none">/etc</filename> files. 
       </para></listitem><listitem><para>        A copy of your script output, run with the -v flag 
        (<emphasis>please</emphasis> remove your password from this!)
       </para></listitem></orderedlist>
   </para><para>    Even if you don't have anything to contribute, but used this info
    sucsessfully, <emphasis>please mail me</emphasis>. I want to know how 
    useful this really is.
   </para><sect2 id="references"><title>References</title><para>    Sunsite is the FTP site
    <ulink url="ftp://sunsite.unc.edu/pub/Linux/index.html">sunsite.unc.edu</ulink>, a
    veritable plethora of everything Linux, including almost every FAQ, HOWTO,
    and README written.
   </para><para>    <ulink url="http://marketplace.com/">Marketplace.com</ulink> is the home
    of TIA, the only place it is available. <note><para>    Marketplace.com appears to be out of business.
    </para></note>
   </para><para>    I am Irish, <email>irish@eskimo.com</email>, available for comment on 
    Linux almost everyday, when
    I'm not petting my cat or hugging my kid.
   </para><para> 
   This HOWTO is available in the following places:
   <itemizedlist><listitem><para>        <ulink url="http://www.linuxdoc.org">http://www.linuxdoc.org</ulink>
      </para></listitem><listitem><para> 
        <ulink url="ftp://ftp.eskimo.com/u/i/irish">ftp://ftp.eskimo.com/u/i/irish</ulink>
      </para></listitem><listitem><para>        <ulink url="ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/TIA">ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/SLIP-PPP-Emulator</ulink>
      </para></listitem></itemizedlist>
  </para></sect2></sect1></article>

