old-www/LDP/LG/issue57/sipos.html

417 lines
18 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>Making a Simple Linux Network Including Windows 9x LG #57</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<CENTER>
<A HREF="http://www.linuxgazette.com/">
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.jpg"
WIDTH="600" HEIGHT="124" border="0"></H1></A>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="sharma.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue57/sipos.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="skjoldebrand.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
<P>
</CENTER>
<!--endcut ============================================================-->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Making a Simple Linux Network Including Windows 9x</font></H1>
<H4>By <a href="mailto:xvudpapc@savba.sk">Juraj Sipos</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<P> I decided to write this article because often, when I read some howtos or
general help texts, I find it difficult to navigate myself in the sea of
information due to the fact that I often need only a little to know. Instead,
I'm compelled to read hundreds of pages of texts to find an answer.
<P> I will give
you an example. This article will help you make a simple network between two
computers, but I haven't been able to mail between the two machines. The
sendmail configuration is very complicated and before I find a solution, I have
to read many pages of texts. But I actually need only few words, something
like: "Put this in sendmail configuration file and you're done". I do not want
to say that I will not be able to solve this, but time is money and I often
have to do other things for living. People like me like examples that can be
applied without problems. So I also give such examples in my article. I will
not tell you to put 20.0.0.0 in your /etc/hosts, as some authors write about
configuring a home network, because this is not a private network IP number. I
will give you the numbers and expressions I have and use with assurance that it
works with me. Please do not email me with questions like "my Linux doesn't
see a parallel port", "I cannot connect to another machine from second parallel
port..." or questions that are answered in this article, but mail me with how
to configure a sendmail!
<P> This article also expects some work and study to be
done on your part assuming you will not use some prehistoric kernels or
hardware.
<P> I would like to comment the following "Help Wanted" question from Linux
Gazette, August 2000.
<BLOCKQUOTE>
Hi there, My name Sergey, I use Slackware 7.0. I have read a document
about serial connection between Win95 and Linux, but never have seen about
parallel. Help me, tell me how can I use my parallel NULL modem. Is lp0 the
LPT1 port? Thanks, Sergey
</BLOCKQUOTE>
<P> I successfully connected my two computers with
<A HREF="http://www.ssc.com/mirrors/LDP/HOWTO/PLIP-Install-HOWTO.html">PLIP Install HOWTO</A> (which is very
well written), but I found some problems that I had to solve using
my own creativity. Furthermore, the part of "kernel reconfiguration"
in the PLIP HOWTO may be misleading for newbies, because reconfiguration
is not necessary. So here I will give you some more detailed info
on connecting two Linux machines with PLIP or network-card
interfaces, and I will also mention connecting a Windows machine
with Linux box.
<P> I use RedHat 6.0 because it looks to be the most stable Linux on
my computer configuration. I have quite a difficult configuration,
I use FreeBSD, Linux, DOS-Windows, Zip Drive, and other things that
are quite complicated (for example, my C Drive is totally encrypted,
so I boot with a password and then a boot manager is started).
I have 8 OS's on two hardisks including OS/2 and BEOS
and loop boot disk files (Linux booting from a large file). I tested
network (PLIP and NE2000 Network Cards and compatibles)
connection on RedHat 6.0, 6.1, 6.2 and SuSE 6.4.
<H2>PLIP</H2>
<P> If you have the above-mentioned systems, you don't have to compile a
kernel to use PLIP. This may also work for Mandrake, but I haven't
tested it. Linux generic kernel is sufficient (the one you have
after Linux is installed). To make a PLIP connection, do the following:
<OL>
<LI> get a laplink parallel cable
<LI> install Linux on both machines (I hope you have two machines:) with
appropriate network services (inet, etc.)
<LI> open /etc/hosts with your favorite text editor on both computers and
put the following lines there:
<PRE>
127.0.0.1 localhost localhost.localdomain
10.0.0.1 one
10.0.0.2 two
</PRE>
10.0.0.0 is a private network IP address that will not interfere with
your
Internet connection.
<LI> Go to BIOS setup of the second computer and change "Halt on all
Errors" to
"halt on all Errors except Keyboard".
<LI> edit /etc/rc.d/rc.local on the second computer and put there this
somewhere at the end:
<PRE>
modprobe plip
ifconfig plip0 two pointopoint one up
</PRE>
</OL>
<P> (Linux will automatically assign plip0 service to lp0 or LPT1, so
you never have to use lp0 in plip connection configuration. But if
you want to use a printer, issue "ifconfig plip0 down", then remove
the plip module from kernel with rmmod command. Don't mail me
with questions about printer problems.)
<P> Thus, the second computer will start automatically, without keyboard,
with plip interface. Restart it to see if it boots. You do not worry
about looking in it, you will be able to telnet, ftp or ssh to it
from another computer. But you can attach a keyboard to it.
The important thing is that it will be able to boot with Linux.
Here is a problem where the PLIP HOWTO did not
help me: The command "modprobe plip" did not work and the system gave
me something like "unresolved symbols" "...device busy". I realized
that the problem was in Linux's inability to assign IRQ number to my
PLIP interface. I solved the issue with the following command:
<PRE>
echo 7 &gt; /proc/parport/0/irq
</PRE>
<P> This command will put the IRQ number to kernel processes directory
(/proc)
and plip will be working. But first you must run the "modprobe plip"
command anyway because it will make a parport directory in the /proc
directory. Now change the IRQ number to 7 in /proc/parport/0/irq.
Then run the "modprobe plip" command again. The second running of
the modprobe command will install plip. This also worked on my
SuSE system. So if you receive, on the second computer,
an error like "unresolved symbols...", "the device busy", put
this command in your /etc/rc.d/rc.local:
<PRE>
modprobe plip
echo 7 &gt; /proc/parport/0/irq
ifconfig plip0 two pointopoint one up
</PRE>
Obviously, the same command must be also issued on the first computer,
but you will have to change the order of "ifconfig plip0 two pointopoint
one up" to "ifconfig plip0 one pointopoint two up", so on the first
computer you will issue:
<PRE>
modprobe plip
echo 7 &gt; /proc/parport/0/irq
ifconfig plip0 one pointopoint two up
</PRE>
You can run this manually; you can put it in rc.local, or make a
script for these commands (for use on your computer ONE). Now you
should be able to telnet, ssh, ping, ftp or lynx, if Apache server
is running, to the second machine and telnet back from the second
machine
to the first machine. But first check you have working network daemons
running. Then try "telnet two" or "telnet 10.0.0.2".
<P> NOTE: Because telnet does not allow you to login as root, create another
user without root privileges on both systems.
<H2>Connecting Windows machine and Linux box</H2>
<H3>PLIP</H3>
There is a plip driver for DOS/Windows:
<A HREF="ftp://ftp.crynwr.com/drivers/plip.zip">ftp://ftp.crynwr.com/drivers/plip.zip</A>.
The problem with this driver is that it does not work with Windows 9x
(it supposed to work with DOS), but you may give it a try. This issue
remains open for a software development and I was not successful to
make a link between Linux and Windows machines via a parallel cable.
<P> If you have a computer with Windows 9x you do not want to tamper with,
try a Linux emulator like Bochs - to install Linux under Windows
(<A HREF="ftp://ftp.bochs.com">ftp.bochs.com</A>, <A HREF="http://www.bochs.com">www.bochs.com</A>), or make a loop boot file. A howto for
making a file with booting abilities is included in Linux Howto
Documentation with
<A HREF="http://www.ssc.com/mirrors/LDP/HOWTO/mini/Loopback-Root-FS.html">"Loopback-Root-FS"</A> title. It is an excellent
article. Then you will do just the same I described here to your
loop file.
<H2>Network Cards</H2>
<P> I would suggest using a thinnet because it is the cheapest network in
the price of a good and long parallel cable. This network is officially
called 10Base 2. You need a coaxial cable with BNC connectors,
tees and terminators. Tees look something like T where the bottom of
the tee is put to NIC (Network Card Interface), and the ends opposite
each other are used for connecting to computers and terminators.
<PRE>
here you will &gt; ------|------ &lt; here you will
put a coaxial cable | put a terminator
going to another computer |
|
The bottom of the TEE will be connected to NIC in your computer.
</PRE>
<P> If you have two computers, you have to use a terminator to put it in
the tee on both computers (one end of the tee is already in the NIC,
one end of the upper part of the tee is used for connection to other
computer, another end of the upper part of the tee is used for
connection
to other computer, too, or for connection to a terminator). If you
have 5 computers in this order "1comp 2comp 3comp 4comp 5comp",
the 1comp and 5comp must have terminators in their tees, but
2comp, 3comp and 4comp will have coaxial cables in both sides of
their tees. Your network will not work without terminators.
<P> Generally, there are three types of widely used networks:
<PRE>
10Base 5 - it is a little bit old
10Base 2 - the one I write about here, the coaxial cable may be 185
meters long;
you may have a network with 30 computers per one segment
10Base 10 - requires a hub and may be expensive for you.
</PRE>
<P> I would suggest buying NE2000 cards (10Mbit) or compatibles. I have had
not problems with them so far. You may buy each for less than
10 dollars. Do the same as I already
said - put your network information in /etc/hosts file:
<PRE>
127.0.0.1 localhost localhost.localdomain
10.0.0.1 one
10.0.0.2 two
</PRE>
Make sure the NIC's are well seated in their slots. Run a diagnostic
program (rset8029.exe in my case). Change configuration from 10Base 10
(which is default) to 10Base 2 on both network cards. Restart. Put
this command in computer one:
<PRE>
modprobe ne2k-pci
ifconfig eth0 one
</PRE>
Put this command in computer two:
<PRE>
modprobe ne2k-pci
ifconfig eth0 two
</PRE>
Now you should see something like this on both computers:
<PRE>
eth0 Link encap:Ethernet HWaddr 52:54:AB:1F:7A:51
inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:11 Base address:0xe800
</PRE>
I read some network howtos that recommended using the "route add"
command, but
it appeared irrelevant using it here.
<BLOCKQUOTE> <EM>
[2.2 kernels don't need "route add". 2.0 kernels do. 2.2 kernels
automatically add the standard route; i.e., the route necessary for this
IP to connect to its local network. -Ed.]
</EM> </BLOCKQUOTE>
<P> This network with two computers
works just fine. Now you may telnet, ssh, ping, ftp to the second
machine
and vice versa. If you want to use NFS, read the
<A HREF="http://www.ssc.com/mirrors/LDP/HOWTO/NFS-HOWTO.html">NFS Howto</A>. Or simply
read my instructions: install nfs daemon. Edit /etc/exports file or
create it if it is not there. Put the following line there:
<PRE>
/ two (rw)
</PRE>
Run rpcinfo -p to check if it works. You should see something like:
<PRE>
program vers proto port
100000 2 tcp 110 rpcbind
100000 2 udp 111 rpcbind
100024 1 udp 903 status
100024 1 tcp 905 status
100011 1 udp 914 rquotad
100011 2 udp 914 rquotad
100005 1 udp 924 mountd
100005 1 tcp 926 mountd
100005 2 udp 929 mountd
100005 2 tcp 931 mountd
100005 3 udp 934 mountd
100005 3 tcp 936 mountd
100003 2 udp 2049 nfs
</PRE>
If you do not see mountd or nfs, you badly installed the nfs package
(install the package knfsd* and netkit-base-*, which contains inetd).
Every change to /etc/exports file must be followed by "exportfs -av"
command. Run it and then simply run:
mount -t nfs two:/ /mnt -o rsize=8192,wsize=8192,nolock
and you should have a working NFS. Just peek in the /mnt directory.
You should see your second machine there. If you have problems with
write permissions, give permissions on your second computer to everybody
(for one directory only; this must be done by telnet).
<H2>Communication between Linux and Windows</H2>
<P> Linux and Windows (and other systems too) can communicate each other
via network cards. Do the following:
Windows will install your network card automatically, if not, open
Control
Panel, Add Hardware. Click to add hardware. I had problems with PCI
Steering, where Windows assigned a different IRQ number to my NIC
than BIOS, so my card didn't work, and Windows appeared as a total
zero dollar crap where simple users would be completely lost. Check
the IRQ number in the system icon in Control Panel. If it is different
from the one BIOS assigned to your card, remove PCI steering.
Here Linux is much more flexible. If Windows sees your network card,
appropriate network drivers should be installed automatically. If
installed, open Control Panel, Network, and edit TCP/IP &gt;
Realtek RTL8029 Ethernet Adapter and Compatibles (or other NIC, if you
have one) in Properties. Click "Specify an IP Address" and change
the IP on the IP Address Tab to 10.0.0.1, Subnet Mask should
be 255.255.255.0. That's all. Restart computer. Windows contains
C:\windows\lmhosts.sam and C:\windows\hosts.sam in
its directory. Copy them or create new files in
C:\windows - hosts, lmhosts.
Put the following lines in both of them:
<PRE>
c:\windows\hosts
c:\windows\lmhosts
127.0.0.1 localhost localhost.localdomain
10.0.0.1 one
10.0.0.2 two
</PRE>
Now, if you telnet to Linux machine from the Windows machine, you
can run Linux commands and programs - you will have Linux running
in Windows. I had not time to test X Server, but most console
commands work. If you have Apache Server running on Linux, you can
http to Linux box from Netscape using this command:
<PRE>
http://two
</PRE>
If you have a user but not anonymous ftp access to your Linux box,
you can ftp to Linux from Netscape by using this command:
ftp://user:password@two (where "user" is a working user you added to
your Linux box; it cannot be root).
<P> The parallel cable, if too long, may be quite expensive. Cheap network
cards I mentioned here may be only a little more expensive. And if
bought
as second-hand, they may be even cheaper than a long parallel laplink
cable. So I would suggest using the network cards similar to mine to
have a simple and working home network. Such connection is considerably
faster than using parallel port cable.
<P> If you're in a trouble, you may always look in Linux howtos like
PLIP, NET, etc. If something doesn't work, consider testing your
hardware under a different OS.
<P> BTW, does anybody out there know how
to configure sendmail to use mail in our home network?
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright &copy; 2000, Juraj Sipos<BR>
Published in Issue 57 of <i>Linux Gazette</i>, September 2000</H5>
<!-- *** END copyright *** -->
<!--startcut ==========================================================-->
<HR><P>
<CENTER>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="sharma.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue57/sipos.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="skjoldebrand.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
</CENTER>
</BODY></HTML>
<!--endcut ============================================================-->