Using mTCP in Virtual
Environments
mTCP meets DOSBox, VirtualBox and VMWare!
A few years ago if you wanted to run DOS on a machine you either had to
have an old machine to run it on or hope that your new machine was not
too advanced for a 20 year old operating system. Emulated and virtual
machines like DOSBox, VirtualBox, and VMWare breathe new life into DOS
and other obsolete operating systems by letting you run your DOS
applications side by side with your current applications on the latest
and greatest hardware.
The following are some quick notes on three emulation and virutal
machine environments that I have used. I expect others to be similar.
DOSBox
DOSBox is an x86 PC emulator designed to run old DOS games on modern
hardware running modern operating systems. While Windows XP has a
DOS-like command line it is not sufficient to run many old games. This
is where DOSBox takes over and shines.
While relatively full featured, DOSBox is not a full machine emulator.
DOS is emulated just enough to make the old games run. The command
prompt recognizes a few major commands; you may need to add more from
your favorite DOS version. DOSBox can be configured to share part of
the host operating system filesystem so that moving files in and out is
not
too hard.
By default there is no
networking support. To get an emulated network device you
need to
use a special build of DOSBox created by "HAL9000". The HAL9000
"megabuilds" add NE2000 emulation allowing networking applications to
run, plus a few other goodies. When using the NE2000 emulation DOSBox
will appear to be
physically connected to the network. (This is commonly known as
"bridged" mode.) I have been using the megabuilds for over two years
now and I am very pleased with their quality.
I do most of my functional testing with DOSBox so I know that it works
well
with mTCP. The biggest function missing from DOSBox is proper
Ctrl-Break and Ctrl-C handling. mTCP lets you break out of some long
running applications using Ctrl-Break and Ctrl-C so under DOSBox that
feature might not work. But for the most part DOSBox is a great way to
run mTCP.
VirtualBox
VirtualBox is an open source program that creates a virtual x86 machine
within your
host operating system. You define the amount of memory, the size of the
virtual hard drive, the amount of video memory, networking support, and
a few other attributes to create a virtual machine. Then you boot the
virtual machine and install DOS on it, just like you would do on a bare
machine that you are installing for the first time. The virtual machine
emulation takes advantage of modern CPU features making it extremely
fast - almost as fast as running directly on the hardware without the
host operating system in the way. Virtual machines slow down when doing
I/O operations but it is not enough to worry about.
VirtualBox has a variety of network cards that it can emulate
and it can make your virtual machine look like it is directly on the
network ("bridged"), behind a firewall ("NAT", or Network Address
Translation), and a few other options. I use "bridged" mode and the AMD
PCNet device, which
is the same device used by VMWare Player. If you use a different
emulated device be sure to find the correct
packet driver for it.
All of the mTCP applications run well except for PING, which runs but
seems to suffer from a timing problem. I reprogram the interval timer
to get higher resolution timings than are normally possible on DOS and
it looks as though PING is tripping on this. It will eventually
complete but it takes much longer between ping packets than it should.
(The packet timings are accurate, but the wait time between packets is
too long.)
FreeDOS and VirtualBox
Interested in getting started quickly with FreeDOS and Networking?
Ulrich Hansen put together a virtual machine and disk image that
includes FreeDOS, mTCP, and a wide variety of TCP/IP programs
and utilities from other authors. This gives you a quick way to sample
the applications without installing everything by hand.
Ulrich's FreeDOS Networking sampler can be found at: http://lazybrowndog.net/freedos/virtualbox/
VMWare Player
VMWare Player is a closed source (but free) virtual x86
machine that is very similar in operation to VirtualBox.
(VMWare predates VirtualBox by quite a bit.) You define your
virtual machine, install DOS, and then run it side by side with your
host operating system.
The networking works basically the same way as it does in VirtualBox -
"bridged" makes your
virtual machine look like it is directly connected to the LAN. "NAT"
(Network Address Translation) makes it look like your virtual machine
is hiding behind a firewall on your host operating system. "Host-only"
is the most limited, and it allows you to communicate only with the
host operating system. VMWare emulates some form of AMD
PCNet Ethernet device.
I am using version 3.1.3 on Windows XP. Everything works perfectly,
including PING, so VMWare Player probably does a better job of
emulating the PC timer hardware that I am reprogramming.
Created March 10th, 2011, Last updated July 29th, 2011
(C)opyright Michael B. Brutman, mbbrutman@gmail.com