old-www/HOWTO/PLIP-9.html

299 lines
12 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>LINUX PLIP MINI-HOWTO: A PLIP link between DOS and Linux</TITLE>
<LINK HREF="PLIP-10.html" REL=next>
<LINK HREF="PLIP-8.html" REL=previous>
<LINK HREF="PLIP.html#toc9" REL=contents>
</HEAD>
<BODY>
<A HREF="PLIP-10.html">Next</A>
<A HREF="PLIP-8.html">Previous</A>
<A HREF="PLIP.html#toc9">Contents</A>
<HR>
<H2><A NAME="s9">9. A PLIP link between DOS and Linux</A></H2>
<P>After the first release of this Mini-HowTo many people wrote for info about
a link between Linux and DOS (or Windows) computer. The general interest
lead me to add this chapter, I hope will be of help to everybody.
<P>This section comes from an article I've found on Linux Gazzette by James
McDuffie &lt;mcduffie@scsn.net&gt; . It covers the basic installation of a PLIP
link between Linux and a DOS computer using Windows and Trumpet WinSock
and gives the address of a cool program that let's you run X-Windows
programs on Windows.
<P>The last section is an addendum sent by James Vahn
<A HREF="mailto:jvahn@short.circuit.com">jvahn@short.circuit.com</A>
where he describes deeply how to set up this link and how to solve many
problems.
<P><B>For any questions about this chapter please contact him, not me.</B>
<P>
<H2><A NAME="ss9.1">9.1 DOS-Linux link.</A>
</H2>
<P>I suppose you have already set up properly the PLIP support on the Linux
side and you have got the right cable, else go back to the previous chapters.
<P>Now, for the DOS side, you need first of all a packet driver. It can be
found here:
<P>
<A HREF="ftp://ftp.crynwr.com/drivers/plip.zip">ftp://ftp.crynwr.com/drivers/plip.zip</A><P>The program runs under DOS and acts like a Ethernet Packet driver.
If you want to use PLIP with Windows you need also Trumpet Winsock. This
serves as the TCP/IP interface. Otherwise, you can probably find TCP/IP
software for DOS.
<P>Now go back to the Linux computer and add the DOS computer address to
/etc/hosts. If your DOS computer does not have a registered IP address
you may choose any address (remember the warning of chapter 3 about IP
addresses).
<P>Now let's suppose you chose the name linux for the Linux computer and dos
for the DOS one. You have to type:
<P>
<BLOCKQUOTE><CODE>
<PRE>
ifconfig plip1 linux pointopoint dos arp up
route add dos
</PRE>
</CODE></BLOCKQUOTE>
<P>Of course if you want to have this done every time you boot the linux
computer you may add these lines to the file /etc/rc.d/rc.inet1:
<P>
<HR>
<PRE>
/sbin/ifconfig plip1 linux pointopoint dos arp up
/sbin/route add dos
</PRE>
<HR>
<P>This sets up the interface and then adds a route to it. Of course if you
are using the second parallel port you have to write plip2 instead.
<P>Go back to the DOS/Windows computer and edit autoexec.bat, you have to
add the following lines.
<P>
<HR>
<PRE>
c:\plip\plip.com 0x60
c:\tcpip\winsock\winpkt.com 0x60
</PRE>
<HR>
<P>Of course I suppose you put plip.com (the packet driver) in the directory
c:/plip and the winpkt.com in c:/tcpip, else you need to put the right path.
<P>This sets the plip.com program on packet vector 0x60 and then loads the
winpkt.com program that comes with trumpet winsock on the same vector.
If the cable is something other than lpt1 you will have to tell plip.com
the irq number and io address. Also, winpkt.com needs to run to make the
packet vector avaliable to Windows. From here we go to the actual setup
under Trumpet Winsock. All you have to do is unselect SLIP or PPP and
enter 60 into the box labeled Packet vector. Then tell it the IP address
you gave it, the IP address of the Linux computer as the default gateway
and the Name Server as either you computer's ip or your ISP's address
for its nameservers if your going to connect it to the Internet (more on
this later). Close the setup and re-run Winsock and you should have it!
Put winsock in your startup group and you have everything setup automatically!
<P>If you want to access the Internet through the Linux computer on the Windows
computer you will need to set up IP Masquerading, for info on this see the
NET-2-HOWTO. This simply masquerades the Windows computer with your Linux
computer's IP address.
<P>Also I have found a program that lets you run X-Windows programs under
Windows! It is located at:
<P>
<A HREF="http://www.tucows.com/">http://www.tucows.com/</A><P>Set it up according to directions and then all you have to do is telnet
in from the Windows computer then set the display to the Windows computer
(`DISPLAY=duncan:0.0` for instance) and run the program desired.
There is nothing cooler than running xv under Windows! Hope all this helped.
<P>
<H2><A NAME="ss9.2">9.2 A DOS-Linux PLIP link experience.</A>
</H2>
<P><B>NOTE:</B> I received this document from James Vahn
<A HREF="mailto:jvahn@short.circuit.com">jvahn@short.circuit.com</A>.
I put it here unchanged. This means that <B>for any question about this
section he's much better qualified than me so please mail to him than to
me</B>.
His experience with a PLIP connection of a floppy-only DOS computer to a
Linux one is the perfect example of how to work-around common problems.
<P><B>Last Update 11 July 1996</B>
<P>My floppy-only DOS box is networked via PLIP to the second printer port on
the Linux machine. The first Linux printer port has a printer on it, both are
permanently connected and the DOS box is telnet'd into Linux. These are my
notes on what I did to accomplish this.
<P>When the kernel probes for printer ports, it will grab all of them unless you
remove one from the probe. Otherwise PLIP will get nothing. One method is to
load the drivers as modules when needed...
<P>&lt;gniibe@mri.co.jp&gt; writes:
<P>I keep recommending using PLIP/LP as kernel module, since
<UL>
<LI>modules are flexible for change of configuration</LI>
<LI>(re)compiling the kernel is not easy for novice users</LI>
<LI>co-existing PLIP and LP is only feasible by the modules</LI>
</UL>
<P>With PLIP/LP as kernel module, you can specify which port is PLIP and
which port is LP. Here is example:
<P>
<BLOCKQUOTE><CODE>
<PRE>
# insmod lp.o io=0x378
# insmod plip.o io=0x278 irq=2
</PRE>
</CODE></BLOCKQUOTE>
<P>Even you can use two parallel ports:
<P>
<BLOCKQUOTE><CODE>
<PRE>
# insmod plip.o io=0x278,0x3bc irq=2,5
</PRE>
</CODE></BLOCKQUOTE>
<P>In the example above,
<P>plip0 is assigned on 0x278 and it's irq is 2,
<P>plip1 is assigned on 0x3bc and it's irq is 5, respectively.
<P>
<P>
<P>Using modules certainly sounds like the way to go. The following method shows
how to patch the kernel to allow both a printer and PLIP on different ports,
without modules. If you are unfamiliar with the module concept, you might
find this quicker to set up.
<P>You will need to modify two files in the kernel source tree. I'm using kernel
1.2.13 and found some changes were needed in ../linux/drivers/net/Space.c to
accommodate my system. Look at around line 205 for the PLIP definitions to
make sure your port and IRQ match, and make a note of which driver it will be
(plip0, plip1, plip2). In my case port 0x278 uses IRQ 5 (the card is jumpered
that way) but Space.c defined it with IRQ 2. I made the changes here, rather
than opening up the box and changing jumpers. The alternative is to specify
the IRQ through ifconfig later on, but the kernel will boot up with the wrong
IRQ for PLIP and it may annoy you. It is a simple (single character) change.
<P>The next, and more difficult step:
<P>In .../drivers/char/lp.c you will find the following at around line 38:
<P>
<HR>
<PRE>
struct lp_struct lp_table[] = {
{ 0x3bc, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL, NULL, },
{ 0x378, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL, NULL, },
/* { 0x278, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL, NULL, },
* 0x278 reserved for plip1
*
* };
* #define LP_NO 3
*/
};
#define LP_NO 2
</PRE>
<HR>
<P>Notice the changes to make- one port is commented out, so now only 2 ports
are defined. Port 0x3BC will probably not work for PLIP- the IRQ line is
usually broken on these ports, as found on old monochrome adapters (MDA).
<P>You made backups of these file before you changed them, right? Now make a
new kernel with printer, net, dummy, and plip support.
<P>Configure the system. This is my /etc/rc.d/rc.inet1 file:
<P>
<HR>
<PRE>
#!/bin/bash
#
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0
/sbin/ifconfig dummy 200.0.0.1
/sbin/route add -net 200.0.0.0 netmask 255.255.255.0
/sbin/ifconfig plip1 arp 200.0.0.1 pointopoint 200.0.0.2 up
/sbin/route add 200.0.0.2
/sbin/ifconfig dummy down
</PRE>
<HR>
<P>Notice that arp is used for the DOS-to-Linux connection, apparently not used
on Linux-to-Linux connections.
<P>And in /etc/hosts you can add these, just to give the two machines names:
<P>
<HR>
<PRE>
200.0.0.1 console1
200.0.0.2 console2
</PRE>
<HR>
<P>The DOS box is console2. Note Andrea's warning about these, better to use
official numbering schemes.
<P>Reboot so all of these changes and the new kernel will take effect. During
the boot sequence (or by running dmesg) if you made the patches, otherwise
when the modules are loaded:
<BLOCKQUOTE><CODE>
<PRE>
lp0 at 0x03bc, using polling driver
lp1 at 0x0378, using polling driver
[....]
NET3 PLIP version 2.0 gniibe@mri.co.jp
plip1: Parallel port at 0x278, using assigned IRQ 5.
</PRE>
</CODE></BLOCKQUOTE>
<P>The "route" command shows this:
<P>
<BLOCKQUOTE><CODE>
<PRE>
Kernel routing table
Destination Gateway Genmask Flags MSS Window Use Iface
console2 * 255.255.255.255 UH 1436 0 136 plip1
loopback * 255.0.0.0 U 1936 0 109 lo
</PRE>
</CODE></BLOCKQUOTE>
<P>And "ifconfig plip1" shows:
<P>
<BLOCKQUOTE><CODE>
<PRE>
plip1 Link encap:10Mbps Ethernet HWaddr FC:FC:C8:00:00:01
inet addr:200.0.0.1 P-t-P:200.0.0.2 Mask:255.255.255.0
UP POINTOPOINT RUNNING MTU:1500 Metric:1
RX packets:132 errors:0 dropped:0 overruns:0
TX packets:136 errors:0 dropped:0 overruns:0
Interrupt:5 Base address:0x278
</PRE>
</CODE></BLOCKQUOTE>
<P>Look at /etc/inetd.conf and see if telnet is enabled. You might want to read
the man page for tcpd, and the use of /etc/hosts.allow (ALL: LOCAL) and
/etc/hosts.deny (ALL: ALL). You should be able to "telnet localhost".
<P>Linux is done, now the DOS side. Again, be suspicious of port 0x3BC if one is
present.
<P>I'm using NCSA's telnet and Crynwr's PLIP driver found at these sites:
<P>
<A HREF="ftp://ftp.ncsa.uiuc.edu/Telnet/DOS/ncsa/tel2308b.zip">ftp://ftp.ncsa.uiuc.edu/Telnet/DOS/ncsa/tel2308b.zip</A><P>
<A HREF="ftp://ftp.crynwr.com/drivers/plip.zip">ftp://ftp.crynwr.com/drivers/plip.zip</A><P>Be sure to use NCSA's version 2.3.08 telnet and version 11.1 of Crynwr's
PLIP driver. Please find and read Crynwr's SUPPORT.DOC located elswhere.
<P>The CONFIG.TEL file. Most of it is the default and to save some space
I've tried to cut it back here to just the info you need (hopefully). The
second port on this machine is setup as 0x278 on IRQ 5.
<P>
<HR>
<PRE>
myip=200.0.0.2
netmask=255.255.255.0 # subnetting mask
hardware=packet # network adapter board (packet driver interface)
interrupt=5 # IRQ which adapter is set to
ioaddr=60 # software interrupt vector driver is using
#
#[...lots unchanged...]
#
# at the end of the file, put this line:
name=console1 ; hostip=200.0.0.1 ; nameserver=1 ; gateway=1
</PRE>
<HR>
<P>(console1 is the name of the Linux machine, you can use whatever you like)
<P>I made a 12 foot null cable between both machines, and (after initially
finding it miswired) there have been no problems. A standard 11-wire null
printer cable should work too. The Linux plip.c source shows the wiring.
Although my cable has the 17-17 connection, I don't think it is used for
anything and was not present on a ready-made cable.
<P>
<HR>
<PRE>
@echo off
plip.com 0x60 5 0x278
telbin -s console1
</PRE>
<HR>
<P>That should connect you to the Linux box on /dev/ttyp. NCSA's telnet
provides for 8 virtual screens and also acts as an ftp server. The PLIP
interface provides a fair throughput, I'm getting 6.5K/s file transfers
with my antiques. Let's hope you can do better. :-)
<P>
<HR>
<A HREF="PLIP-10.html">Next</A>
<A HREF="PLIP-8.html">Previous</A>
<A HREF="PLIP.html#toc9">Contents</A>
</BODY>
</HTML>