Quickly Setting Up PLIP and NFS

Need to transfer files between your desktop and your laptop? Here's the easy way to do it by networking.
Network Setup

You have to be root to edit the files. On both computers, in /etc/rc.d/rc.modules, comment out the line enabling printer support. (To comment out a statement in the file, just put the # character at the beginning of the line.) For example:

#/sbin/modprobe lp

Check that PLIP support is also commented out.

#/sbin/modprobe plip
I will load/unload the modules as needed from script files. Choose names for the two computers; I will call the desktop computer “zeus”, and the notebook “hermes”. (Hermes was the god of travel and business in Ancient Greece, and Zeus was his “boss”, being the god of the sky and master of all gods.) On both zeus and hermes, edit the file /etc/hosts and add the following two lines:
192.168.93.1     zeus
192.168.93.2     hermes
The addresses 192.168.93.xxx are safe to use; they will not conflict with existing addresses unless you already have a local network using these addresses. These IP addresses follow the convention for IP addressing: they are used only for local networks. (See NET-2-HOWTO and RFC1597 for more information.) You could skip this step and use the numeric addresses, but it is easier to remember zeus and hermes.

Scripts

On zeus, create the following script, /usr/sbin/plip-on.sh:

#!/bin/sh
/sbin/modprobe -r lp
/sbin/modprobe plip
/sbin/ifconfig plip1 zeus pointopoint hermes up
/sbin/route add hermes dev plip1

The modprobe commands unload module lp (printer module) and load the plip module. (Actually, PLIP works on my system with lp loaded, but the available documentation says it won't work; feel free to experiment.) ifconfig is then run to set up the network interface plip1. route tells the computer how to find its way to the network; here, host hermes is located through the network interface plip1. Next, create the following script, /usr/sbin/plip-off.sh:

#!/bin/sh
/sbin/route del hermes
/sbin/ifconfig plip1 down
/sbin/modprobe -r plip
/sbin/modprobe lp
Similarly, on hermes, write the following script, /usr/sbin/plip-on.sh:
#!/bin/sh
/sbin/modprobe -r lp
/sbin/modprobe plip
/sbin/ifconfig plip1 hermes pointopoint zeus up
/sbin/route add zeus dev plip1
/sbin/route add default gw zeus dev plip1
The main difference between the plip-on.sh file on zeus is that I have swapped zeus and hermes throughout. I have also added a default route, that is, when a connection (other than to zeus) is requested to the network, I use plip1 by default. I need this default to connect hermes to the Internet through zeus using masquerading as discussed at the end of this article; for PLIP and NFS, it is not needed. Now write the following script, /usr/sbin/plip-off.sh:
#!/bin/sh
/sbin/route del default
/sbin/route del zeus
/sbin/ifconfig plip1 down
/sbin/modprobe -r plip
/sbin/modprobe lp
Remember to change permissions (chmod +x plip-*.sh) on both computers to make the scripts executable. Now, you can plug in your cable and issue this command (as root):
# /usr/sbin/plip-on
on both zeus and hermes. (It does not matter on which you issue it first.) You should now have full connectivity between zeus and hermes. From hermes type:
hermes:~> telnet zeus
and log in to zeus. Congratulations. You have just set up your own private local network.

Running the Scripts as root

Working as root to run the scripts is not only annoying, it is also potentially dangerous. You could easily damage your Linux system by mistakenly removing files thus losing precious hours of sometimes difficult and tedious customization. That's why you should use the technique described in “Safely Running Programs as Root” by Phil Hughes, Linux Journal May 1997, and create executables named plip-on and plip-off with suid root to allow any user to start and stop the connection. All the executables do is run the scripts assuming root identity regardless of which user runs them. Example source code is available at ftp://sunsite.unc.edu/pub/Linux/docs/linux-journal/listings/issue37 in the file 2114.tgz.

Transferring Files

I now have a full network connection between zeus and hermes, so all the network software will work (TELNET, FTP, rlogin, etc.). Try to exchange files between the two computers using ftp. (The FTP server is turned on by default in Slackware; check the /etc/inetd.conf file and the man pages for inetd(8), ftpd(8).) Quicker even than ftp, you can use rcp (remote copy; see the man pages rcp(1), rlogin(1), rsh(1)). The transfer rate that I get on my systems is about 25KB per second using FTP.

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState