HOW TO NETWORK USING THE PARALLEL PORT AND A NULL-MODEM CABLE


Copyright (C) 2004 Daniel Brodzik

This document is free software; you may distribute and/or modify it under the terms of the GNU Free Documentation License; either version 1.2 of the license or, at your option, any later version, with no Front Cover Texts, no Back Cover Texts, and no Invariant Sections.


INTRODUCTION

About five months before I switched from using Windows to Linux, I bought a parallel data transfer cable. This type of cable is commonly called a LapLink cable after the software that originated the cable design. I bought this after my friend gave me his old 486 laptop (which was, and still is broken). Using InterLink for DOS or Direct Cable Connection for Windows, I could create a network between two PC's, and I could even share drives or printers. I got a 486 desktop system from my mother's boyfriend which had Windows 95 OSR2 on it. The other computer, my 120 MHz Pentium, had Windows 98 SE. When I quit using Windows, I thought I had to use FreeDOS to transfer files between the two computers. (Since then, the Pentium was replaced twice, first with a 166 MHz Pentium MMX, and now a 333 MHz Pentium II.) I didn't have any big problems with it, only minor annoyances. First, any filenames longer than 8.3 would be truncated. The second annoyance was that I'd lose the file permissions by copying files onto my FAT16 partition. The third annoyance was the FAT16 (DOS) partitions are smaller than my EXT3 (Linux) partitions. The fourth, and biggest, annoyance: I had to reboot my computers to run DOS.


So, I started doing research trying to find easy-to-follow directions for networking through the parallel port. (I spent $5 for the cable, and I was determined to use it!) I found out that using the parallel port like an Ethernet card is called 'PLIP', for 'Parallel Line Internet Protocol'. In other words, the parallel port equivalent of SLIP. The first time I tried it, I failed with "Can't connect: connection refused" messages. Now that I know a lot more about Linux, I decided to try again with the PLIP HOWTO from the Linux Documentation Project. I finally had success!! Now, I will share with you the steps I took to set up parallel-port networking with NFS (NFS=Network File System=file sharing) under Linux. The PLIP HOWTO did not give me any help on how to mount the other computer's filesystem, so I had to figure that out on my own.


Now that I have a new laptop which doesn't have a floppy drive, I am finding this setup very helpful.


As an added bonus, I have added directions on how to log in to one computer while typing at the other remotely. I will also demonstrate the network transparency of the X Window System by showing you how to start and run an X program on one computer and have it appear on the computer on the other end of the parallel cable. This is quite fun!


Here's what you will need to set this up:



These instructions were primarily tested on two Debian GNU/Linux systems with no networks besides the parallel-port network. The directions were also tested successfully on two Fedora systems and a combination of a Debian and a Fedora system as well. If you already have a network set up, talk to your administrator to find out if the IP addresses and host names ('one' and 'two') given in this guide need to be changed. If you just have an Internet connection, you should be fine because the IP addresses in this guide are in the 'private network' range.


Note that a few modifications to these directions will allow you to set up a cable connection between two network interface cards.


STEPS: SETTING UP A PARALLEL-PORT NETWORK UNDER LINUX

  1. Under the X Window System, get to a terminal/shell window, and type 'su'.

  2. After entering your root password, type 'cd /usr/local/sbin'.

  3. Create these scripts with any text editor. Highlight the stuff in monospace, point into your text editor, and press the middle button of your mouse. This can be your wheel button, a regular middle button, or both the left and right button pressed simultaneously. Now, for the IP addresses and scripts. Alternatively, you can download the scripts here: plipscripts.tar.gz

NETWORK: 192.168.0.0

NETMASK: 255.255.255.255

COMPUTER #1 (SERVER): 192.168.0.1

COMPUTER #2 (CLIENT): 192.168.0.2


Script name: plip1on

#! /bin/sh

if [ `whoami` != 'root' ]

then

echo $0': You must be root to execute this script.'

exit 1

fi

rmmod lp

modprobe plip

#route add -net 192.168.0.0 netmask 255.255.255.0 dev plip0

ifconfig plip0 one pointopoint two up

#route add two plip0

portmap

rpc.mountd

rpc.nfsd

plipconfig plip0 nibble 10000 trigger 5000


Script name: plip2on

#! /bin/sh

if [ `whoami` != 'root' ]

then

echo $0': You must be root to execute this script.'

exit 1

fi

rmmod lp

insmod plip

#route add -net 192.168.0.0 netmask 255.255.255.255 dev plip0

ifconfig plip0 two pointopoint one up

#route add one plip0

portmap

rpc.mountd

rpc.nfsd

plipconfig plip0 nibble 10000 trigger 5000


Script name: plipoff

#! /bin/sh

if [ `whoami` != 'root' ]

then

echo $0': You must be root to execute this script.'

exit 1

fi

umount /mnt/plip

ifconfig plip0 down

rmmod plip

insmod lp


  1. Copy these scripts to a floppy disk, USB flash drive, or other writable medium so you can copy them to the other computer. (The word 'media' is very often misused. Many people don't realize that 'media' is really the plural form of 'medium', so 'media' is often used as if it was singular.)

  2. To make sure they are executable, you need to set the 'execute' permission. Do a 'chmod a+x plip*' on both computers.

  1. We will now set up the directories that you wish to make accessible on the other computer. Still as root, type 'nano /etc/exports'. Then, use these lines as a guide to add your own lines. This example gives read & write permission to the /home directory:

# <directory> <machine and options>

/home two(rw)

  1. Type 'exportfs -r' to make the changes to '/etc/exports' to take effect immediately. You will have to do this after modifying that file. If you don't, the changes will not take effect until you reboot, which is the Windows way of doing things...

  2. Now, type 'nano /etc/hosts' and add these lines to the top of the file but after the first non-comment line:

192.168.0.1 one

192.168.0.2 two

  1. Type 'mkdir -m 777 /mnt/plip'.

  2. Repeat steps 6, 7, 8, and 9 for the other computer.

  3. For best performance, you should tell Linux what the IRQ of your parallel port is. If 'parport_pc' is compiled as a module (type 'modinfo parport_pc' to find out) and your distribution is Debian, type 'nano /etc/modutils/parport', type 'options parport_pc io=io_port irq=irq', replacing io_port with the I/O port address (usually 0x378, 0x3bc, or 0x278) and irq with the IRQ of the parallel port, save and exit, and run 'update-modules' followed by 'reboot'. If 'parport_pc' is compiled as a module and your distribution is not Debian, then do the same, but add 'options parport_pc io=io_port irq=irq' to /etc/modules.conf instead of a separate file, and then reboot. Do this on both computers. By default, Linux doesn't probe parallel port IRQ's. When in IRQ-less mode, the computers ask the parallel port so many times per second for input/output. When IRQ's are enabled, the parallel port is able to interrupt the operating system so the operating system doesn't have to keep checking the parallel port, thus yielding better performance. NOTE: You do NOT have to do this with Fedora and possibly other distributions.


Now that you have everything set up, here's what you need to do whenever you want to use the link:

  1. Plug the cable in. (duh!)

  2. Log in to a console session as root (hint: CTRL-ALT-F1).

  3. On the computer you want to use as the server, type 'plip1on'.

  4. On the computer you want to use as the client, type 'plip2on'.

  5. (Optional) From the server, type 'ping -c 10 two'. If you get an error message, then see the end of this guide for help.

  6. (Optional) From the client, type 'ping -c 10 one'. If you get error messages, then see the end of this guide for help.

  7. On the client, type 'mount one:directory /mnt/plip', substituting directory with one of the directories you marked as 'sharable' in /etc/exports on the server. For example, if you exported the

  8. Log out! Log in as a normal user! If you mounted the /home directory from the server and you have at least one normal user account with the same name common to both computers, you should have no problem transferring files between the two computers. Remember that the server's shared directory is mounted on '/mnt/plip'.

  9. When you're done, log in as root to a console session on both computers.

  10. On both computers, type 'plipoff'. Start with the CLIENT!


Do you want to try running programs over the cable? Go to the section after the 'Trouble?' section!


TROUBLE?


Here's how to do remote logins and how to use the remote access features of the X Window System. To demonstrate that these instructions work, I am sitting at my Pentium II desktop system using my parallel-port network to run OpenOffice.org on my laptop, which is at the other end of the cable; OpenOffice.org is being displayed on my desktop system while it is running on my laptop. I first allowed my laptop to access my desktop's X server. Then, I did a remote login from an xterm using SSH. After that, I started OpenOffice.org from the remote shell.


Doing a remote login (using one computer as a terminal to the other):

  1. Set up the link as described above. In this case, you do not have to mount the other computer's drive. It also doesn't matter which computer is 'one' and which computer is 'two'.

  2. At a command prompt as any user, type 'ssh one' if you are sitting at 'two' or 'ssh two' if you are sitting at 'one'. This will prompt you for your account password on the other computer if you have an identically-named account on the other computer. If not, use the '-l' option with 'ssh' to specify which account you want to log in to with 'ssh'. If you get a 'ssh: command not found' error, go to http://www.openssh.org and download OpenSSH. If you received an error message about not being allowed to connect, and you're running Debian on the remote computer, you need to type 'dpkg-reconfigure ssh' as root on the remote computer and tell it to start 'sshd'.

  3. If all went well, have fun! To quit the remote shell, type 'exit'.


Sharing your X session part 1: starting your programs on the computer on which it's going run:

  1. Start the network. As above, it doesn't matter which computer is 'one' and which is 'two'.

  2. Start up an X session on the computer on which you want the programs to display. You do not need X running on both computers, though it is fun to play with this when both are running X! You should be running this as a normal user!

  3. In a terminal window, such as the Konsole or an xterm, you will need to use 'xhost'. If you want to share your X display with anyone (NOT recommended for security reasons if you're connected to the Internet or another large network), type 'xhost +' ('xhost -' undoes this). If you want just the other computer to be able to connect, use 'xhost +one' if you're sitting at two or 'xhost +two' if you are sitting at one.

  4. From a command prompt as a normal user on the computer that is going to run the program, use this syntax: 'DISPLAY=name:0 command', replacing name with the name of the computer that is going to display the program and replacing command with the command you are going to run. For example, to run xterm on 'one' but to display it on 'two', type this on 'one': 'DISPLAY=two:0 xterm'.


Sharing your X session part 2: combining the remote login with sharing your X session (starting the program from the computer you wish to display it on, but the program is actually running on the other computer):

  1. As usual, start the network. After this step, you will be doing everything from the computer you wish to display everything on.

  2. In an xterm or the Konsole (or rxvt or any other terminal window), share your X session with the remote computer as described above using 'xhost'.

  3. In the same terminal window, do a remote login using 'ssh' as described above.

  4. In the remote shell, if you're using Bash (which is most likely the case), type 'export DISPLAY=name:0', replacing name with the name of the computer you're sitting at, which is either one or two.

  5. Type the command to run the program you want to run over the network. If you want to keep the terminal window free (for example, to run multiple programs from the same shell), you can put an & at the end of the command.


Note that programs that require the 'xvidmode' and/or the 'xshm' extensions will probably not work over the network!

1