[Simh] SIMH VAX on Mac OS with networking
Van Overbeek, Ton
tvoverbeek at hst.nasa.gov
Fri Aug 20 15:07:26 EDT 2010
I finally got the networking on my SIMH VAX working again under
Snow-Leopard.
See my earlier post today on the SIMH mailing list.
This post details my setup and it may be of use if you are in a similar
situation.
For my VAX I do not need external network access. I only need to be able
to
telnet and ftp to SIMH from the Mac side in order to get data in and
out.
I use two tap interfaces: tap0 is connected to the mac with ip
192.168.2.1 and
tap1 is connected to simh.
My simh vax is running vms 7.3 with dec tcpip (formerly ucx) networking
with a static ip of 192.168.2.2 and a static default route to
192.168.2.1.
The two tap interfaces are connected back to back (forming a tunnel)
using
a small program taptap.c.
The idea came from
http://www.retrocomputinggeek.com/retrowiki/SIMHNetworking/.
(Originally I was running simh on Windows XP and winpcap provided the
tunnel,
no need for taptap).
The source for taptap.c is below:
------------------------------------------------------------------------
--------
/* taptap - link two /dev/net/tun to form virtual ethernet
Copyright (c) 2003, Hans Rosenfeld
Permission is hereby granted, free of charge, to any person obtaining
a
copy of this software and associated documentation files (the
"Software"),
to deal in the Software without restriction, including without
limitation
the rights to use, copy, modify, merge, publish, distribute,
sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL
HANS ROSENFELD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Except as contained in this notice, the name of Hans Rosenfeld shall
not
be used in advertising or otherwise to promote the sale, use or other
dealings
in this Software without prior written authorization from Hans
Rosenfeld.
(This Copyright notice / Disclaimer was copied from SIMH (c) Robert M
Supnik)
*/
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int dev1,dev2,cnt;
unsigned char buf[1518];
if( ((dev1 = open("/dev/tap0", O_RDWR)) < 0) ||
((dev2 = open("/dev/tap1", O_RDWR)) < 0) ) {
perror("open()");
exit(1);
}
if(fork())
while(1) {
cnt=read(dev1,(void*)&buf,1518);
if (cnt > 0) {
write(dev2,(void*)&buf,cnt);
}
}
else
while(1) {
cnt=read(dev2,(void*)&buf,1518);
if (cnt > 0) {
write(dev1,(void*)&buf,cnt);
}
}
}
------------------------------------------------------------------------
--------
Here is my bash script to start the VAX:
------------------------------------------------------------------------
--------
#!/bin/bash
#
# shell script to start the vax emulator with host networking
#
TVOVAXROOT=/Users/tvoverbeek/Documents/SOHO/OBSW/VAX-Sim-Mac
#
# 1. Start our tap0-tap1 bridge
$TVOVAXROOT/TapTap/taptap &
# Give taptap some time to create the tap0 and tap1 interfaces
sleep 1
# tap1 side is used by the vax (Vax will use 192.168.2.2)
ifconfig tap1 up
# tap0 is the mac os-x side
ifconfig tap0 192.168.2.1 netmask 255.255.255.0 up
# Start console
xterm -132 -title "VAX Console" -e "sleep 2 && telnet localhost 5678" &
# Start a terminal session
xterm -geometry 80x48-1273-186 -132 -bg lightyellow -fn 8x13 -title "VAX
terminal" -e "sleep 6 && telnet localhost 5679" &
# Start the emulator
(cd $TVOVAXROOT/tvovax; ./vax)
# Kill our bridge and bring tap0 and tap1 down.
killall taptap
------------------------------------------------------------------------
--------
The relevant lines from vax.ini:
------------------------------------------------------------------------
--------
.....
; Telnet Console
set console telnet=5678
;
; Attach terminal multiplexer
set vh dhu
set vh fastdma
attach vh 5679
;
; Attach ethernet adapter to TAP device
attach xq tap1
.....
------------------------------------------------------------------------
--------
and finally the output from netstat -i and netstat -r with simh running:
------------------------------------------------------------------------
--------
HPM-AVANOVER-MCBKPRO:VAX-Sim-Mac tvoverbeek$ netstat -i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
Coll
lo0 16384 <Link#1> 171520 0 171520 0
0
lo0 16384 localhost ::1 171520 - 171520 -
-
lo0 16384 localhost fe80:1::1 171520 - 171520 -
-
lo0 16384 127 localhost 171520 - 171520 -
-
gif0* 1280 <Link#2> 0 0 0 0
0
stf0* 1280 <Link#3> 0 0 0 0
0
en0 1500 <Link#4> 00:23:df:94:8f:0e 0 0 0 0
0
en1 1500 <Link#5> 00:25:00:3e:77:6e 3806767 0 5594092 0
0
en1 1500 hpm-avanove fe80:5::225:ff:fe 3806767 - 5594092 -
-
en1 1500 10.0.1/24 10.0.1.4 3806767 - 5594092 -
-
fw0* 4078 <Link#6> 00:23:df:ff:fe:94:8f:0e 0 0 0
0 0
vmnet 1500 <Link#7> 00:50:56:c0:00:01 0 0 0 0
0
vmnet 1500 192.168.7 192.168.7.1 0 - 0 -
-
vmnet 1500 <Link#8> 00:50:56:c0:00:08 0 0 0 0
0
vmnet 1500 192.168.156 192.168.156.1 0 - 0 -
-
tap0 1500 <Link#9> 72:28:56:bf:6c:f0 208 0 360 0
0 <-----
tap0 1500 192.168.2 192.168.2.1 208 - 360 -
- <-----
tap1 1500 <Link#10> c6:dc:da:05:7c:83 360 0 208 0
0 <-----
HPM-AVANOVER-MCBKPRO:VAX-Sim-Mac tvoverbeek$ netstat -r
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif
Expire
default 10.0.1.1 UGSc 9 132 en1
10.0.1/24 link#5 UCS 3 0 en1
10.0.1.1 0:26:bb:6c:20:e2 UHLWI 30 4871163 en1
1194
10.0.1.4 localhost UHS 0 0 lo0
10.0.1.5 0:1e:65:20:8b:52 UHLWI 0 1151 en1
1124
10.0.1.8 0:c:29:d3:c2:3e UHLWI 0 0 en1
916
127 localhost UCS 0 0 lo0
localhost localhost UH 6 170459 lo0
169.254 link#5 UCS 0 0 en1
192.168.2 link#9 UC 1 0 tap0
<-----
192.168.2.2 8:0:2b:aa:bb:cc UHLWI 0 3 tap0
1038 <-----
192.168.7 link#7 UC 0 0 vmnet1
192.168.156 link#8 UC 0 0 vmnet8
Internet6:
Destination Gateway Flags Netif Expire
......
------------------------------------------------------------------------
--------
Note that in 'netstat -r' 8:0:2b:aa:bb:cc is the MAC address of the VAX
QE0 interface.
With this setup it is easy to get data in and out of the VAX. I am using
FileZilla
for this.
Hope this helps somebody getting networking going on Snow-Leopard.
--
Ton van Overbeek
More information about the Simh
mailing list