Next Previous Contents

9. A PLIP link between DOS and Linux

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.

This section comes from an article I've found on Linux Gazzette by James McDuffie <mcduffie@scsn.net> . 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.

The last section is an addendum sent by James Vahn jvahn@short.circuit.com where he describes deeply how to set up this link and how to solve many problems.

For any questions about this chapter please contact him, not me.

9.1 DOS-Linux link.

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.

Now, for the DOS side, you need first of all a packet driver. It can be found here:

ftp://ftp.crynwr.com/drivers/plip.zip

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.

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).

Now let's suppose you chose the name linux for the Linux computer and dos for the DOS one. You have to type:

ifconfig plip1 linux pointopoint dos arp up
route add dos

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:


/sbin/ifconfig plip1 linux pointopoint dos arp up
/sbin/route add dos

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.

Go back to the DOS/Windows computer and edit autoexec.bat, you have to add the following lines.


c:\plip\plip.com 0x60
c:\tcpip\winsock\winpkt.com 0x60

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.

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!

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.

Also I have found a program that lets you run X-Windows programs under Windows! It is located at:

http://www.tucows.com/

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.

9.2 A DOS-Linux PLIP link experience.

NOTE: I received this document from James Vahn jvahn@short.circuit.com. I put it here unchanged. This means that for any question about this section he's much better qualified than me so please mail to him than to me. 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.

Last Update 11 July 1996

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.

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...

<gniibe@mri.co.jp> writes:

I keep recommending using PLIP/LP as kernel module, since

With PLIP/LP as kernel module, you can specify which port is PLIP and which port is LP. Here is example:

# insmod lp.o io=0x378
# insmod plip.o io=0x278 irq=2

Even you can use two parallel ports:

# insmod plip.o io=0x278,0x3bc irq=2,5

In the example above,

plip0 is assigned on 0x278 and it's irq is 2,

plip1 is assigned on 0x3bc and it's irq is 5, respectively.

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.

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.

The next, and more difficult step:

In .../drivers/char/lp.c you will find the following at around line 38:


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 

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).

You made backups of these file before you changed them, right? Now make a new kernel with printer, net, dummy, and plip support.

Configure the system. This is my /etc/rc.d/rc.inet1 file:


#!/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

Notice that arp is used for the DOS-to-Linux connection, apparently not used on Linux-to-Linux connections.

And in /etc/hosts you can add these, just to give the two machines names:


200.0.0.1       console1
200.0.0.2       console2

The DOS box is console2. Note Andrea's warning about these, better to use official numbering schemes.

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:

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.

The "route" command shows this:

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

And "ifconfig plip1" shows:

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 

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".

Linux is done, now the DOS side. Again, be suspicious of port 0x3BC if one is present.

I'm using NCSA's telnet and Crynwr's PLIP driver found at these sites:

ftp://ftp.ncsa.uiuc.edu/Telnet/DOS/ncsa/tel2308b.zip

ftp://ftp.crynwr.com/drivers/plip.zip

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.

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.


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 

(console1 is the name of the Linux machine, you can use whatever you like)

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.


@echo off
plip.com 0x60 5 0x278
telbin -s console1

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. :-)


Next Previous Contents