February 4, 2021

FreeDOS and mTCP

I once again have occasion to use my FreeDOS machine and am facing the issue of getting files in and out of that computer. I no longer have any floppy drives. There is no USB support in FreeDOS. The ssh protocol networking in FreeDOS no longer works as the key exchange mechanism it uses is rejected by sshd on my linux server. The only method I have right now is to burn files to a CDROM and take them to my FreeDOS machine, and that only works in one direction.

I just discovered mTCP. It includes an FTP client, which would certainly solve my problems. Setting up an FTP server on my linux machine is trivial, it just involves installing a package and starting the service.

I will download the current (March 7, 2020) version, which is a 630K zip file. There is also a 141 page PDF document (see link above to my copy). I download both and burn them onto a CD (It has been a long time since I have done this!).

On my FreeDOS machine

Into my ancient CD drive goes the disk. I have to manually open and close the CD drawer. But I type "dir d:" and it sees the files!!
cd new
copy d:*.zip mtcp.zip
And I have the files on my FreeDOS hard drive! I unpack them as follows:
cd \
mkdir mtcp
cd mtcp
unzip \new\mtcp.zip
Now it is a matter of following setup instructions. I need an interrupt number for my network packet driver, so I reboot to watch the boot messages. Actually a look at my autoexec.bat file tells me it is 0x60.

Setup under FreeDOS

The first thing is to create a config file with a single line as follows:
PACKETINT 0x60
I make this the file \mtcp\myconfig.txt using the vi editor.

I add this line to my autoexec.bat file and I reboot.

set MTCPCFG=C:\MTCP\MYCONFIG.TXT
Rebooting displays my MAC address. My machine is using a board with the DEC DC21041 "Tulip" chip, which is a decent 10/100 ethernet chip from the good old days.

I was going to go edit files on my linux machine to set up a fixed DHCP, but I decided "why bother". I can just run DHCP on the FreeDOS machine and let it get a dynamic assignment from my pool. And indeed this works:

cd mtcp
dhcp
I type "ftp 192.168.0.5" and it works! I do need to type my username and password. I also need to shut down the firewall on my linux box (or open up the proper ports for FTP).

The documentation is very good and says that you can set up a static configuration by adding lines to the configuration file like so:

PACKETINT 0x60
IPADDR 192.168.1.10
NETMASK 255.255.255.0
GATEWAY 192.168.1.1
NAMESERVER 192.168.1.1
The document also says that you will need to delete some lines that the DHCP command adds to this file if you have ever used DHCP.

I edit autoexec.bat to add c:\mtcp to my path and this all looks good.

Minor issues

I do have to use IP numbers for machines on my local network (which are the only machines I actually want to work with). DNS works just fine, but none of my "at home" machines have DNS entries anywhere. This is mildly inconvenient.

I also need to set up the firewall ports for FTP on my linux machine. This is not an mTCP issue by any means. I open up ports 20 and 21 for FTP, but now the issue of active and passive FTP arises. Apparently passive (which is what mTCP uses as the default), will try to negotiate some other port rather than using 20. But how am I to know what this port will be so as to open it on my firewall? So I would rather just use the old active scheme and stick with port 20. Apparently there are configuration parameters to vsftpd that I can set to specify which passive ports will be used and then I can open up this range on my firewall. Details elsewhere.


Have any comments? Questions? Drop me a line!

Adventures in Computing / [email protected]