181 lines
10 KiB
HTML
181 lines
10 KiB
HTML
<!--startcut ==========================================================-->
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
|
<html>
|
|
<head>
|
|
<title>Expanding Your Home Network LG#39</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<meta name="GENERATOR" content="Mozilla/4.5 [en] (X11; I; Linux 2.2.3 i686) [Netscape]">
|
|
<meta name="AUTHOR" content="JC Pollman">
|
|
<meta name="CREATED" content="19990224;18325300">
|
|
<meta name="CHANGEDBY" content="JC Pollman">
|
|
<meta name="CHANGED" content="19990225;11132709">
|
|
<style>
|
|
<!--
|
|
-->
|
|
</style>
|
|
</head>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000">
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4>
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center>
|
|
<H1><font color="maroon">Expanding Your Home Network</font></H1>
|
|
<H4>By <a href="mailto:jpollman@imcnet.net">JC Pollman</a></H4>
|
|
</center>
|
|
<P> <HR> <P>
|
|
You have struggled and gotten your home network working. I assume you have
|
|
some sort of dial on demand, printer serving, and probably file sharing
|
|
using samba. After a couple of weeks of relaxing and self-congratulating,
|
|
you ask yourself: now what?
|
|
<p> What follows are bits and pieces of useful improvements I have
|
|
come across while running my own home network. All of them provide me with
|
|
added features and greatly extended my knowledge of Linux. Although I use
|
|
the Redhat distribution, they should work on all distributions. What
|
|
I present here are quick set-ups, to truely understand what you are doing
|
|
you have to read the How-Tos and files that come with the programs.
|
|
<p><b>Am I Connected?</b> You know by now that, just because the modem
|
|
dialed, you are not guaranteed of getting connected. And it would also
|
|
be nice to know when the modem goes off line - especially if you
|
|
are using an internal modem and your server is without a monitor like mine.
|
|
Linux obviously knows when these things happen as it executes commands
|
|
when the on-line-status changes. You can take advantage of this by putting
|
|
your own commands in the scripts it runs. When the modem connects AND you
|
|
are logged into your ISP, Linux runs the /etc/ppp/ip-up script, and when
|
|
the modem goes off line, it runs the /etc/ppp/ip-down script. All you have
|
|
to do is to add a line at the end of these scripts to tell you what happened.
|
|
I use sound files to announce the connect status. One of the last lines
|
|
of my ip-up is:
|
|
<p>cat /etc/ppp/doom.au >/dev/audio &
|
|
<p>This "plays" the doom.au file and lets me know that I am fully connected
|
|
to the internet. Add a similar line to your ip-down file to tell you when
|
|
the modem goes off line.
|
|
<p><b>TIME. </b>You can also use the ip-up file to keep your server's time
|
|
accurate. There are several time programs you can use, but I find netdate
|
|
the easiest. I just add these lines after my sound line:
|
|
<p>/usr/sbin/netdate isp-computer
|
|
<div STYLE="margin-bottom: 0.00cm">clock -w
|
|
<p>where isp-computer is the name of a computer at my ISP, and clock -w
|
|
writes the time to the cmos.
|
|
<p><b>Cleaning Up after pulling the plug</b>. My wife is famous for finding
|
|
something on the net and then wanting to make an immediate phone call.
|
|
This usually means she pull the modem's phone wire out of the jack and
|
|
then makes her call. This is nothing tragic, but I ended up with lots of
|
|
ip-down scripts that never finish executing. Typing ps ax on Saturday usually
|
|
gave me a half dozen processes to kill. I got tired of this and wrote a
|
|
script to clean them up automatically:
|
|
<p>#!/bin/sh kill `ps ax|grep down|cut -c 1-5`
|
|
<p> I set this up as a cron job, so it runs every night.
|
|
<p><b>One Home for All.</b> You probably have Linux running on more than
|
|
one of your client programs. Keeping your personal setup in sync between
|
|
computers becomes a pain after a while. Additionally, it would be nice
|
|
when you run your email program to have all your folders available, and
|
|
have your bookmarks available when you startup Netscape. The solution is
|
|
to have use the /home directory on the server as the /home directory on
|
|
all the computers. To do this, make sure all the kernels have nfs compiled
|
|
into them, export the /home directory on the server, and then mount the
|
|
server's /home directory on the clients. The server uses the file: /etc/exports
|
|
to decide what, and how, to allow other computers to use. The appropriate
|
|
line from my exports file is:
|
|
<p>/home *.kulai.org(rw)
|
|
<p>where my network is kulai.org. Then you can mount the server's
|
|
/home directory by putting a line in your fstab that looks like this:
|
|
<p>192.168.124.10:/home /home nfs noauto,rw,rsize=8192,wsize=8192
|
|
0 0
|
|
<p>Note: my home server's ip address is: 192.168.124.10 Yours will be different.
|
|
Then mounting the /home directory with a line in your rc.local like this:
|
|
<p>mount /home
|
|
<p>This is a fairly simple process, but there are some gotchas you need
|
|
to be aware of. NFS does not have a solid reputation for reliability and
|
|
security. Some versions of the kernel do not work well with NFS, so check
|
|
the news groups and dejanews if everything looks good but you can not mount
|
|
/home. Also, the users on the different computers must all have the same
|
|
UID and, I think GID, on each computer. For example, if Fred is UID 500
|
|
on the server, he must be UID 500 on all the other computers - as stated
|
|
in the /etc/passwd file. There are ways around this, but life is much easier
|
|
if the UIDs match. Additionally, mounting the entire /home directory is
|
|
probably not the best solution when what you really want is just /home/user.
|
|
You can get around this in xdm by using the Xstartup and Xreset files to
|
|
mount and unmount the user's home directory when they login and logout.
|
|
This method has problems with KDE as KDE does not shut down fast enough
|
|
and so Xreset will not unmount the directory.
|
|
<p>A more elegant solution is to use automount. It will automatically mount
|
|
/home/user directories, and can also automount your floppies and
|
|
cdroms. First, recompile your kernel with automount turned on. Then install
|
|
the autofs program. Then create the file: /etc/auto.master. It needs
|
|
only one line:
|
|
<p>/home /etc/auto.home --timeout 120
|
|
<p>which says: use /home as the mount point, and the file:/etc/auto.home
|
|
to define the subdirectories. The timeout option is for automatic
|
|
unmounting after 120 seconds of inactivity. If you want to use this to
|
|
automount floppies, cdroms, etc, you will need another line - read the
|
|
Howto and Install files.
|
|
<p>Then create the /etc/auto.home file. A line from mine reads:
|
|
<p>nick -rw,soft,intr,rsize=8192,wsize=8192
|
|
192.168.124.10:/home/nick
|
|
<p>The first entry: nick , is the subdirectory under /home that autofs
|
|
will use to mount the nfs directory: 192.168.124.10:/home/nick.
|
|
Note, the server must now export each user's home directory individually,
|
|
e.g. the exports file now reads:
|
|
<p>/home/nick *.kulai.org(rw)
|
|
<p>Another advantage of this setup for the adventurous: I run several un*xes
|
|
at home. If I run the same version of the programs in them that I
|
|
run in Linux, by mounting my home directory I keep the same initialization
|
|
files, e.g. I use icewm for my window manager in Linux and FreeBSD, because
|
|
I mount the same /home directory for both OSes, my menus stay the same.
|
|
<p><b>Common Passwords.</b> As computers, and especially hard drives, come
|
|
and go, I find that keeping the passwords in sync is also an annoying task.
|
|
Linux provides a simple solution: NIS. Basically, the server does the login,
|
|
so, no matter which computer you are using, the login verification is run
|
|
against a single file on your server. This will only keep the un*x passwords
|
|
the same: I manually made the MS Windows passwords the same, so when my
|
|
spouse, or kids, get on the computer, they type the same user name and
|
|
password no matter whether they are running Windows or Linux. You
|
|
will have to read the NIS Howto as it is beyond the scope of this article
|
|
to explain how to set it up.
|
|
<p><b>HTTP Proxy</b>. If your family members go to many of the same web
|
|
pages you can speed up the "download" time by caching the pages on your
|
|
server. That way, if your spouse goes to www.Yahoo.com in the afternoon,
|
|
and your kids go to it when they get home from school, they get the copy
|
|
off of the server which is much faster than actually connecting to the
|
|
site. This pays big benefits when several of you are on the internet at
|
|
the same time. You can setup Apache to do this if you have Apache
|
|
running already, or check http://freshmeat.net for a http proxy program.
|
|
<p><b>USENET News</b>. I assume that anyone reading this article
|
|
is also a big user of the usenet news groups. Setting up a full fledged
|
|
news server for home is just too much work, but a program named leafnode
|
|
may be just the solultion. After setting it up and allowing it to
|
|
get the list of news groups from your current server, point your news reader
|
|
(Linux, Windows, or in any other operating system) to your server.
|
|
Subscribe to the groups you want and then rerun leafnode. It will only
|
|
get the articles from the groups people on your network subscribed to.
|
|
I set it to run, via cron, at 4 in the morning so at 5, when I arrive with
|
|
my cup of coffee, all the articles for all my groups are ready and waiting
|
|
for me on my server. Sweet!</div>
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<center><H5>Copyright © 1999, JC Pollman <BR>
|
|
Published in Issue 39 of <i>Linux Gazette</i>, March 1999</H5></center>
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
|
|
ALT="[ TABLE OF CONTENTS ]"></A>
|
|
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
|
|
ALT="[ FRONT PAGE ]"></A>
|
|
<A HREF="./marsden.html"><IMG SRC="../gx/back2.gif"
|
|
ALT=" Back "></A>
|
|
<A HREF="./woods.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
|
|
<P> <hr> <P>
|
|
<!--startcut ==========================================================-->
|
|
</BODY>
|
|
</HTML>
|
|
<!--endcut ============================================================-->
|