Hello,
I've spent the last few days experimenting with Johnny Billquist's TCP/IP stack for RSX-11M, and with various ways of networking SIMH on the Raspberry Pi. I think I've found the optimal setup for myself using Proxy ARP, so I thought I'd share it here. Networking can be a bit challenging to get right, and I'm not the best at explaining things, but I hope this will use useful to someone.
Rationale
First of all, I like to use TAP interfaces for networking, since they are full featured interfaces and can be used as non-root. The absolutely best way to configure networking for SIMH would be a bridge between WLAN0 and a TAP interface, and this is how I've done it on my normal SIMH setups. However, bridging is not possible with Raspberry Pi's WLAN interface.
Other options would be the builtin NAT functionality in SIMH, or a normal NAT setup between wlan0 and a tap interface (which I initially settled on).
With Proxy ARP, we can achieve pretty closely the same result as with a network bridge, where the IP address of the SIMH instance will appear in the same network as your Raspberry Pi. Some caveasts, though:
- Since proxy arp relies on IP routing, DECnet won't work. DECnet over TCP/IP might work.
- DHCP doesn't work without some extra relaying utilities.
- It can be a bit mysterious to setup, if you're not experienced with linux or networking
Prerequisities
Install the required ubuntu packages:
$ sudo apt-get install parprouted uml-utilities
Decide an IP address for your simh instance, that's not conflicting with the DHCP pool or any other IP in your network. In my examples I will be using 192.168.0.17. Raspberry Pi can still obtain it's IP address via DHCP.
This setup assumes you're running simh manually as non-root user. The default install scripts for PiDP-11 currently run simh as root.
Setting up
Proxy ARP can be setup using standard procedures in Linux. An useful page to understand the basics is here:
If you do the setup manually, the static route needed for the Proxy ARP will disappear each time the link goes down (ie. you stop the SIMH process). For this reason, using parprouted is preferred.
On a standard Raspbian installation the setup can be done with the steps described below.
1) sysctl
Enable IP forwarding and proxy arp by uncommenting or adding the following settings in /etc/sysctl.conf:
net.ipv4.conf.all.proxy_arp=1
net.ipv4.ip_forward=1
Reboot to make the above changes active, or add them manually using sysctl from command line.
2) Configure TAP interfaces
Create a new file that defines your tap interface(s) (one per each networked simh instance you plan to run). For "simhuser", specify the username you will be running simh as.
Upon bringing up the tap interface, this configuration will:
- create a tap interface, and assign it to a specific user
- bring the link up
- start parprouted
- enable promiscous mode on wlan0, which is needed on Raspberry Pi for some reason
And upon bringing down the tap interface:
- bring the link down
- remove the tap interface
- and due these steps, the parprouted process will automatically close
Create file: /etc/network/interfaces.d/tap:
auto tap-simh0
iface tap-simh0 inet manual
pre-up tunctl -t tap-simh0 -u simhuser
up ip link set tap-simh0 up
up /usr/sbin/parprouted wlan0 tap-simh0
up /sbin/ip link set wlan0 promisc on
post-down ip link set tap-simh0 down
post-down tunctl -d tap-simh0
auto tap-simh1
iface tap-simh1 inet manual
pre-up tunctl -t tap-simh1 -u simhuser
up ip link set tap-simh1 up
up /usr/sbin/parprouted wlan0 tap-simh1
up /sbin/ip link set wlan0 promisc on
post-down ip link set tap-simh1 down
post-down tunctl -d tap-simh1
Reboot to bring up the interfaces, or bring them up manually using ifup from command line.
3) Verify that everything is ok
$ ip addr show dev tap-simh0
4: tap-simh0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
$ ps ax|grep parprouted
412 ? Ssl 0:03 /usr/sbin/parprouted wlan0 tap-simh0
3480 ? Ssl 0:00 /usr/sbin/parprouted wlan0 tap-simh1
$ sysctl net.ipv4.conf.all.proxy_arp; sysctl net.ipv4.ip_forward
net.ipv4.conf.all.proxy_arp = 1
net.ipv4.ip_forward = 1
$ ip link show wlan0 | grep --color PROMISC
3: wlan0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
4) Configure SIMH
I like to specify MAC address, especially when dealing with proxy ARP to make possible troubleshooting easier:
; Ethernet
set xu enable
set xu type=deuna
set xu mac=aa:00:04:00:0c:34
attach xu tap:tap-simh0
sho xu
5) Configure your SIMH instance
Use a static IP address. If things go okay, experiment with DHCP relays later. Details of installing RSX-11M+ or 2.11BSD are beyond the scope of this guide, but my install logs can be found here:
Enjoy! (or start troubleshooting)
Proxy ARP can be a challenge to figure out, if you're not familiar with routing or ethernet in general. Here's a checklist of things to check when facing issues:
Do you have any any iptables rules that might be causing issues?
$ sudo iptables -n -L; sudo iptables -n -t nat -L
Is parprouted running?
$ ps ax|grep parprouted
412 ? Ssl 0:03 /usr/sbin/parprouted wlan0 tap-simh0
When your simh instance has an IP address, has parprouted created the appropriate route?
$ ip route | grep '192.168.0.17.*tap'
192.168.0.17 dev tap-simh0 scope link metric 50
If you can't access the simh from your local network, can you still access it locally on the Raspberry Pi?
$ ping -c 1 192.168.0.17
PING 192.168.0.17 (192.168.0.17) 56(84) bytes of data.
Did simh throw an error when trying to attach to the tap interface?
sim> attach xu tap:tap-simh0
Eth: open error - Device or resource busy