old-www/LDP/LG/issue48/pollman.html

305 lines
13 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>DHCP for the Home Network LG #48</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<!-- *** BEGIN navbar *** -->
<A HREF="index.html"><IMG ALT="[ Table of Contents ]"
SRC="../gx/indexnew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom ></A>
<A HREF="../index.html"><IMG ALT="[ Front Page ]"
SRC="../gx/homenew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="lane.html"><IMG ALT="[ Prev ]" SRC="../gx/back2.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom></A>
<A HREF="../faq/index.html"><IMG ALT="[ Linux Gazette FAQ ]"
SRC="./../gx/dennis/faq.gif"WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="lg_backpage48.html"><IMG ALT="[ Next ]" SRC="../gx/fwd.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom ></A>
<!-- *** END navbar *** -->
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">DHCP for the Home Network</font></H1>
<H4>By <a href="mailto:jpollman@bigfoot.com">JC Pollman</a> and <a href="mailto:bill.mote@bigfoot.com">Bill Mote</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<p>Tired of lugging that laptop from the office to home only to find that
once you get there you have to boot your M$ operating system, change your
network settings to work with your home network, and then ... ah-hem REBOOT?!&nbsp;
I was!&nbsp; [Enter DHCP from stage left.]<font color="#000000">&nbsp;&nbsp;
If </font>your <font color="#000000">office and home environments are configured
correctly, DHCP is a</font>bout to be your new best friend!
<p><b>Disclaimer: </b>This article provides information we have gleamed
from reading the books, the HOWTOs, man pages, usenet news groups, and
countless hours banging on the keyboard. It is not meant to be an all inclusive
exhaustive study on the topic, but rather, a stepping stone from the novice
to the intermediate user.&nbsp; All the examples are taken directly from
our home networks so we know they work.
<p><b>How to use this guide:</b>
<ul>
<li>
Words encapsulated by square brackets like [Enter] indicate the depression
of a key on the keyboard or a mouse button [Mouse1]</li>
<li>
Words encapsulated by squiggly brackets like {your name here} indicate
data that will/should be substituted with "real" data</li>
<li>
Text depicted in italics are commands you, the user, should type at a prompt</li>
</ul>
<b>Prerequisites:</b> This guide assumes that you have at least DHCP 2.0
installed and that your local IP network is setup and functioning.
<p><b>DHCP@Home, why? </b>Convenience.&nbsp; I was fed up with changing
network configurations when I came home and then subsequently went back
to the office.&nbsp; It was completely unacceptable to add a bolt-on utility
to manage these settings for me.&nbsp; Then one day it hit me.&nbsp; We
use DHCP at work.&nbsp; Why shouldn't I use it at home!&nbsp; It'll give
me an IP address on the local network, the necessary DNS information, and
the correct gateway.
<p><b>DHCP@Work, why?</b>&nbsp; This one is a little easier to justify
than simply being inconvenienced.&nbsp; I worked at a facility with ~600
workstations.&nbsp; On the 1st day with the company I had to setup my own
machine and get it on the network.&nbsp; It took nearly 30-minutes for
an ill-equiped network administrator, I'll leave his name out of this article
since he's still providing network services for a local company, to find
an empty IP address that I could statically assign to my system.&nbsp;
He had paper print outs of 3-complete Class-C networks (192.168.[1-3].[1-254]).&nbsp;
It doesn't take higher math to figure out that there's over 750 addresses
available.&nbsp; 255 of which were on the network segment I was on.
<p>His process:
<blockquote>1. Find an open slot on the printed copy
<br>2. Verify it was open in his electronic copy
<br>3. Ping the address to verify no one was on it
<br>4. Give it to me, write it on the paper and enter it electronically</blockquote>
That was Friday.&nbsp; Monday morning I had an IP Conflict.&nbsp; Real
accurate system.&nbsp; All I knew about DHCP was that I had to select it
to get an IP address from my ISP at home.&nbsp; I had no idea how it worked
nor if we could use it to fix this `problem'.&nbsp; I joined forces with
a different network services group in the company, they educated me, and
we did a full frontal assault on every machine.&nbsp; DHCP is running to
this day ...
<p><b>IP Numbering Schemes:&nbsp; </b>If you've decided to run DHCP at
home then be smart about it.&nbsp; Figure out a numbering scheme and stick
with it.&nbsp; You'll know exactly what's on your network just by seeing
the IP address.&nbsp; This advice holds more weight in the corporate world
where you're likely to be hosting more machines.&nbsp; Anyway, this is
what I use at home and it closely resembles work as well:
<p><tt><u>IP Address Range&nbsp;&nbsp;&nbsp;&nbsp; Hosts</u></tt>
<p><tt><font color="#3333FF">* Important machines and network equipment
*</font></tt>
<p><tt>&nbsp;&nbsp;&nbsp; .001&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Your router (if present)</tt>
<br><tt>&nbsp;&nbsp;&nbsp; .002 - .009&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Network
equipment (switches and hubs)</tt>
<br><tt>&nbsp;&nbsp;&nbsp; .010 - .075&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Servers</tt>
<br><tt>&nbsp;&nbsp;&nbsp; .076 - .099&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Network
Printers</tt>
<p><tt><font color="#3333FF">* User workstations *</font></tt>
<p><tt>&nbsp;&nbsp;&nbsp; .100 - .254&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DHCP
range</tt>
<br>&nbsp;
<p>Sticking with a scheme like the one above will make visual scans of
your logs much easier since you'll likely notice an oddball IP address
doing something it's not supposed to or not capable of, i.e., a printer
trying to telnet into your machine?&nbsp; Not likely ... and a good indicator
that you didn't read last month's article on security!
<p><b>Are you ready?</b>&nbsp; Type the following command at a shell prompt:
<br>&nbsp;
<blockquote><i>whereis dhcpd[Enter]</i></blockquote>
You should see output similar to the following line.&nbsp; If not, then
you still need to install DHCP.&nbsp; Get to it and come back here:
<blockquote>dhcpd: /usr/sbin/dhcpd /etc/dhcpd.conf&nbsp; /etc/dhcpd.leases
/etc/dhcpd.leases~</blockquote>
<p><br><b>/etc/dhcpd.conf:</b> This is where we start.&nbsp; This file
is the key to it all and it's extremely simple in design.&nbsp; Here's
what mine looks like:
<br>&nbsp;
<center><table BORDER COLS=1 WIDTH="50%" BGCOLOR="#FFFFFF" NOSAVE >
<tr NOSAVE>
<td BGCOLOR="#3366FF" NOSAVE>
<h1>
<b><font color="#FFFFFF">/etc/dhcpd.conf</font></b></h1>
</td>
</tr>
<tr NOSAVE>
<td BGCOLOR="#3366FF" NOSAVE>September 18, 1999</td>
</tr>
<tr NOSAVE>
<td BGCOLOR="#3366FF" NOSAVE>Author: Bill Mote</td>
</tr>
<tr NOSAVE>
<td ROWSPAN="2" NOSAVE>default-lease-time 36000;
<br>max-lease-time 7200;
<br>option subnet-mask 255.255.255.0;
<br>option broadcast-address 192.168.1.255;
<br>option routers 192.168.1.10;
<br>option domain-name-servers 192.168.1.10;
<br>option domain-name "mynetwork.cxm";
<p>subnet 192.168.1.0 netmask 255.255.255.0 {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; range 192.168.1.100 192.168.1.254;
<br>}&nbsp;</td>
</tr>
</table></center>
<p><b>/etc/dhcpd.leases: </b>We now need to give the dhcp server somewhere
to start.&nbsp; We do so by creating an empty leases file.&nbsp; Type the
following command at a shell prompt:
<blockquote><i>touch /etc/dhcpd.leases[Enter]</i></blockquote>
Below is a `live' dhcpd.leases file from my system.&nbsp; Please note that
your file will be empty until a DHCP client successfully obtains an IP
address from your server.
<br>&nbsp;
<br>&nbsp;
<center><table BORDER COLS=1 WIDTH="50%" NOSAVE >
<tr NOSAVE>
<td BGCOLOR="#3366FF" NOSAVE>
<h1>
<font color="#FFFFFF">/etc/dhcpd.leases</font></h1>
</td>
</tr>
<tr NOSAVE>
<td BGCOLOR="#3366FF" NOSAVE>September 18, 1999</td>
</tr>
<tr NOSAVE>
<td BGCOLOR="#3366FF" NOSAVE>Author: {auto generated by dhcpd}</td>
</tr>
<tr NOSAVE>
<td BGCOLOR="#FFFFFF" NOSAVE>lease 192.168.1.100 {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; starts 6 1999/09/18 17:27:36;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ends 6 1999/09/18 17:37:36;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hardware ethernet 00:60:08:e3:60:03;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uid 01:00:60:08:e3:60:03;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client-hostname "NoFear";
<br>}</td>
</tr>
</table></center>
<p><b>Let's go already!&nbsp; </b>It's what you've been waiting for.&nbsp;
Time to startup the dhcp server and get a client running.&nbsp; Type the
following command at a shell prompt:
<blockquote><i>/usr/sbin/dhcpd[Enter]</i></blockquote>
That's it for the server side.&nbsp; Now onto client configuration.
<p><b>M$ client:&nbsp;</b> For the purposes of this article I'm going to
assume that you've got mostly M$ machines connected to a linux server.
<p>The Microsoft client is actually very easy to configure.&nbsp; Follow
these mouse clicks:
<br>&nbsp;
<blockquote><i>Start -> Settings -> Control Panel -> Network</i></blockquote>
Find the `TCP/IP protocol for your network adapter'.&nbsp; Highlight it
get to the properties window by pressing [Mouse1] on the `Properties' button.&nbsp;
Since pictures are better than words I'll use the following 3 pictures
to illustrate how your TCP/IP settings should be configured:
<br>&nbsp;
<br>&nbsp;
<br>
<br>
<center>
<p><img SRC="gx/pollman/ip_address.gif" HSPACE=3 VSPACE=3 height=441 width=356>
<br><img SRC="gx/pollman/gateway.gif" HSPACE=3 VSPACE=3 height=441 width=356>
<br><img SRC="gx/pollman/dns.gif" HSPACE=3 VSPACE=3 height=441 width=356></center>
<p><br>
<br>
<br>
<br>
<br>
<br>
<br>
<p>After a quick M$ reboot you should be golden!&nbsp; For more info on
DHCP see the <font color="#FF6666"><a href="http://www.linuxhq.com/HOWTO/mini/DHCP.html">DHCP-minihow-to</a></font>.&nbsp;
Notice in the opening sentence of this paragraph the word, "should".&nbsp;
Well, here's what I've found.
<br>&nbsp;
<blockquote>DHCP and Win98 SE (second edition) -- [Bill steps onto his
soap box] Nothing like a little competition to spark the boys in Redmond,
eh?&nbsp; The impression was the *everyone* was setting up Linux boxes
to share their internet connections at home.&nbsp; Microsoft responds in
short order with Internet Connection Sharing included in Win98 SE.&nbsp;
Quite frankly, I loved it.&nbsp; I used it to get our church computers
running from a single dial connection and it's working great.
<p>However, Win98 SE's ICS seems to be doing something a little off the
wall when it comes to DHCP.&nbsp; My Win98 SE machine at home assigns an
IP address to my NIC if it can't find a DHCP server.&nbsp; In the old days
Win9x would use it's last known IP address as long as the lease hadn't
expired ... not any more.
<p>If you have problems getting your Win98 SE box to get an IP address
then you may want to assign it a permanent address.&nbsp; What about the
numbering scheme you ask?&nbsp; You `could' set a small range aside at
the bottom or top of the range, but still above our default .100 (like
.100 - .105).
<p>If you still want the box to have an IP address assigned by DHCP then
you can do the following:
<blockquote>
<ul>
<li>
Give the Win98 SE box an IP address on your network.&nbsp; Don't worry
it'll just be temporary.</li>
<li>
Wait a couple of days (haven't narrowed the time down yet)</li>
<li>
Set the machine back to DHCP</li>
</ul>
</blockquote>
Ridiculous?&nbsp; Yes.&nbsp; I just haven't looked for a way to permanently
fix the problem.&nbsp; There's probably some undocumented Win9x registry
tweak ...&nbsp; If anyone knows send it to my e-mail address below please!</blockquote>
<br>Next month we will be discussing Linux Client Side DHCP.
<p><br>
</body>
</html>
<!-- *** BEGIN copyright *** -->
<P> <hr> <P>
<H5 ALIGN=center>
Copyright &copy; 1999, JC Pollman, Bill Mote<BR>
Published in Issue 48 of <i>Linux Gazette</i>, December 1999</H5>
<!-- *** END copyright *** -->
<!--startcut ==========================================================-->
<P> <HR> <P>
<!-- *** BEGIN navbar *** -->
<A HREF="index.html"><IMG ALT="[ Table of Contents ]"
SRC="../gx/indexnew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom ></A>
<A HREF="../index.html"><IMG ALT="[ Front Page ]"
SRC="../gx/homenew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="lane.html"><IMG ALT="[ Prev ]" SRC="../gx/back2.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom></A>
<A HREF="../faq/index.html"><IMG ALT="[ Linux Gazette FAQ ]"
SRC="./../gx/dennis/faq.gif"WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="lg_backpage48.html"><IMG ALT="[ Next ]" SRC="../gx/fwd.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom ></A>
<!-- *** END navbar *** -->
</BODY></HTML>
<!--endcut ============================================================-->