Networking on QEMU: Setting Up The E1000 & Novell NE2000 ISA Evaluation

by Patrick G Horneker

(phorneker)

As we saw in the last article on QEMU, we can run FreeDOS in QEMU and configure QEMU to emulate some hardware components when running FreeDOS.  We already know how to transfer files between the QEMU disk image and PCLinuxOS by mounting the disk image.

We can already print from DOS applications by redirecting output to a disk file on PCLinuxOS.

Finally, we have created a shell script to start QEMU without having to type a list of configuration options, namely:

#!/bin/bash

qemu -fda floppies/blankfloppy.img -hda freedos.img -cdrom iso/fdsrc11.iso -boot c -m 32 -soundhw sb16 -serial /dev/ttyACM0 -parallel file:printer0.ps

To get the most out of QEMU, we need to configure the networking capabilities of QEMU.

The -device Option

QEMU will give you a list of all emulated hardware by typing qemu -device ? in a terminal window, and get the following:

[patrick@localhost ~]$ qemu -device ?

Could not initialize KVM, will disable KVM support

name "virtio-9p-pci", bus PCI

name "virtio-balloon-pci", bus PCI

name "virtio-serial-pci", bus PCI, alias "virtio-serial"

name "virtio-net-pci", bus PCI

name "virtio-blk-pci", bus PCI, alias "virtio-blk"

name "smbus-eeprom", bus I2C

name "scsi-disk", bus SCSI, desc "virtual scsi disk or cdrom"

name "scsi-generic", bus SCSI, desc "pass through generic scsi device (/dev/sg*)"

name "usb-hub", bus USB

name "usb-host", bus USB

name "usb-kbd", bus USB

name "usb-mouse", bus USB

name "usb-tablet", bus USB

name "usb-storage", bus USB

name "usb-wacom-tablet", bus USB, desc "QEMU PenPartner Tablet"

name "usb-braille", bus USB

name "usb-serial", bus USB

name "usb-net", bus USB

name "usb-bt-dongle", bus USB

name "virtconsole", bus virtio-serial-bus

name "virtserialport", bus virtio-serial-bus

name "ioh3420", bus PCI, desc "Intel IOH device id 3420 PCIE Root Port"

name "x3130-upstream", bus PCI, desc "TI X3130 Upstream Port of PCI Express Switch"

name "xio3130-downstream", bus PCI, desc "TI X3130 Downstream Port of PCI Express Switch"

name "isa-serial", bus ISA

name "isa-parallel", bus ISA

name "vt82c686b-usb-uhci", bus PCI

name "piix4-usb-uhci", bus PCI

name "piix3-usb-uhci", bus PCI

name "sysbus-ohci", bus System, desc "OHCI USB Controller"

name "pci-ohci", bus PCI, desc "Apple USB Controller"

name "SUNW,fdtwo", bus System

name "sysbus-fdc", bus System

name "i6300esb", bus PCI

name "ne2k_pci", bus PCI

name "i82801", bus PCI, desc "Intel i82801 Ethernet"

name "i82562", bus PCI, desc "Intel i82562 Ethernet"

name "i82559er", bus PCI, desc "Intel i82559ER Ethernet"

name "i82559c", bus PCI, desc "Intel i82559C Ethernet"

name "i82559b", bus PCI, desc "Intel i82559B Ethernet"

name "i82559a", bus PCI, desc "Intel i82559A Ethernet"

name "i82558b", bus PCI, desc "Intel i82558B Ethernet"

name "i82558a", bus PCI, desc "Intel i82558A Ethernet"

name "i82557c", bus PCI, desc "Intel i82557C Ethernet"

name "i82557b", bus PCI, desc "Intel i82557B Ethernet"

name "i82557a", bus PCI, desc "Intel i82557A Ethernet"

name "i82551", bus PCI, desc "Intel i82551 Ethernet"

name "i82550", bus PCI, desc "Intel i82550 Ethernet"

name "pcnet", bus PCI

name "e1000", bus PCI, desc "Intel Gigabit Ethernet"

name "rtl8139", bus PCI

name "ne2k_isa", bus ISA

name "ide-drive", bus IDE

name "isa-ide", bus ISA

name "ich9-ahci", bus PCI, alias "ahci"

name "lsi53c895a", bus PCI, alias "lsi"

name "VGA", bus PCI

name "vmware-svga", bus PCI

name "sb16", bus ISA, desc "Creative Sound Blaster 16"

name "ES1370", bus PCI, desc "ENSONIQ AudioPCI ES1370"

name "AC97", bus PCI, desc "Intel 82801AA AC97 Audio"

name "intel-hda", bus PCI, desc "Intel HD Audio Controller"

name "hda-duplex", bus HDA, desc "HDA Audio Codec, duplex"

name "hda-output", bus HDA, desc "HDA Audio Codec, output-only"

name "cirrus-vga", bus PCI, desc "Cirrus CLGD 54xx VGA"

name "isa-applesmc", bus ISA

name "ib700", bus ISA

name "isa-debugcon", bus ISA

name "testdev", bus ISA

As we can see here, QEMU provides a lot of hardware options, many of which we already discussed, and some of these are not relevant to FreeDOS (because some devices shown here were never supported by any version of DOS).

Network Adapters Emulated by QEMU

Let us open a terminal window.  We can find out which network adapters QEMU can emulate when running as an x86 machine.  We could type qemu -net nic,model=? and get a list of supported network adapters, but the developers of QEMU deprecated the -net option.  We can use it now, but it may no longer work in a future version of QEMU.

As we saw in the above listing, QEMU supports the following network adapters, with the QEMU device name in bold:

  1. Novell NE2000 PCI (ne2k_pci)
  2. Novell NE2000 ISA (ne2k_isa)
  3. Realtek 8139 (rtl8139)
  4. AMD PCFastIII (pcnet)
  5. Intel E-1000 (e1000, This is the QEMU default)
  6. Intel i82801 (i82801)
  7. Intel i82562 (i82562)
  8. Intel i82559a (i82559a)
  9. Intel i82559c (i82559b)
  10. Intel i82559c (i82559c)
  11. Intel i82559er (i82559er)
  12. Intel i82558a (i82558a)
  13. Intel i82558b (i82558b)
  14. Intel i82557a (i82557a)
  15. Intel i82557b (i82557b)
  16. Intel i82557c (i82557c)
  17. Intel i82550 (i82550)
  18. Intel i82551 (i82551)

Only the ne2k_isa is an emulated ISA adapter.  All other adapters are for the emulated PCI bus, so we need to keep this in mind when finding DOS drivers for these adapters.

Where to get DOS drivers:

Crynwr Software (http://www.crynwr.com/drivers/) provides DOS drivers for some of these devices.  The file 00index.html contains descriptions of each of the driver files available for download.  A file called many-other-drivers.zip contains a driver for the NE2000 adapters.

In the last article, I showed you how to mount the QEMU disk image.  After downloading the driver files, you will need to mount the disk image (to /mnt/freedos) and transfer the downloaded files so FreeDOS can use them.

Georg Potthast has a collection of packet drivers that can be used on FreeDOS.  There are drivers for the Realtek 8139, the Novell NE2000 and the Intel e1000.  It would also be a good idea to download NICSCAN.EXE so FreeDOS can detect the emulated network card.

Note:  AMD’s PCFastIII requires a driver for the AMD 79C973 chipset.  This is not the same as the 79C970, which is in the PCFastII, an ISA based network adapter.

Intel has a downloadable DOS driver for the E1000 on their website.  On that page, you want to click on PRODOS.EXE, then click on Download from the next page that appears.  Agree to the license, and then download the file.  If you are using Firefox, be sure to choose Save File when the dialog box appears asking you what to do with the file.

Let’s Get a TCP/IP Driver for FreeDOS

Besides the network driver, we will need to get a TCP/IP driver for FreeDOS.  There is a 16-bit TCP/IP stack Novell developed for its Netware products that allows ODI drivers to use TCP/IP.  It can be downloaded from bbs.actapricot.org.

Now Let’s Get The Driver into FreeDOS

There are two ways to get the driver file into FreeDOS.  If you have a floppy drive on your system, you may write that file to the floppy, then use that floppy when running FreeDOS.

If no floppy drive is present, we can mount the QEMU disk image to PCLinuxOS and transfer the network driver file to drive C: on the disk image.

For this disk image, we shall use the QEMU default, an emulated Intel Pro E1000 adapter.  Open a terminal, login as root,and type in the following:

mkdir -p /mnt/freedos

mount -o loop,offset=32256 /home/patrick/vm/freedos.img /mnt/freedos
cp /home/patrick/Downloads/PRODOS.EXE
 /mnt/freedos

cp /home/patrick/Downloads/tcp16.exe /mnt/freedos
umount /mnt/freedos

Of course, your home directory will differ from the example.  Now, when we launch QEMU, the driver file will be in drive C:, which is where we will be after FreeDOS boots.

If you choose the many-other-drivers.zip then you would emulate a Novell NE2000 ISA adapter.  In this case, we would type this:

mkdir -p /mnt/freedos

mount -o loop,offset=32256 /home/patrick/vm/freedos.img /mnt/freedos
cp /home/patrick/Downloads/many-other-drivers.zip
 /mnt/freedos

umount /mnt/freedos

Edit ~/bin/freedos

Let us now open the freedos file we created from the last article.  We will need to add some parameters to add network support to our QEMU session.

#!/bin/bash

qemu -fda floppies/blankfloppy.img -hda freedos.img -cdrom iso/fdsrc11.iso -boot c -m 32 -soundhw sb16 -serial /dev/ttyACM0 -parallel file:printer0.ps

For the emulated Intel E1000 adapter, we need to add the following:

-netdev user,id=usernet -device e1000,netdev=usernet

This is inserted into the file after the -soundhw and before the -serial and/or -parallel parameters.  Hence, our file should read as follows:

#!/bin/bash

qemu -fda floppies/blankfloppy.img -hda freedos.img -cdrom iso/fdsrc11.iso -boot c -m 32 -soundhw sb16 -netdev user,id=usernet -device e1000,netdev=usernet -serial /dev/ttyACM0 -parallel file:printer0.ps

If you plan to emulate a Novell NE2000 ISA board, we need to add the following:

-netdev user,id=usernet -device ne2k_isa,irq=5,netdev=usernet

Our file should then read as follows:

#!/bin/bash

qemu -fda floppies/blankfloppy.img -hda freedos.img -cdrom iso/fdsrc11.iso -boot c -m 32 -soundhw sb16 -netdev user,id=usernet -device ne2k_isa,irq=5,netdev=usernet -serial /dev/ttyACM0 -parallel file:printer0.ps

Save the file and run freedos.  When FreeDOS starts up, type dir to verify that the driver has been transferred to the disk image.

Success.  The file called PRODOS.EXE contains the driver files for the E1000 network card.

Now, let us create a directory to unpack the executable.  For this article, let us call this directory E1000 for the name of the emulated network card.

So, we type the following lines:

mkdir e1000

copy prodos.exe e1000

cd e1000

...and we should see the following:

Though PRODOS.EXE is a self extracting file, it cannot be extracted from within FreeDOS.  This file was intended to be self extracted from Windows.  Fortunately, this file will extract with unzip.

Hence, we will need to type in unzip prodos.exe.  We get the following:

The file we want is called e1000odi.com and it is located in C:\E1000\PRO1000\DOS.  Also, there is a file called readme.txt.  Let us read this file using EDIT.

Answer Yes to this question as it is typical in DOS text files for an indent to be equivalent to eight spaces.

This file is a set of release notes for the driver intended to be used on Windows and OS/2.  Scrolling down this list reveals a list of supported network adapters.

Notice that this driver set also supports the i82562 device, not just the e1000, so we could substitute i82562 for e1000 in the QEMU parameters for networking.

...and here are the release notes for using the i82562 device with the e1000 drivers.

We can also use any of the i82598 and i82599 devices mentioned earlier as well.  Here are the notes regarding the use of these devices.

Select File, then Exit to exit the editor.  Now type cd pro1000\dos to get to the directory where the driver is located.

Type e1000odi, then type lsl.  The network driver will load.

The second command (lsl) verifies that the driver has been loaded.  Let us take a look at net.cfg in this directory.

We just got the emulated Intel E1000 working.  Now, how do we get the driver to load when we start FreeDOS?  By editing C:\AUTOEXEC.BAT.

Type the following:

cd c:\

edit autoexec.bat

Now we scroll through this file.

Scrolling to the end of the file shows the following:

Now, we need to find a spot to insert the command to load the e1000 driver.  We scroll back to the beginning of the file.  A good place to insert the command is after the LH DOSLFN command as highlighted below:

Place the cursor after the highlighted line, and press Return to insert a blank line below.  Now type C:\E1000\PRO1000\DOS\E1000ODI and save the file.  Select File, then select Save (or simply press Control-S) to save AUTOEXEC.BAT.

Now exit the editor.  We now have the E1000 driver configured for FreeDOS.  Next, type cp tcp16.exe c:\e1000 to get the TCP/IP driver into the directory where the E1000 driver has been installed.

Besides the Novell client, Microsoft has a DOS Client available for download that provides TCP/IP as well as the NetBEUI service.

If you choose to use many-other-drivers.zip

An alternate configuration for QEMU is to configure networking to emulate a Novell NE2000 (the ne2k_pci and ne2k_isa devices).  If you do this, you will not need the Novell TCP/IP packet driver as many-other-drivers.zip contains TCP/IP built in to the driver.

The many-other-drivers.zip appears here as MANY-O~1.ZIP.  This is due to the limitations of the FAT16 filesystem, which does not support long filenames when running DOS.  Create a directory called CRYNWR to store the drivers for this file.  Copy MANY-O~1.ZIP to CRYNWR.  Then CD CRYNWR and then UNZIP MANY-O~1.ZIP to unpack the files.

To activate the TCP/IP Driver, type:

ne2000 0x60 0x05 0x300

and you should have a working TCP/IP connection with a MAC address.  The first parameter should be a hexadecimal value from 0x60 through 0x66, 0x68 through 0x6F, or 0x78 through 0x7E.  These are interrupt vectors available to network cards running under DOS.

The second parameter is the Interrupt Request (IRQ) for the network card itself.  I recommend 0x05 for this to work under QEMU as we specified this in the freedos batch file.

The third parameter is the I/O address assigned to the network card.  For QEMU, this is 0x300.  We can change this in the freedos batch file by adding the io= parameter to the -device parameter we specified for the network card.

We need to edit AUTOEXEC.BAT so it reads as follows:

Reboot FreeDOS, and we should get a working TCP/IP connection.

The presence of NE2000 in the modules list indicates that the packet driver is available and working.

If you want DHCP service, type DHCP to get an IP address.  By default, QEMU uses a bridged network, that is, QEMU shares the same Internet connection with the PCLinuxOS host.  This may or may not be what you want.

Here, FreeDOS is sharing the Internet connection with PCLinuxOS.

Other Packages Required on the PCLinuxOS Side

Besides the QEMU packages, qemu and qemu-tools, there are some other packages that need to be installed from Synaptic on PCLinuxOS.

ipxutils:  This is used to configure IPX interfaces on PCLinuxOS (especially if you plan to use ODI drivers in QEMU).

libncpfs:  This library handles Novell Netware filesystems on PCLinuxOS.

vde:  This is Virtual Distributed Ethernet, the mechanism that makes communication between actual PCLinuxOS machines and virtual machines (such as QEMU and VirtualBox) possible.

Also, if you are planning to use NetBEUI, you will need at least the samba packages.  The easiest way to accomplish this is to install the task-samba metapackage in Synaptic.

As for the Microsoft client, that client is no longer publicly available.