Skip to content

Instantly share code, notes, and snippets.

@desaster
Last active February 11, 2025 21:37
Show Gist options
  • Save desaster/01926667adce0d62a9a661ae31a39dcc to your computer and use it in GitHub Desktop.
Save desaster/01926667adce0d62a9a661ae31a39dcc to your computer and use it in GitHub Desktop.
Setting up Proxy ARP with Raspberry Pi OS for use with SIMH/PiDP-11

Setting up Proxy ARP with Raspberry Pi OS for use with SIMH/PiDP-11

(2024 edition)

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 standard network 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 package:

$ sudo apt-get install parprouted

You need to decide on at least two IP addresses, that are not conflicting with the DHCP pool or any other IP in your network.

  • IP address of the tap interface on your Raspberry Pi
  • IP address of your simh instance (your actual emulated PiDP-11 running RSX/BSD/etc)

In my examples I will be using 192.168.0.16 for the tap interface, and 192.168.0.17 for the simh instance.

This setup assumes you're running simh manually as non-root user. The default install scripts for PiDP-11 currently run simh as root (TODO: is this still true?).

Setting up

1) sysctl

We need to set some sysctl parameters for Proxy ARP to work. Create a new file /etc/sysctl.d/97-proxy-arp.conf, and add the following:

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 network connection using NetworkManager that defines our tap interface.

The command below will:

  • create a connection named tap-simh0
  • ..with create a network interface called tap-simh0
  • assigned to the user that this command is being run at (id -u)
  • with a manually specified IP address and mask 192.168.0.16/32
sudo nmcli conn add type tun ifname tap-simh0 con-name tap-simh0 mode tap owner `id -u` ip4 192.168.0.16/32

3) Create a systemd service for parprouted

Next, let's place our tap interface in a configuration file in /etc/default/parprouted:

TAP_INTERFACES="tap-simh0"

Start editing a new systemd service using the following command:

systemctl edit --full parprouted.service

And add these contents:

[Unit]
Description=Proxy ARP Daemon
After=network.target

[Service]
Type=forking

# parprouted doesn't maintain a pidfile
PIDFile=

Restart=on-failure
RestartSec=10

# Read tap device names from external file
EnvironmentFile=/etc/default/parprouted

# Set promisc mode for wlan0
ExecStartPre=/sbin/ip link set wlan0 promisc on
# Start parprouted
ExecStart=/usr/sbin/parprouted wlan0 $TAP_INTERFACES

# Unset promisc mode for wlan0
ExecStopPost=/sbin/ip link set wlan0 promisc off

[Install]
WantedBy=wpa_supplicant.service

Bring up the tap interface:

nmcli conn up tap-simh0

And start the proxy arp bridging service:

systemctl start parprouted

4) Verify that everything is ok

$ ip addr show tap-simh0

5: tap-simh0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 32:51:87:99:10:ee brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.16/32 scope global noprefixroute tap-simh0
       valid_lft forever preferred_lft forever
    inet6 fe80::7565:5b1d:5cb3:48f0/64 scope link tentative noprefixroute
       valid_lft forever preferred_lft forever
$ ps ax|grep parprouted
    715 ?        Ssl    0:00 /usr/sbin/parprouted wlan0 tap-simh0
$ 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

5) 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

6) 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:

https://gist.github.com/desaster/c49b0f7afa5e061b8f33f159e521b6ee

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.
64 bytes from 192.168.0.17: icmp_seq=1 ttl=255 time=27.8 ms

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
@desaster
Copy link
Author

desaster commented Feb 11, 2025

@Robert-van-Engelen Thanks for testing out the setup. Looks like I forgot to add instructions on how the service can be started on bootup.

To enable service starting automatically on bootup, you should run:

systemctl enable parprouted

And to disable it:

systemctl disable parprouted

Thank you for updating the instructions that worked for me with the latest 64 bit standard Pi OS (I had almost given up hope). A few minor things that may help others:

1. Instread of `--full` I needed: `sudo systemctl edit --force parprouted.service` because the unit does not exist yet

2. Every time I reboot the Pi and want to use BSD2.11 on PiDP-11, I still need to start parprouted with `systemctl start parprouted`

3. step 5) above should be done by editing `/opt/pidp11/systems/211bsd/boot.ini` to change and add the `set xu` and `attach xu` entries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment