|
|
How to easily network two or more Linux computers.
After struggling for many hours trying to
get the network component of Linux to work,
I discovered an easy way to
set it up. I have to give credit to my college
instructor, James L. Fuller, for much help
and many hours of good brain storming. Here's
a list of things and hardware you'll need
in order to set up your own network under
kernel 2.2x and a Red Hat or Linux Mandrake
system. The basics are the same but on other
distributions you'll have to either use their
configuration tools or edit the configuration
files in a text editor.
Hardware
-
Network card, 1 for each computer you expect
to have on the network
I have used many different ones such as:
3com 3c905b, Realtek (various models), Kingston,
and several others that don't come to mind.
Most NE2000 compatible ca Most NE2000 compatible
cards will work.
-
Hub (for connecting your systems together.)
Kits may be purchased for under $100.00 at
most computer stores or office supply outlets.
NOTE: you can do away with the hub if your
only networking 2 computers.
-
Cable, 1 cable from each computer to the
hub, or if only 2 computer are to be used
a crossover cable.
Now for the set up of the network components
of the OS.
At this point I have to make an assumption,
namely that you have networking services
installed and configured to run at boot.
If not, then you'll have to get that set
up before your network will operate.
NOTE: Most distributions will set up network
components as default, you may have to add
some items and stop others from loading during
boot. This can be accomplished from a command
line by typing ntsysv and selecting the components when the window
opens. If you don't have the network components
installed you will have to do that first.
You'll need everything for networking, and
NFS except orking, and NFS except the stuff
beginning with YP (ypserv etc.) and NIS (these
are mostly for SUN workstation and older
Linux/Unix connectivity). At this point I'll
assume you know how to use either the package
management software on your system or the
RPM command from a terminal window. If not
then you should familiarize yourself with
them as you'll probably need to install some
packages.
OK , on with the show.
The first thing, of course, is to install
your network cards and configure them. Follow
the documentation that comes with your NIC
to get it installed.
Configuration is pretty easy, go to linuxconf -> networking -> Host name and Network
Devices. The afore mentioned command assumes
you're using a Red Hat based distribution.
You can either open linuxconf from the GNOME
or KDE desktops or from a command line. The
desktop environment is a bit easier to use.
Under host name + domain, enter your computers
name, and your domain name (you.your.com or donald.duck.com).
Next, check enabled then manual.
On the next line make sure that your domain
is set properly (you.your.com or donald.duck.com) donald.duck.com) same as the first line.
under Aliases give the computers name (you or donald) it should look like this:
you.your.com (or donald.duck.com)
you (or donald)
Next give your network an address, it should
be in the 192.168.0.0 range.
I would pick 192.168.0.1 for the first machine
and 192.168.0.2 for the second one because
all the tutorials use these addresses and
it makes it easier to learn what you're doing.
Remember that you have to give each computer
on the network a distinctive name. You could do something like this:
Computer #1 - 192.168.0.1 donald.duck.com
- Alias donald
Computer #2 - 192.168.0.2 daisy.duck.com
- Alias daisy - and so on..
The names could be mickey.mouse.org or nearly
anything you CHOOSE to use, Remember, you're
not on the world wide net.
For the remainder of this HOWTO, I'll use
donald.duck.com and daisy.duck.com.....
Next the netmask, for this class network
it must be 255.255.255.0 (it can be different but again, stay conventional
for easesp;
for ease of use and learning).
Next the net device. Here's where you tell
the network what card you have, normally
in a single card system this will be eth0 ( this stands for Ethernet 0, the first Ethernet card in your
system). As an example I have used the NE 2000 compatible
module name, ne2k-pci.
Close linuxconf and let it make all the changes, pay attention
to any log or error messages it generates
and fix the problems before the next step.
That's it for hardware.
OK, let's find out if the network is running
Open a console window, type su - you'll see
this returned: password (type your root password
here and press the enter key)
Now you should be logged on as the root user.
type ifconfig and read the return, it should have two
entries, one for the network giving the IP
address 192.168.0.1
and a bunch of other stuff and one for the
local loopback 127.0.0.1 for the first machine
(donald) and 192.168.0.2 for the second (daisy).
If you see that you're half way there, if
not go back over the above steps and find
your mistake.( It could be the network cacould
be the network card you have is no
good also. Some network cards have to be
set with their DOS utility to an unused IRQ.
Check the documentation that came with the
card if you suspect an incompatibility.)
The most common problem encountered is in
typos, DOUBLE CHECK YOUR TYPING!!!
SOOO, ya found the IP address OK, now we
will see if it can "see" the other
computers on the network.
Open a console window and type ping 192.168.0.2 -c5 (assuming you're on 192.168.0.1 while reading
this HOWTO), you should get 5 lines of information
telling you how long it took the information
packets to get to the second machine and
back.
go to the other machine and type in the same
command substituting the proper IP address,
you should get the same type of returned
information.
Next item on the list is to set up the mounted
file system and the exported file system.
Open linuxconf as the root user. Go to networking -> Exported file systems (NFS), press enter and choose Add.
-
Path to export --> Usually your home directory
(/home/you)
-
Comment (opt) --> you don't need to put
anything here but it is a good idea to leave
yourself a note letting you know exactly
what you've done.
-
Client name(s) --> Put in the IP address
of the OTHER computer (assuming your on 192.168.0.1, enter 192.168.0.2),
Later HOWTO's will cover name resolution.
[X] May write -- Gives the other computer
privileges to write into your directory.
A MUST if you're to SHARE files not just
be able to see them.
[X] Root privileges -- You can decide if
you want the other computer to have this
much power on your home directory and possibly
others as well. I do on mine BUT, I'm the
ONLY ONE USING IT... If there are other users
that may be present when you're not, I would
not grant this privilege.
[ ] Request from a secure port
-- Only use this if you know ALL about file
system security and have the proper software
packages installed.
Now go to the other computer (192.168.0.2) and do the same thing substituting 192.168.0.1 for the IP address.
T> for the IP address.
Next open a terminal and type - export netfs
- and press the enter key.
OK, now you have told each of your computers
to make the /home/you directories available to the other computers
on your network.
Now you must tell each computer to "mount"
the remote file system. All file systems
whether in Windows, Linux, Mac O/S or others,
must be "mounted" in order to be
accessible. The big advantage of a UNIX type
operating system is it doesn't care if the
file system is on your local computer or
on another (remote) computer on the network,
it treats them all the same.
Open a terminal, su to root (see above) and
type linuxconf, go to -> File systems -> Access nfs volume
-> Add.
You will see three entry points:
Server (from 192.168.0.1 you will enter 192.168.0.2) Enter just the opposite from 192.168.0.2!
Volume (here you will enter the same directory
you exported earlier, /home/you)
Mount point ( here is where you tell your computer where
to look for the "mounted" file
system, usually /mnt/<the name of the
OTHER computer on your network>).As an example, if you're on 192.168.0.1 which
is donald, you would want to "mount"
192.168.0.2 which is daisy, so your Mount
point would be /mnt/daisy.
Now go to daisy (192.168.0.2) and enter the
information for "mounting" donald.
Server would be 192.168.0.1
volume would be the file system you exported above
(/home/you)
Mount point would then become /mnt/donald.
Open a terminal and type - service netfs restart, watch for any error messages and correct
the errors, if any, using linuxconf.
Now create a desktop link following the directions
of your favorite desktop environment.
environment.
From this point you can just click on the
link and open a folder (/mnt/<other computer>)
and use the files and folders just as you
would if they were on your computer.
All of the above may be accomplished by editing
the /etc/exports file for the exported file
system and the /etc/fstab for the mounted
file systems.
Another subject for another day. ------
ENJOY -------
|