• Please review our updated Terms and Rules here

Serial port - Linux and DOS

lianergoist

Member
Joined
Nov 8, 2006
Messages
12
Location
Denmark
Hello!

I have a Amstrad PPC-640. It is running MS-DOS 3.3 and has no NIC.

There are two things I would like to do

1. access files on another computer - like interlnk/intersrv for dos.
2. get internet access via another computer

The "another-computer" is a laptop without serial port, and running Linux. I have a usb-to-serial cable, and it seems to be autodetected when pluged in (becomes /dev/ttyUSB0), so I guess that part is okay. Linux most likely already have what's needed to communicate with another computer - I just don't know what and how. So, ...

1. If I want to let a Linux computer act as file server via a serial port, what would I need to do? I am sure I have several options, but I want something that let me run a light, easy and fast solution on the DOS-client. I may be able to write a client myself, but I would prefere not to. And still, I don't know how to setup Linux to act as file server over a serial port.

2. The file server above could maybe be a FTP server. I have with success used a SLIP or PPP driver to create a TCP/IP-network between two DOS-computers connected with a serial cable, but I don't know how to set up Linux to bridge the serial port to the LAN. I know this is not a linux forum, but maybe someone here can help anyway.


--

Thomas Jensen, Denmark
 
There are a lot of ways to do this. Here are some thoughts:

First, the machines need to be connected. I presume that you have a proper "null modem" cable so that the two machines can be directly connected. A null modem cable crosses the transmit and receive wires so that the two machines are not both trying to send on the same wire and receive on the same wire.

Second, you need some sort of terminal emulation software on the Amstrad. Something like Procomm, Telelink, or Kermit. These provide file transfer functions in addition to terminal emulation.

For general "terminal" access you can tell Linux to look for a hardwired terminal. That is generally done by telling /etc/inittab to run a "getty" process on a serial port (ttyS0 or ttyS1). The procedure varies slightly from Linux distro to distro, but it is generally the same. When you do that your Amstrad will be usable as a terminal to the Linux machine.

Once you have that running you can do file transfers using programs on the Linux side. Look for 'rz' and 'sz' - those put your Linux "terminal" in raw mode and allow you to transfer binary files. They support a lot of variations of xmodem, ymodem, and zmodem.

For a more peer-to-peer approach you can setup SLIP or PPP on the Linux side and matching DOS TCP/IP software on the Amstrad. On the Amstrad you will run a packet driver like DOSPPP that makes your serial link look more like networking hardware which is compatible with software that uses the "packet driver" specification. Your Amstrad will be running real TCP/IP over that link; to get to the outside world your Linux box will have to be setup to do packet routing and forwarding. I've done this with my mTCP software and it works well enough for things like Telnet and IRC, but for the best file transfer performance you probably want to stick with the terminal emulation approach. (TCP/IP on a serial link has a bit of overhead.) Bu this approach does let you FTP and Telnet to anywhere on the Internet directly from your Amstrad.

Look for the following to get you started: dosppp05.zip
 
Davs Thomas,

The Linux part begins with starting PPPD like this:

Code:
pppd -detach crtscts lock proxyarp 192.168.1.121:192.168.1.120  /dev/ttyS0 38400 &
The two IP numbers are optional but I do it like that because I like so have the server (Linux box) always using 121 for the serial port and clients always be 120. It's convenient for remembering numbers with numerous machines.

You also need to enable port forwarding and that's extremely simple. Basically all you need is to change the contents of /proc/sys/net/ipv4/ip_forward from a "0" to a "1". To make this configuration permanent the best way is to do it is using the file /etc/sysctl.conf where you can add a line containing net.ipv4.ip_forward = 1 .. and you're done. Simple!

On the dos box you use Molero's DOSPPPD which is the only version of pppd I know of for DOS. It's pretty straight forward, but ask me if you are stuck. I can send you all the files and config too if you like but I won't be home until late tonight. (Probably when you're getting up) You only need a few of the many files which are provided. You can then run mTCP and enjoy all the networking goodness.

Now, the thing which worries me is you said:
I have a usb-to-serial cable, and it seems to be autodetected when pluged in ...
The way I understand it is that USB to serial conversion is not so easy and it might not be reliable.

I hope this helps. You might want to have a read of the Linux Serial How-To :
http://www.tldp.org/HOWTO/PPP-HOWTO/direct.html
 
My previous post is a mess, sorry. I forgot that EPPPD is a wattcp program so you can't use mTCP utilities. However, you can still do what you want and more. Also, you probably don't need IP forwarding, but it is still nice to just be on the network and able to connect to anything, anywhere.

I grabbed the minimum files for DOS pppd and put them here: http://cgs.coalmont.net/pppmini.zip I assume you know how to change the configuration files to fit your own needs. Most of the lines aren't even needed. The ping is there for testing and you can delete it if you need space, but termin is the best way to exit. If you want the whole dospppd archive, I put that up for you too: http://cgs.coalmont.net/dospppd.zip

Edit: I forgot to say that you need to have the DOS and Linux boxen use the same baud or they won't talk to each other. So double check the configuration files on both.
 
There are a lot of ways to do this. Here are some thoughts:

First, the machines need to be connected. I presume that you have a proper "null modem" cable so that the two machines can be directly connected. A null modem cable crosses the transmit and receive wires so that the two machines are not both trying to send on the same wire and receive on the same wire.

Well, that's one of the reasons I asked. I hoped someone knew if I can use the usb2serial-cable. Maybe I need to attach a null-modem cable to the usb2serial-cable to get it working? So far it has not been working, so tomorrow I will buy a null-modem cable, and see if that's the problem.

For general "terminal" access you can tell Linux to look for a hardwired terminal. That is generally done by telling /etc/inittab to run a "getty" process on a serial port (ttyS0 or ttyS1).

I expect this is how to do it in Ubuntu 11.10

Code:
agetty -L ttyUSB0 9600


Once you have that running you can do file transfers using programs on the Linux side. Look for 'rz' and 'sz' - those put your Linux "terminal" in raw mode and allow you to transfer binary files. They support a lot of variations of xmodem, ymodem, and zmodem.

Great.

For a more peer-to-peer approach you can setup SLIP or PPP on the Linux side and matching DOS TCP/IP software on the Amstrad. On the Amstrad you will run a packet driver like DOSPPP that makes your serial link look more like networking hardware which is compatible with software that uses the "packet driver" specification. Your Amstrad will be running real TCP/IP over that link; to get to the outside world your Linux box will have to be setup to do packet routing and forwarding.

As I wrote, I have been running a peer-to-peer network between two dos-computers via a serial cable. I could never get pppd/epppd to work with the 'local' parameter, so I ended up using slipper/cslipper. I have the same problem today with pppd/epppd - it time out, but slipper seems to be working. The ping program run, but each packet sequenze timeout, so I guess the problem is the line and/or the linux part.
 
A USB to serial cable just gives you a serial port on the machine with the USB port. That serial port (with a normal cable) is expecting to talk to a peripheral like a modem or an older mouse, not another piece of intelligent equipment like a computer. Hence the need for the null modem cable, to cross the transmit and receive wires. (Standard serial cables do not cross the wires.)

What speed are you running the serial port at? At 9600 bps it takes about 1 millisecond to transfer a single byte. A small ping packet is around 64 bytes, so around 64 milliseconds. Most ping programs timeout after a second, so that is not going to be a problem. But at 2400 bps the problem gets four times worse. And there can be other delays. I remember when I was testing on a PCjr at 2400 bps I had to lengthen the ping timeout because of all of the overhead and the inherent speed of the slow serial port.

(I have it on my todo list to post my SLIP and PPP instructions for use with mTCP.)
 
On the dos box you use Molero's DOSPPPD which is the only version of pppd I know of for DOS. It's pretty straight forward, but ask me if you are stuck.

Hello again. I now have a null-modem cable, and I can log in to the linux computer with kermit. So, the cable should be okay. Now I would like to run a ftp-client, email, news, etc. I run this on the linux computer:

Code:
pppd -detach crtscts lock proxyarp 192.168.1.7:192.168.1.14 /dev/ttyUSB0 9600 &

and on the dos-computer I run:

Code:
epppd com1 9600 local

but after a short time, it return "PPP link is down, driver not installed". Is it because pppd on the linux-computer is not setup correct?

If I use slipper:

Code:
slipper com1 baud=9600 ether

it loads successfully. I set these variables:
Code:
set mtcpcfg=b:\tcp.cfg
set MTCPSLIP=true

and have these settings in tcp.cfg:

Code:
packetint 0X60
hostname ppc
IPADDR 192.168.1.14
NETMASK 255.255.255.0
GATEWAY 192.168.1.7
LEASE_TIME 86400

I can now run mTPC ping:
Code:
ping 192.168.1 7

but all 4 packages are lost (timeout).

I then booted up my old Thinkpad, with a genuine com-port, on a dos-floppy. To make a long story short, with slipper I could start up the mTCP ftpserver on one computer and access it from the other via the null-modem cable.

I then tried to run the ftpserver on the amstrad ppc, and access it from the linux-computer via usb2serial+null-modem cable, but that doesn't work. The linux ftp-client say: "ftp: connect: No route to host". Route to host... It seems like this code:

Code:
pppd -detach crtscts lock proxyarp 192.168.1.7:192.168.1.14 /dev/ttyUSB0 9600 &

is not good enough. So, cable is working, slipper is working, pppd on linux computer may need more parameters or something, and for some reasons epppd will not install ...

Any ideas?
 
Yes I am Danish. :) I came over her in 1957 but maintain much of my culture and language.

I'm sorry, it is late and I can't concentrate properly on what you did. It looks OK except that perhaps you didn't get what I said about wattcp. DOSPPPD is not an mTCP program. You can have the mTCP config in your environment, but to run dospppd you need to have a wattcp configuration file. Perhaps that is the problem you encountered. And, you can only run wattcp network utilities with wattcp. I highly recommend Mikes stack, especially because his FTP is by far the best, but it will not run with dospppd as far as I know and you will have to use the inferior (but functional) WFTP. I put what I think is the best version here for you: http://cgs.coalmont.net/ftp.exe

I'll look back here tomorrow night.
 
Yes I am Danish. :) I came over her in 1957 but maintain much of my culture and language.

I'm sorry, it is late and I can't concentrate properly on what you did. It looks OK except that perhaps you didn't get what I said about wattcp. DOSPPPD is not an mTCP program. You can have the mTCP config in your environment, but to run dospppd you need to have a wattcp configuration file. Perhaps that is the problem you encountered. And, you can only run wattcp network utilities with wattcp. I highly recommend Mikes stack, especially because his FTP is by far the best, but it will not run with dospppd as far as I know and you will have to use the inferior (but functional) WFTP. I put what I think is the best version here for you: http://cgs.coalmont.net/ftp.exe

I'll look back here tomorrow night.

Ole,

It's right in my setup instructions - I have tested with SLIPPR, CSLIPPR AND DOSPPP. If you use DOSPPP use the EPPPD program to emulate the Ethernet headers. I did not have a WATTCP configuration for any of this - everything for SLIP and PPP was configured on the command line.

Look at the section entitled SLIP and PPP Notes in the setup.txt file.
 
Lianergoist,

I don't have the machine with the EPPPD configuration on it, but I remember that I had to pass it additional parameters on the command line. The parameters were to define IP addresses at the end points instead of letting the two machines negotiate them.

Your ping command above is wrong, but I'm assuming it is a typo. Use something like "ping -timeout 4 192.168.1.7" to ping with a four second timeout.

If you can wait a few days I can recreate what I had and give you detailed instructions. For now work on SLIP, as that will get you started. You will need to adjust some routing table entries on the Linux box and enable packet routing to gain access to the outside world. Once you have SLIP running PPP is not much different.


Mike
 
PPP instructions for mTCP and Linux

PPP instructions for mTCP and Linux

Ok, enough playing around - here it is!


http://www.brutman.com/mTCP/ppp.txt


This is a first draft and it discusses PPP only. SLIP is similar and I'll add it later.



Mike
 
This is a first draft and it discusses PPP only. SLIP is similar and I'll add it later.

Wow, first class document! Thank you very much. I can see the ppp0 interface, but there's no IP attacted to it, and the ping from the dos computer timeout. I will try to figure out what's wrong in the weekend. But again, thank you very much. I think I should be able to get it working now. I will update you.
 
I'm sure that you will be able to get it going. It is always more difficult the first time around.

When you first start the ppp daemon under Linux you will not get an IP address shown in ifconfig. I think the DOS side has to make a successful connection first before the IP address will show up in ifconfig. My notes are wrong - I looked at ifconfig after the connect was made. I'll fix the notes.

If EPPPD loaded under DOS then you should see ifconfig updated with the IP address. If that is not happening, don't bother moving forward. You will also see connection messages for the PPP link in /var/log/messages when it happens.

The trickiest part is getting the addresses correct. Linux is smarter than my code so it doesn't try to apply a netmask to PPP traffic. My code applies a netmask to all traffic, so the netmask has to be valid. Which is where those rules come from. Those rules give you a block of addresses that represent the smallest possible network subnet.

It is possible to avoid that silliness by introducing another subnet, but that's the advanced topic I mentioned in the doc. It requires advanced routing because the addresses that most people would use are non-routable and require special handling if you have one going to another one.

Other than that thought the apps should run the same. I'm going to try a faster serial port; 9600 and even 2400 work, but 115,200 might be usable. ;-0


Mike
 
Ole,

It's right in my setup instructions - I have tested with SLIPPR, CSLIPPR AND DOSPPP. If you use DOSPPP use the EPPPD program to emulate the Ethernet headers. I did not have a WATTCP configuration for any of this - everything for SLIP and PPP was configured on the command line.

Look at the section entitled SLIP and PPP Notes in the setup.txt file.

Sorry, I should RTFM! I was making an assumption because I hadn't tested it. That's really great news because dosppp is such a valuable program.
 
UPDATE:

It's woking now. I have been around a lot of things, and I have learned a lot. To make a long story short, the problem seems to be pppd on Linux terminate before I get the dos-computer connected. The 'passive' option to pppd should prevent it, I think -

passive
Enables the "passive" option in the LCP. With this option, pppd
will attempt to initiate a connection; if no reply is received
from the peer, pppd will then just wait passively for a valid
LCP packet from the peer, instead of exiting, as it would with‐
out this option.​

but it doesn't. The option that makes it wait for the dos-computer to connect is 'silent'.

silent
With this option, pppd will not transmit LCP packets to initiate
a connection until a valid LCP packet is received from the peer
(as for the `passive' option with ancient versions of pppd).​

So, the command that works for me is:

Code:
sudo pppd ttyUSB0 9600 passive silent local lock mtu 576 192.168.1.17:192.168.1.18 netmask 255.255.255.0 proxyarp

but it may not be the best choice of options. But it works. I think I will try to make a script that run pppd when ttyUSB0 come up after I connect the usb-> serial cable, so I don't have to run the command manually every time. I will update you with what I come up with.

And finally, thanks to Ole and Michael for suggestions. And Michael, cool suite of programs you have made!
 
Nice to hear that you got it going. :)

The line I gave you works for me on two computers. One was just for testing and I can't remember what it is running, probably Debian, but the other is Ubuntu. Yes, there were some issues with timing, but I just solved it by hitting the enter button on one, or the other, or both, (I can't remember) at the right time. Next time I need it, I'll look at what you did and see if it does something useful for me. I'm wondering about why you were doing it as root though. Did it not work as a user?

Since I have such a bad memory, I had put this file in my home directory. You might find it useful too.

Code:
#!/bin/sh
# ppp.sh
clear

# pppd startup line "/home/ole/ppp.sh"
# for serial interface ppp0
# on ttyS0 IP 192.168.1.121
#
# Connected IP must be 192.168.1.120
#
#  8250  UART max   19200 baud
# 16450  UART max   50000 baud
# 16550a UART over 115200 baud
# Possible serial line rates for the 16550a:
#    * 110 bps
#    * 300 bps
#    * 1200 bps
#    * 2400 bps
#    * 4800 bps
#    * 9600 bps
#    * 19,200 bps
#    * 38,400 bps
#    * 57,600 bps
#    * 115,200 bps

# Speed set to 115200 below, change if needed for older UARTs
#
pppd -detach crtscts lock proxyarp 192.168.1.121:192.168.1.120  /dev/ttyS0 115200 &
 
Back
Top