This is only a preview of the September 1999 issue of Silicon Chip. You can view 34 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Autonomouse The Robot":
Items relevant to "Voice Direct Speech Recognition Module":
Items relevant to "Digital Electrolytic Capacitance Meter":
Items relevant to "An XYZ Table With Stepper Motor Control; Pt.5":
Purchase a printed copy of this issue for $10.00. |
Computer Networking with TCP/IP
Automatic addressing
on TCP/IP networks
Manually assigning IP addresses to individual
computers on a network can quickly become a
hassle. The answer is to use DHCP and WINS
servers, so that IP addresses are handed out
automatically each time a machine boots up.
By GREG SWAIN & BOB DYBALL
Non-routable networking protocols
such as NetBeui are fine for small
networks, where you only have a few
PCs hooked up to one or more hubs
and no routers are involved. In fact,
NetBeui is one of the most effective
protocols for up to about 20 people. It’s
fast and easy to configure because you
only have to provide each computer
with a name – no network or logical
addresses are required.
However, it’s not uncommon for
a network to be segmented using
switch
es and routers. This can be
done for any number of reasons but
usually it’s done to filter unnecessary
network traffic from certain sections,
to increase network performance.
Bridges and routers are also often used
to couple large networks in adjacent
buildings together.
And that’s where you run into
Fig.1(a): here’s how to manually set up an IP address under Windows 98. Each
computer on the network must be given a unique IP address, while the Subnet
Mask should be the same for all machines.
4 Silicon Chip
problems with NetBeui. Because it’s
non-routable, network segments on
either side of a router will not be able
to “talk” to each other. To overcome
this problem, a routable protocol such
as TCP/IP must be used.
Although it might initially appear
rather mysterious, TCP/IP isn’t all that
hard to get going – at least, in basic
form. The first step is to install the
TCP/IP protocol (if it hasn’t already
been installed) and you do that via
the Network utility in Control Panel.
The procedure is as follows: load the
utility, click the Add button, select
Protocol, click Add again, select
Microsoft, select TCP/IP and click
OK – see Fig.1
You can now set up the IP address
for the computer by selecting the TCP/
IP protocol (for the network card, not
for a dial-up adapter) and clicking
Fig.1(b): this screen grab shows
how to manually enter IP addresses
under Windows NT. The “Default
Gateway” is the router address if it
exists (otherwise leave it blank).
the Properties button. Note that the
IP address set here is “bound” to the
network card and is non-routable as
far as the Internet is concerned.
Basically, there are three groups of
IP numbers to choose from for private
LANs. These address blocks are as
follows:
10.0.0.0 to 10.255.255.255
172.16.0.0 to 172.31.255.255
192.168.0.0 to 192.168.255.255
When you manually assign IP addresses, each machine must be given
a unique address but the Subnet Mask
must be the same if you want the
machines to “see” each other on the
network. For most networks, a Subnet
Mask of 255.255.255.0 will do just fine
but note that, if you use this, all your
IP addresses must use the same first
three groups of numbers; ie, only the
last number can be varied.
Note also that it’s not usual to end
an IP address in 0 or 255. So, for
example, if you use a Subnet Mask
of 255.255.255.0, you could use IP
addresses ranging from 192.168.1.1
to 192.168.1.254.
Each machine must also be given a
unique NetBios name (or Computer
name), as shown in Fig.2. The Work
group name should be the same for all
machines on the network..
Don’t forget to set up file and printer
sharing on each machine, so that you
can access the desired resources.
The LMHOSTS file
PCs on a network running TCP/IP
need some mechanism to link the IP
address of each machine to its NetBios name. This is known as “name
resolution” and is necessary to allow
computers on the network to communicate with each other.
The reason for this is that users
generally attempt to communicate
with another computer by selecting
its NetBios name. However, before
communication can take place, the
NetBios name must first be translated
into that computer’s IP address.
Two common methods for achieving
this are “broadcast name resolution”
and using an lmhosts file. The first
method involves broadcasting a
query over the network and asking a
named computer to respond with its
IP address. This is quite satisfactory
if there are only a few machines on
the network but generates a lot of
unnecessary traffic on larger networks.
An lmhosts file eliminates the need
Fig.2: each machine on the network
must be given a unique name, while
the Workgroup name must be the
same if you want the machines on a
LAN segment to “see” each other.
Fig.3: Example lmhosts File
# IP Address Computer name
#
192.168.1.1 lister
192.168.1.20 rimmer
192.168.1.40 starbug
192.168.1.80 holly
and don’t do anything.
In practice, all you have to do is create the lmhosts file using a text editor
and copy it to all the machines on the
network. On Windows 9x systems,
this file must be placed in the c:\
windows folder (assuming that that’s
where Windows is installed), while in
Windows NT the file must be in c:\
winnt\system32\drivers\etc.
If you are using Windows 95/98 you
must also select the “Enable DNS”
option in the TCP/IP properties dialog box (see Fig.4) and enter in a host
name (this is usually the same as the
computer name). If you don’t do this,
the system will automatically resort
to broadcast name resolution.
Similarly, for Windows NT, you
have to select “Enable Lmhosts Lookup”. This is done at the WINS Address
tab in the TCP/IP Properties dialog
box – see Fig.5.
Note that each machine on the network must have the same lmhosts file,
otherwise you will run into problems.
IP addressing with DHCP
for these query broadcasts. This is a
simple text file that lists the IP address
of each machine on the network and
its corresponding NetBios name.
Fig.3 shows a sample lmhosts file.
Its format is fairly straightforward. The
lines starting with “#” are comments
Manually assigning IP addresses
and maintaining an lmhosts file is
fine if you only have a few computers on the network. However, it soon
becomes unwieldy if the network is
constantly changing or if you have
more than about 15 computers to
administer. Each time a machine is
added to the network, for example,
the lmhosts file must be altered and
copied to each existing machine.
As you can imagine, it’s all too easy
to assign a new machine with a dupli-
Fig.4: if lmhosts is used, you must
also select the “Enable DNS” option in
the TCP/IP properties dialog box of a
Windows 95/98 client computer,
Fig.5: a Windows NT client computer
must have “Enable Lmhosts Lookup”
selected if you wish to use lmhosts for
name resolution.
September 1999 5
Fig.6(a): setting up
the Scope Properties
for a DHCP server.
In this example, the
server can hand
out IP addresses to
client computers
anywhere in the range
from 192.168.1.10 to
192.168.1.200. The
lease period is set
to one day.
cate IP address or to neglect updating
the lmhosts file on some machines. In
either case, the network will no longer
work correctly. Often too, users want
to take a laptop computer from one
location to another and plug it into
the network but this won’t work with
static IP addresses if the lmhosts files
and/or subnet masks are different.
The solution is to use DHCP, or the
Dynamic Host Configuration Protocol.
This service, which runs on Windows
NT Server, is one of the most convenient ways of handing out IP addresses.
It initially requires more work because
we have to set up a DHCP server but
after that, it’s all plain sailing.
When you set up the DHCP service,
it’s given a range of IP address that can
be handed out to client computers.
The client computers then request an
IP address each time they boot and
this is automatically allocated by the
DHCP server. Because the server keeps
a record of which IP addresses have
been allocated to clients, there is no
chance of duplication.
When a client computer subsequently shuts down, its IP address is
returned to the pool of numbers back
at the DHCP server for later reuse.
This means that there’s no guarantee
you’ll be given the same IP address
each time your machine boots up but
at least you will be the only one with
the IP address that is assigned.
This scheme has several other
advantages. First, you don’t have to
manually set a static IP address for
each machine on the network. Second, you don’t have to maintain the
lmhosts files across the network. And
third, it makes it very easy to move a
computer from one part of a network
to another since it will ask for and be
automatically assigned an IP address
when it boots.
OK, so that’s it in a nutshell. In
practice, it’s a bit more complicated
than that (it always is).
Each time, the DHCP server issues
an IP address, it does so for a set
“lease” period. This lease period is
configured at the server and can last
for anything up to several days. During
the lease period, the client computer
contacts the DHCP server and requests that the lease be extended. If
everything is OK, the server then renews the lease on the same IP address
and restarts the clock.
So what happens if the client computer is shut down and then rebooted
during the lease period? In that case,
the client remembers that the previous
lease hadn’t expired and so it asks for
the same IP address again. Because an
IP address is reserved for a particular
client for the duration of the lease,
the DHCP server complies with the
request and re-issues the address with
the lease starting over again.
If the lease expires, a new IP address
is issued to the client the next time it
boots up. Similarly, if the DHCP server
is reconfigured during the lease, the
client’s request for an extension will
be rejected and a new address will
be issued.
Setting up a DHCP server
We won’t go into all the details
of setting up a DHCP server here,
although the procedure is fairly
straightforward for a simple network.
Basically, you need Windows NT
Server or a Linux server to set up the
service. This server must be given a
static IP address (eg, 192.168.1.1).
If you don’t have either of these
operating systems, there are several
shareware programs that let you set up
a Windows 95/98 system as a DHCP
server – see panel.
In Windows NT Server, you install
DHCP by first loading the Network
utility in Control Panel, then clicking
the Services tab, clicking the Add
button and selecting “Microsoft DHCP
Server” from the list and clicking OK.
Fig.6(b): the DHCP Options dialog boxes let you specify the IP addresses of any other devices on the network, such as
routers, WINS servers and DNS servers. In this example, we’ve added a router and specified its IP address as 192.168.1.2.
6 Silicon Chip
Fig.7: a Windows 98 system is set up
as a DHCP client as shown here. By
selecting the option shown, the client
will obtain a unique IP address from
the DHCP server each time it boots.
The installation routine creates a new
shortcut labelled “DHCP Manager” in
the Administrative Tools folder of the
Start menu.
Once the DHCP service has been
installed, you then specify the Scope
Properties. This sets the range of IP
addresses that the server can hand
out to clients for a particular subnet.
Fig.6(a) shows the Scope Properties
dialog box from the DHCP Manager on
Windows NT Server system. In this
case, the range of IP addresses that
can be passed out to client computers starts at 192.168.1.10 and ends at
192.168.1.200. The lease duration has
been set to one day.
Other dialog boxes let you specify
the IP addresses of other devices on
the network, such as routers or WINS
or DNS servers – see Fig6(b).
By the way, if network reliability is
critical, you need to install more than
one DHCP server so that the network
will still function if a server fails. In
that case, you configure each server
with a segment of the range of allowable IP addresses. These segments must
not overlap, otherwise the system
could issue the same IP address to
more than one computer.
DHCP client configuration
Unlike the server side of things,
Windows 95/98 and Windows NT
Workstation computers can all be set
up as DHCP clients without the need
for additional software. Once set up,
they will request an IP address from a
Fig.8: configuring a DHCP client on a Windows NT system. The gateway address
corresponds to a router (if it exists).
DHCP server each time they boot. Fig.7
shows how a Windows 98 system is
configured, while Fig.8 shows the settings for a Windows NT DHCP client.
You get to the Windows 95/98
TCP/IP Properties dialog box by first
double-clicking the Network icon in
Control Panel, then double-clicking
the TCP/IP entry for the network card.
Make sure that the “Obtain an IP address automatically” option is selected
if you want the machine to request IP
addresses from the DHCP server.
A Windows NT system is set up in
similar fashion.
Windows Internet Name Service (WINS)
Often used in conjunction with
DHCP, WINS is a dynamic database
that’s used to translate NetBios names
into IP addresses.
Without WINS, name resolution
takes place either by: (1) broadcasting
a query over the network and asking
a named computer to respond with
its IP address; or (2) checking a local
lmhosts file (if one is present). As
mentioned previously, the first meth
od can create a lot of unnecessary
traffic and in any case, is limited to
a local network segment. The second
has all the administrative problems
discussed previously.
As with DHCP, WINS is provided with Windows NT Server. After
set-up, client computers contact the
WINS server each time they boot and
register their name and allocated IP
address. This means that a WINS serv-
Getting It Together: The Software Required
Windows NT Server will allow you to run any or all of these services; ie,
DHCP, WINS and DNS. If you don’t have NT Server, consider Linux as an
alternative, as you can run DHCP and DNS with the standard Linux or use
WINS under Samba server.
Linux is not yet for the faint-hearted, though. Be prepared for a steep
learning curve and lots of manual text-mode configuration files.
Windows 95/98 users should check out some of the shareware sites on
the Internet for suitable software. These sites include www.download.com,
www.winfiles.com and www.tucows.com
One popular product is WinGate, which runs under Windows 95/98/NT
and provides DHCP and DNS server capability. WinGate can also function
as a firewall and as a proxy server, to allow multiple users on a network to
connect to the Internet via a single modem. To find out more about WinGate,
point your web browser to www.jantek.com.au
September 1999 7
must select “Enable WINS Resolution”
and manually enter the IP address(es)
of the WINS server(s) on each client
computer. Fig.10 shows how to do
this. As with DHCP, it pays to have a
more than one WINS server to ensure
network reliability.
Domain Name Server (DNS)
Fig.9: here’s how to set up the WINS configuration on a Windows 95/98 client
computer if you have a DHCP server.
er automatically updates its database
whenever computers are added to or
removed from the network. When a
client computer needs to resolve a
NetBios name, it contacts the WINS
server, which then hands out the IP
address for that name.
In effect, WINS is the dynamic
equivalent of an lmhosts file. Because
a client computer always attempts
to contact a WINS server first for
name resolution, the need for query
broadcasts or lmhosts file checking is
eliminated.
Setting up WINS
WINS is installed on an NT Server
machine in exactly the same way as
DHCP. After that, it’s a matter of config
uring each of the client computers to
use WINS for name resolution.
If you’re also using DHCP, this can
be used to supply the primary (and
secondary, if it exists) WINS server
address to client computers that ask
the DHCP server for an IP address.
This saves you from having to type in
the WINS server address(es) on each
of the client computers.
Fig.9 shows how to set up the WINS
Configuration on a Windows 98 client
Fig.10: if you don’t have a DHCP
server, you will have to enter the IP
address(es) of the WINS server(s) on
each client computer, as shown here.
computer if you have a DHCP server.
It’s just a matter of selecting the “Use
DHCP for WINS Resolution” option.
Of course, you must also use the DHCP
Manager to supply IP addresses to the
WINS servers and to hand these out
to the clients.
If you don’t have DHCP, then you
Fig.11: Example hosts File For Windows 98/NT
127.0.0.1
192.168.1.1
192.168.1.20
192.168.1.40
192.168.1.80
8 Silicon Chip
localhost
lister.reddwarf.home
rimmer.reddwarf.home
starbug.reddwarf.home
holly.reddwarf.home
Oh, no! – not another naming system! Well, yes but this one’s somewhat different from WINS because
it allows your system to look up,
or “resolve”, a domain name (eg, www.
microsoft.com) and translate this to an
IP address. Currently, this would give
you 207.46.130.14 as the IP address
for Microsoft’s web site.
In practice, this means that a web
site on the Internet can be given a
friendly address and you don’t have
to worry about typing in its IP address.
Instead, a Domain Name Server (DNS)
looks up the IP address for you.
You don’t have to worry about
installing a DNS if you only wish to
access the Internet, since this will be
taken care of by your Internet Service
Provider (ISP). However, you may
want to set up a DNS if you wish to
run a private intranet.
Alternatively, if the network is
only small and you are using static
IP addresses, you can resolve domain
names using a hosts file. This works
in a similar manner to an lmhosts file
(which resolves computer or NetBios
names), except that you list the host
names next to the IP address. Fig.11
shows a sample hosts file.
Note that, as with lmhosts, you
must select the Enable DNS option in
the TCP/IP Properties dialog box for
Windows 95/98. A similar situation
applies to Windows NT.
By the way, Windows NT server’s
implementation of DNS allows direct
look-up of the NetBios names from
WINS. If this is enabled, it can make
quite a powerful system whereby users
are able to find others either by their
NetBios name (eg, “Rimmer”) or by
their Fully Qualified Domain Name
(eg, www.siliconchip.com.au).
Finally, this article should only
be considered as an introduction
to DHCP, WINS and DNS. TCP\IP
addressing is really quite a complicated subject and you can buy complete textbooks on this topic. And,
of course, it all becomes much more
complicated when you throw in a
SC
dial-up adapter.
|