Menu:

Monday, July 28, 2003

SIMH networking

This article is also available in the retrocomputing wiki.

SIMH is a highly portable, multi-system simulator. While many of the emulated systems are of historical and educational interest only, the Vax emulator will successfully run modern versions of OpenVMS, up to and including OpenVMS Vax 7.3. The current releases of SIMH also emulate network devices for the PDP-11 and Vax architectures, thus allowing certain operating systems running on emulated hardware to be fully networked. This is of particular interest with regards to OpenVMS.

The current SIMH network driver uses the pcap library. While this solution is portable between many flavors of Unix as well as Windows, it has two serious drawbacks. First, pcap incurs a serious performance impact on the host’s network interface, so much so that a dedicated physical network interface is advisable if both host and SIMH require even moderate amounts of network bandwidth. Second, owing to the nature of the pcap interface the SIMH guest cannot communicate with the host it is running on.

A better solution for Linux, Solaris, and FreeBSD at least would be to rewrite the SIMH network emulation to use the tun/tap driver, which provides a virtual network interface akin to the loopback. Until such time, however, a work-around exists for Linux.

The core of the solution is a utility, taptap, as provided by Hans Rosenfeld (rosenfeld AT grumpf DOT hope-2000 DOT org). Taptap creates a pair of tun/tap interfaces and essentially bridges packets between them. Since SIMH doesn’t use the host’s physical network interface, it won’t affect its performance. The host and SIMH still can’t communicate on a single tun/tap interface, but by virtue of bridging between a pair of them this restriction is also lifted. A sample setup is outlined below the fold:

+----------------------------+
          | 
HOST                       LAN network:   1.0.0.0/8
          
|                            | host eth0 IP:  1.1.1.1
LAN 
<-------> eth0  1.1.1.1            |
1.0.0.0/|                            | bridged network2.0.0.0/8
          
|   tun0 2.1.1.1             host tun0 IP:  2.1.1.1
          
|     ^                      | SIMH tun1 IP:  2.2.2.2
          
|     |                      |
          |  (
taptap)    +-----------+ |
          |  
2.0.0.0/8   SIMH      | |
          |     |        |           | |
          |     
v        2.2.2.2   | |
          |   
tun1 <-------> xq0     | |
          |              |           | |
          |              +-----------+ |
          +----------------------------+

The host has one physical interface, eth0, which is optional in this configuration. Taptap creates tun0 and tun1 and bridges between them. All the network and IP numbers are indicated in the graphic above.

If the SIMH guest needs routing beyond the host, a number of alternatives are feasible, like running dynamic routing on the network, static routing, or possibly even NAT.

A sample manual startup procedure to run OpenVMS VAX in SIMH is described below. For the sake of simplicity, it is assumed that it is performed as the root user.

It is prerequisite that the running Linux kernel supports tun/tap, either compiled in or as a loadable kernel module. It may be necessary to create the device file, typically /dev/net/tun.

# mkdir /dev/net
# chmod 755 /dev/net
# mknod -m 660 /dev/net/tun c 10 200

The tun/tap kernel module can be manually loaded with the command line below

# insmod tun

or automatically by

# echo “alias char-major-10-200 tun” >> /etc/modules.conf
# depmod -a

SIMH attaches to tun1 by running the following commands either from a startup file or the command line:

set xq mac=08-00-2B-C0-FF-EE
attach xq0 tun1

The actual startup assumes that taptap and the vax binary are located in the current directory and that the SIMH configuration is stored in the file openvms.rc.

# ./taptap &
# ifconfig tun1 up
# ifconfig tun0 2.2.2.2 netmask 255.255.255.0 up
# ./vax openvms.rc

If it is desirable to have SIMH use an IP number from the network on the LAN, the following trick will work (credit to Hans Rosenfeld):

+-----------------------------+
          | 
HOST                        |
          |                             | 
LAN network1.0.0.0/8
          
|   +------+                  |
LAN <-------> | eth0 br0              host IP1.1.1.1
1.0.0.0
/|   |      | 1.1.1.1          SIMH IP1.2.2.2
          
|   | tun0 |                  |
          |   |   ^  |                  |
          |   +-- |--+                  |
          |       |                     |
          |    (
taptap)   +-----------+ |
          |    
2.0.0.0/8  SIMH      | |
          |       |       |           | |
          |       
v       1.2.2.2   | |
          |     
tun1 <------> xq0     | |
          |               +-----------+ |
          +-----------------------------+

In principle, in this setup the host’s eth0 interface is superceded with a single-port bridge, i.e. eth0 is the only constituent port. After taptap starts, tun0 is added to the bridge. The initial bridge can be set up with the commands below. It is possible to modify the system startup files to perform this at boot time, but the details differ too much between Linux distributions to cover it
here.

# ifconfig eth0 0.0.0.0 up
# brctl addbr br0
# brctl addif br0 eth0
# brctl stp br0 off
# ifconfig br0 1.1.1.1 netmask 255.0.0.0 up

SIMH would be started like this:

# ./taptap &
# ifconfig tun1 up
# ifconfig tun0 up
# brctl addif br0 tun0
# ./vax openvms.rc

A similar setup should work for the KLH10 emulator running TOPS20 or ITS.

Posted by markus in • Retrocomputing
(0) CommentsPermalink

Next entry: How to Survive a Bad Hosting Provider and Preserve Your Sanity

Previous entry: RAID conversion

Comments


Add a comment

Name:

Email:

Location:

URL:

Smileys

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below: