			LINUX PLIP MINI-HOWTO

Last Update: 08/01/1996 (dd/mm/yyyy date format) 
Copyright: 1996 by Andrea Controzzi <controzz@cli.di.unipi.it> 
	   See the copyright message below.

This HOWTO will hopefully let you build and use a Parallel Line Interface
Protocol.
For any question, error correction, comment and/or suggestion, my E-Mail
address is: controzz@cli.di.unipi.it. Feel free to mail me any time you
need help.
First of all, most of these information come from the net-2-HOWTO, by
Terry Dawson. This mini-HOWTO is not supposed to cover other aspects and/or 
replace the net-2-HOWTO: my goal is to give you a way to install a PLIP
permanent connection quickly, *ONLY* this.
Read the net-2-HOWTO and the other docs for the general information about
the network and the config files I suggest to change.
Last, but not least, look at my quick PLIP installation paragraph.
The following is the index of the contents; you can quickly find the right
paragraph searching for the string __nn__ where nn is the paragraph number.

INDEX
=====

0) Introduction: what is PLIP and why should I use it?
1) Hardware required to use PLIP.
2) Reconfigure the kernel.
3) Setting up the configuration files. 
4) Kernel messages at boot time. 
5) Common troubles.
6) A quick PLIP installation.
7) Questions? Comments? Send me feedback.
8) Where to find new releases of this mini-howto.
9) Copyright message.


__0__ INTRODUCTION: WHAT IS PLIP AND WHY SHOULD I USE IT?

There are many ways to create a connection between multiple hosts. PLIP,
like SLIP, allow a local connection between two machines via the parallel
ports.
A PLIP connection is very similar to the SLIP (with a leased cable) one,
but uses parallel ports instead of the serial ports. Parallel ports
transfer more than one bit at a time, this means it is possible to
achieve higher speeds than with a serial interface.
The PLIP interface is fast enough to allow some decent tcp/ip
functions, like NFS. So, you may have a computer with all your Linux stuff
and another with only the minimal system, where you can mount all the rest
from the main machine.
The disadvantage is that most users have only one parallel port, this means
that you won't be able to print and use PLIP together. Even with two or more 
parallel ports, using PLIP and the printer is impossible without using
the kernel modules. Indeed, to use PLIP you must *NOT* have a kernel with
printer support enabled (see the kernel section for more info).
In order to use printer, you must create a printer module.


__1__ HARDWARE REQUIRED TO USE PLIP

The hardware required to set up a PLIP interface is (obviously) a free
parallel port in both the machines and the cable.
About the cable, this is what is written in the plip.c file, in the kernel
1.2.13 source:

  The cable used is a de facto standard parallel null cable -- sold as
  a "LapLink" cable by various places.  You'll need a 12-conductor cable to
  make one yourself.  The wiring is:
    SLCTIN      17 - 17
    GROUND      25 - 25
    D0->ERROR   2 - 15          15 - 2
    D1->SLCT    3 - 13          13 - 3
    D2->PAPOUT  4 - 12          12 - 4
    D3->ACK     5 - 10          10 - 5
    D4->BUSY    6 - 11          11 - 6
  Do not connect the other pins.  They are
    D5,D6,D7 are 7,8,9
    STROBE is 1, FEED is 14, INIT is 16
    extra grounds are 18,19,20,21,22,23,24

In my opinion you should avoid to build your own parallel null cable. A 
self-made cable may save very little money, but can add lots of headaches.
If you wish to build your parallel cable, remember that you're doing it at
your own risk, I reported exactly what is written in plip.c but I don't give
warranties.


__2__ RECONFIGURE THE KERNEL

You're supposed to already know how to configure and compile the kernel,
otherwise you must get some doc (kernel-howto or other guides).
Anyway, for the sake of completeness, here is a quick summary of what you 
must do:

NOTE: This is true for the kernel 1.2.13, the configuration may change in
      the 1.3.xx kernel series.

Cd to the directory where there are the kernel sources

  #cd /usr/src/linux   

And start the configuration

  #make config

During the configuration, make sure to answer y *at least* to the following
questions:

  Networking support (CONFIG_NET) [y] y
  TCP/IP networking (CONFIG_INET) [y] y
  Network device support? (CONFIG_NETDEVICES) [y] y
  PLIP (parallel port) support (CONFIG_PLIP) [n] y

You may want to answer yes also to the following questions:

  IP forwarding/gatewaying (CONFIG_IP_FORWARD) [n]
  IP multicasting (CONFIG_IP_MULTICAST) [n]
  IP firewalling (CONFIG_IP_FIREWALL) [n]
  IP accounting (CONFIG_IP_ACCT) [n]
  NFS filesystem support (CONFIG_NFS_FS) [y]

You MUST finally answer no to the following question:

  Parallel printer support? [y] n

Finally compile with

  #make dep ; make clean
  #make zlilo

This will make your printer unusable, but you can still use the kernel
modules. Please refer to the kernel guides and the kernel-HOWTO.


__3__ SETTING UP THE CONFIGURATION FILES

First of all remember to backup all the files you will change, 

  #cp rc.inet1 rc.inet1.BACKUP 

may be a good idea.
Now, if you don't have it done already, you must choose the IP addresses of
the two machines. 
In my examples I'll use a couple of example IPs for the IPs that you'll write,
in the standard xxx.xxx.xxx.xxx format.

  In the /etc/rc.d/inet1.rc file of both the machines add this (better if in 
the last part of the file):

/sbin/route add -net ${NETWORK} netmask ${NETMASK}

Where NETWORK and NETMASK should be set up previously. If you don't know how 
to do it, please read the NET-2-HOWTO. 
You may safely ignore these variables only in the following case.
If you only want to connect two machines on a standalone network, you may 
pick-up any IP address, say 200.0.0.1 and 200.0.0.2 respectively.
In this case you can safely put NETWORK="200.0.0.0" and NETMASK="255.255.255
.0". These are the example IPs that I use in my Quick PLIP Installation (see
below).

  In the file /etc/hosts of both the machines you should add the entries with
the IP of the machines that you connect via PLIP. In my example, the entries
are:

200.0.0.1       one             # this is the "one" IP address
200.0.0.2       two             # this is the "two" IP address

Where one and two are the names of the two hosts.

  If you want to activate the NFS, beside answering yes during the kernel
configuration, you must add in /etc/exports the entries that describe the
directories that you wish to export. In my example, to be able to mount
the directory /usr, you should add this entry:

 /usr                          two (ro)

  Finally, these are the commands, that must be executed with root rights, 
that activate the PLIP interface (of course the cable must be already plugged 
correctly).
Again I use the name one and two, as example. On "one" you must type:

  #ifconfig plip1 one pointopoint two up
  #route add two

And, if you want also the NFS:

  #rpc.portmap
  #rpc.mountd
  #rpc.nfsd

On "two" the commands are the same, but you must write one instead of two 
and vice versa.
  One of your machines is likely to have only the PLIP connection, if this is
true, you may also type:

  #route add default gw one

on that machine. In my example above, two is a laptop with only a PLIP
connection with one, so I type the above line on two.

  Of course you may want to have all these commands automatically done
by a script or at boot time. You must only create a script that execute these
commands: now you may invoke it as root when you need, or you may add a 
command (in /etc/rc.d/rc.inet2) that calls it at boot time.
If you want to use my Quick PLIP Installation, you will find all the config
files and the script.

__4__ KERNEL MESSAGES AT BOOT TIME

After you've reconfigured and compiled the kernel with PLIP support enabled,
examine the messages with the dmesg (8) command.
You should get something like this:

NET3 PLIP version 2.0 gniibe@mri.co.jp
plip1: Parallel port at 0x378, using assigned IRQ 7.

You *must not* get a message like:

lp_init: lp1 exists, using polling driver

This means that you compiled the kernel with printer support enabled.


__5__ COMMON TROUBLES

So far this section is incomplete, since I'm lucky enough not to have many
problem with PLIP. This section will be (hopefully) filled with *your*
problems that I may solve.

  List of common troubles
  ------------------------

The trouble is listed with a =, the solution(s) with a -

= I get these messages at boot time:
    SIOCSIFADDR: No such device
    SIOCADDRT: Network is unreachable
  and when I try to set up the link as written above, I get again error
  messages like:
    SIOCSIFADDR: No such device
    SIOCSIFDSTADDR: No such device
    SIOCADDRT: Network is unreachable
    mount clntudp_create: RPC: Port Mapper failure - RPC: Unable to send
- The kernel, for some reason, hasn't PLIP support enabled. This could be
  due to:
   . You didn't answer yes to "PLIP support? " during kernel configuration.
   . You answered yes to "Printer support? " during kernel configuration.
   . You compiled PLIP as a module, so you must load it. 

= I have created the script that connects my 2 computers. I set up the
  link automatically in my rc.inet2, where I call a script that creates
  the link and enables VFS.
  My "two" hosts mounts some "one"'s directories; I have added the 
  correct entries in "two"'s /etc/fstab.
  If I boot "two" when "one" is down, "two" halts for some minutes 
  on the "mounting remote file systems...".
- This happens because "two" waits to mount the "one" filesystems, but
  if "one" is down you must wait until "two" is bored of waiting.
  To avoid this, you may:
   . Comment out in rc.inet2 the command that mounts the remote filesystems
   . Remove the entry in "two"'s /etc/fstab and mount the remote filesystems
     manually when and if you need.


__6__ A QUICK PLIP INSTALLATION

Before doing this mini-HOWTO, I created a quick PLIP installation set of
files. 
In few minutes, beside compiling the kernel, you should be able to set up
a PLIP interface.
The tarred and gzipped set of files may be found on my Home Page, at

http://www.cli.di.unipi.it/~controzz/intro.html

Perhaps someone will let my files available at some ftp site.


__7__ QUESTIONS? COMMENTS? SEND ME FEEDBACK

For any questions and comments you can find me via e-mail at the address
controzz@cli.di.unipi.it
Feedback is welcome, any error report is precious.
The next release should have a (your) FAQ section. So far I have put
only a common troubles section.


__8__ WHERE TO FIND NEW RELEASES OF THIS MINI-HOWTO

This mini-HOWTO is maintained by the HOWTO coordinators and is posted
monthly on comp.os.linux.answers and can be found in the HOWTO directory
at sunsite and at sunsite's mirrors.

Another way to find the mini-HOWTO (and to contact me) is on my Home Page,

http://www.cli.di.unipi.it/~controzz/intro.html


__9__ COPYRIGHT MESSAGE

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.

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.

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.

If you have questions, please contact Greg Hankins, the Linux HOWTO
coordinator, at
gregh@sunsite.unc.edu via email, or at +1 404 853 9989.

--- END ---
