[The Linux Documentation Project Homepage]

Next Previous Table of Contents

3. Software

To connect the two computers you have to set up some files describing the properties of your computers. Some of them may be the same on both, some are different.

3.1 Launch the ppp deamon

/etc/hosts (laptop and desktop)

The TCP/IP protocoll uses numbers to adress computers in a network. It is possible to assign names to those numbers by adding these to a special file. Be careful with ip numbers: only use numbers beginning with 192.168.x.x which are reserved for private networks.

  ------- start of file -------

  #
  # hosts       This file describes a number of hostname-to-address
  #             mappings for the TCP/IP subsystem.  It is mostly
  #             used at boot time, when no name servers are running.
  #             On small systems, this file can be used instead of a
  #             "named" name server.  Just add the names, addresses
  #             and any aliases to this file...
  #
  
  127.0.0.1     localhost
  192.168.0.1    desk.home       desk
  192.168.0.2    lap.home        lap

  -------- end of file --------

/usr/local/bin/interlink (laptop and desktop)

The following script will start and stop the ppp protocoll on ttyS0. Adopt it to your requirements:

BAUD

contains the baudrate to use. On computers with a serial chip with a fifo you can have full speed at 115200. Older systems like might not be able to really run faster than 38400 average, especially with hard disk writing/reading at the same time or a too slow cpu.

DEV

repesents the serial connector you want to use. COM1 on a PC equals ttyS0, ttyS1 means COM2. Also possible is the symbolic name modem.

HANDSH

defines the type of handshaking. Use xonxoff for software flow control with the simple cable. Replace with crtscts for hardware flow control if you have the according cable.

LOCAL / REMOTE

names of the pair of computers to be connected.

  ------- start of file -------
  
  # script to launch the pppd on the rs232 cable 
  
  BAUD=57600
  DEV=ttyS0
  HANDSH=xonxoff
  LOCAL=lap              # customize those two lines !
  REMOTE=desk            #=============================
  
  case "$1" in
    start)
     echo "starting interlink ($BAUD baud)"   
     /usr/sbin/pppd -detach $HANDSH lock $LOCAL:$REMOTE /dev/$DEV $BAUD &
     ;;
    stop)
     echo "shutting down interlink"
     test -f /var/lock/LCK..$DEV && kill `cat /var/lock/LCK..$DEV`
     ;;
    *)
     echo "Usage: $0  {start|stop}"
     exit 1
  esac
  exit 0
  
  -------- end of file --------

3.2 Using the desktop's printer

This section assumes a BSD-like printing system.

/etc/printcap (laptop)

The entry in printcap is very simple, because the files are just transfered to the desktop. It is assumed of course that the printer on the desktop is correctly working.

  ------- start of file -------

  #/
  # Copyright (c) 1983 Regents of the University of California.
  # All rights reserved.
  #
  # Redistribution and use in source and binary forms are permitted
  # provided that this notice is preserved and that due credit is given
  # to the University of California at Berkeley. The name of the University
  # may not be used to endorse or promote products derived from this
  # software without specific prior written permission. This software
  # is provided ``as is'' without express or implied warranty.
  #
  #     @(#)etc.printcap        5.2 (Berkeley) 5/5/88
  #
  # typical remote printer entry
  
  lp:rm=desk.home:sd=/var/spool/lpd:lf=/tmp:mx#0:
  
  lp1:rm=desk.home:sd=/var/spool/lpd/lp1:mx#0:

  -------- end of file --------

/etc/hosts.lpd (desktop)

Only hosts listed in hosts.lpd are allowed remote printing.

  ------- start of file -------
  
  #
  # hosts.lpd     This file describes the names of the hosts which are
  #               to be considered "equivalent", i.e. which are to be
  #               trusted enought for allowing rsh(1) commands.
  #
  # hostname
  
  desk.home
  lap.home 
  
  -------- end of file --------

3.3 Mounting the desktop's filesystems

/etc/fstab (laptop)

To mount filesystems from the desktop with user priviliges, you have to include them to fstab with the user option.

/

Access to all mounted partitions on the desktop.

/cdrom

To install additional programs from my distribution cd.

/a

The floppy on my thinkpad does not work under linux, so the desktop is the only possibility.

/z

Here I mount my external zip drive. I also could connect it directly to the laptop, but for that I have to crawl behind the computer table.

  ------- start of file -------
  
    desk:/          /desk          nfs   defaults,noauto,user    0   0
    desk:/cdrom     /cdrom.d       nfs   ro,noauto,user          0   0
    desk:/a         /a.d           nfs   defaults,noauto,user    0   0
    desk:/z         /z.d           nfs   defaults,noauto,user    0   0
    desk:/usr/data /usr/data.d     nfs   defaults,noauto,user    0   0
  
  -------- end of file --------

/etc/exports (desktop)

exports lists all hosts that are allowed to mount local filesystems and their according permissions. I added no_root_squash to have root priviliges on the laptop while I work with desktop files.

  ------- start of file -------
  
  # See exports(5) for a description.
  # This file contains a list of all directories exported to other computers.
  # It is used by rpc.nfsd and rpc.mountd.
  /cdrom                  lap(ro,no_root_squash)
  /usr/data               lap(rw,no_root_squash)
  /mnt/hdb7               lap(rw,no_root_squash)
  /                       lap(rw,no_root_squash)
  /a                      lap(rw,no_root_squash) 
  /z                      lap(rw,no_root_squash)
  /zv                     lap(rw,no_root_squash)
  
  -------- end of file --------

3.4 Offline browsing with wwwoffle

WWWOFFLE is an internet browser caching program. I gave it 100MB of disk space, what allows me to browse offline all internet files I visited the last months.

Your browser must then be configured to use desk.home as proxy (on port 8080 if you did not change).

/usr/local/bin/internet-on (desktop)

This is my short script to tell wwwoffle we're online now. Not really necessary, but useful to understand the following file ip-up.

  ------- start of file -------
  
  wwwoffle -online
  wwwoffle -fetch
  
  -------- end of file --------

/etc/ppp/ip-up (desktop)

Script automatically launched by pppd after connecting. If talking to the laptop, nothing happens. If connected to my provider via modem it puts wwwoffle online.

  ------- start of file -------
  
  #!/bin/sh
  
  if $5 != "192.1.2.32"; then
    echo 'Welcome to the internet'
    internet-on
  else
    echo 'connected to laptop'
  fi
  
  -------- end of file --------

wwwoffle/wwwoffle.conf (desktop)

Add the following line to wwwoffle.conf in the AllowedConnect section to give the laptop access to the cache:

  ------- start of snippet -------
  
   lap.home
  
  -------- end of snippet --------

Next Previous Table of Contents