Networking with SIMH (or QEMU) using TUN/TAP

I use the SIMH simulator to allow me to run VAX/VMS on my linux desktop using an OpenVMS Hobbyist license. Compiling simh and getting a simulated MicroVAX II running on my Raspberry Pi was relatively easy.

However, I needed some help from the folks on the Raspberry Pi forums to get it connected to the network, but once that was sorted out it worked very nicely and I had no issues connecting between machines using either DeCNET or LAT.

Running one virtual VAX on my Raspberry Pi was quite cool, but what I really wanted to do was to be able to network multiple virtual VAXen on my desktop – and I have now have finally figured out how to do it.

Note – Since SIMH and QEMU both allow you to use tap devices this solution should work for both.

To install the additional packages required you need to be logged in as root.

$ su
Password: 

OR

$ sudo -i
Password:

Installing required packages

The additional packages we need are the same as those needed on the Raspberry Pi, with the addition of libpcap-dev which is used by simh (and needed to compile it from source).

# apt-get install libpcap-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libpcap0.8 libpcap0.8-dev
The following NEW packages will be installed:
  libpcap-dev libpcap0.8 libpcap0.8-dev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 418 kB of archives.
After this operation, 924 kB of additional disk space will be used.
  :
  :
  :
Setting up libpcap-dev (1.3.0-1) ...
# apt-get install bridge-utils
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  bridge-utils
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 35.5 kB of archives.
After this operation, 145 kB of additional disk space will be used.
  :
  :
  :
Setting up bridge-utils (1.5-6) ...
# apt-get install uml-utilities --no-install-recommends
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  user-mode-linux
The following NEW packages will be installed:
  uml-utilities
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 64.0 kB of archives.
After this operation, 234 kB of additional disk space will be used.
  :
  :
  :
Setting up uml-utilities (20070815-1.3) ...
[ ok ] Starting User-mode networking switch: uml_switch.
# 

Configuring the network

To allow the virtual machines to connect to the physical network we need to create an ethernet bridge (br0) to allow the linux host to connect to the physical interface (eth0), and a separate TUN/TAP network interfaces for each virtual machine (tap0, tap1), bridging these to the physical interface allows each virtual machine to connect to the network. The key to getting this to work was realizing that the ethernet bridge could bridge more than just two interfaces.

Note – You will need to substitute the username of the user that will be running simh for <username> .

# vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp

auto eth0
iface eth0 inet manual

# Virtual interface
auto tap0
iface tap0 inet manual
   pre-up tunctl -t tap0 -u <username>
   up ifconfig tap0 up
   down ifconfig tap0 down

# Virtual interface
auto tap1
iface tap1 inet manual
   pre-up tunctl -t tap1 -u <username>
   up ifconfig tap1 up
   down ifconfig tap1 down

# Bridge interface 
auto br0
iface br0 inet static
   address 192.168.0.1
   netmask 255.255.255.0
   network 192.168.0.0
   broadcast 192.168.0.255
   gateway 192.168.0.254
   bridge_ports eth0 tap0 tap1
   bridge_stp off
   bridge_maxwait 5

Starting simh

When starting the simulator you will need to specify the MAC address and then connect the emulated network interface to the appropriate TUN/TAP network interface.

$ ./microvax2
MicroVAX II (KA630) simulator V4.0-0 Beta
sim> load -r ka630.bin
sim> attach nvr nvram.bin
sim> set xq mac=AA-00-04-00-26-40
sim> attach xq tap:tap<n>
sim> set rq0 rd54
sim> attach rq0 system.dsk
sim> set cpu conhalt
sim> set console notelnet, wru=10
sim> set cpu autoboot
sim> set cpu idle=vms
sim> set cpu 16m
sim> boot cpu 

KA630-A.V1.3

Performing normal system tests.

  5..4..3..

Tests completed.


>>>

Now all I have to do is remember how to build a Local Area VAX Cluster, with multiple satellite nodes booting of a VAX server (actually I want to build a mixed LAVC with multiple versions of VMS running from multiple system disks!) – that should keep me busy for a while.


Raspberry Pi is a trademark of the Raspberry Pi Foundation

Advertisements
This entry was posted in Debian, Linux, Networking, VMS and tagged , , , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s