Thursday, December 13, 2012

Getting KLH-10 and ITS to work under Mac OS X

I've cycled back to being interested in the Incompatible Timesharing System (ITS). In the interim, I replaced my G4 iBook with a Intel-based MacBookPro. With a bit of hacking, I was actually able to get local networking to communicate with the simulated PDP-10, and thought I would record some of the details.

I needed to
  • Install tuntaposx. I used the macports version.
  • Crudely hack the ks-base-its build in klh10-2.0h from panda-dist (and additional patches) to define KLH10_NET_TUN=1 under Mac OS X. I need to clean up my own sources and put them up on github. Also, I needed to hack around the removal of "mtio.h" from Mac OS X 10.6, borrowing the minimum definitions from FreeBSD headers. I guess Apple decided they really didn't want tape drives connected to their machines. Maybe it is still in OS X server?
  • There are a few rough edges in tun/tap support. Following a hint I found online, I open a bash shell as root, and execute
    • exec 4<> /dev/tap0 # create the interface by opening the device
    • ifconfig tap0 # .100.110 is the address for the KLH10, 200.105 is the host Mac OS X network address
  • In KLH10, configure dpimp parameters to open the tap interface address
    • devdef imp  ub3   lhdh   addr=767600 br=6 vec=250 ipaddr= gwaddr= debug=0 ifc=tun0 dpdebug=0 dedic=true doarp=true
  • Boot ITS using the MD image, built to expect as the IMP address and dumped.
    • set the value of the environment variable KLH10_HOME
    • cd ${KLH10_HOME}
    • ./kn10-ks klh10-md.ini
  • Once ITS is up From another shell, I can then 
    • telnet
    • :TCTYP vt52 # convince ITS I am not using a hardcopy terminal
  • Using the Java supdup client from Bjorn Victor's site, I can
    • File > Connect
I'm still a bit foggy on what dpimp is doing with /dev/(tap|tun)0 and arp commands. The arp seems to fail, but the network still is up. It isn't accessible to other computers on my LAN, although (surprise!) my Mac OS X firewall seems to have been turned off. Ignoring for now that ITS is a dangerously trusting Internet host, I think it should be possible for ITS itself to respond to ARP. What I don't understand yet is whether tap/tun will show the ARP requests from other machines to ITS, whether ITS knows how to reply to them, or whether I need to get the Mac OS X network stack to either route external packets for .100.110 to appear on the tap interface, broadcast that routing information, or reply to ARP requests on behalf the the ITS machine.

What I really want is a chapter suitable for inclusion in Steven's TCP/IP networking book that explains tun/tap and how networking with virtual machines can work. The existing documentation for these kinds of things tends to be "here's a script that works" and not solid explanations.

No comments:

Post a Comment