I guess I've been called out



So yes, I have tashrouter working in harmony with netatalk on the same raspberry pi.
The pi in question is a Pi2B running Raspbian Bullseye and equipped with a TashTalk Hat of Tashtari's design.
I experimented with the recommended macvtap interface but found it to be somewhat poorly documented.
In theory it's supposed to function like a bridge+tap, but I could not get that to work properly.
Instead, I just went with a classic tap + bridge setup.
I found the easiest way to set this up was to disable dhcpcd and use systemd networking to create the necessary interfaces on boot.
/etc/network/interfaces.d/br0
Code:
#loopback
auto lo
iface lo inet loopback
# Virtual interface
auto tap2
iface tap2 inet manual
pre-up tunctl -t tap2 -u root
up ip link set dev tap2 up
down ip link set dev tap2 down
# Bridge interface
auto br0
iface br0 inet static
address 10.40.0.216
gateway 10.40.0.1
dns-domain local.default.tel
dns-nameservers 10.40.0.1 1.1.1.1 8.8.8.8
bridge_ports eth0 tap2
bridge_stp off
bridge_maxwait 5
eth0 = the ethernet interface of the pi. I have predictable interface names disabled.
tap2 = the network tap. tashrouter will bind to this.
br0= a network bridge of tap2+eth0. Netatalk's atalkd daemon will be bound to this, which will allow netatalk to "hear" tashrouter.
this is also given a static IP address which will become the address of the pi.
Now a tashrouter script that binds to the tap interface must be created. This needs to be in the main tashrouter directory.
tap_router.py
Code:
import logging
import time
import tashrouter.netlog
from tashrouter.port.ethertalk.tap import TapPort
from tashrouter.port.localtalk.ltoudp import LtoudpPort
from tashrouter.port.localtalk.tashtalk import TashTalkPort
from tashrouter.router.router import Router
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
#tashrouter.netlog.set_log_str_func(logging.debug) # comment this line for speed and reduced spam
router = Router('router', ports=(
LtoudpPort(seed_network=1, seed_zone_name=b'LToUDP Network'),
TashTalkPort(serial_port='/dev/ttyAMA0', seed_network=2, seed_zone_name=b'TashTalk Network'),
TapPort(tap_name='tap2', hw_addr=b'\xDE\xAD\xBE\xEF\xCA\xFE', seed_network_min=3, seed_network_max=5, seed_zone_names=[b'EtherTalk Network']),
))
print('router away!')
router.start()
try:
while True: time.sleep(1)
except KeyboardInterrupt:
router.stop()
The important parts here are:
from tashrouter.port.ethertalk.tap import TapPort
this tells tashrouter to make the tap ethertalk module(?) available
TapPort(tap_name='tap2', hw_addr=b'\xDE\xAD\xBE\xEF\xCA\xFE', seed_network_min=3, seed_network_max=5, seed_zone_names=[b'EtherTalk Network']),
this tells tashrouter to bind to the specified tap interface (tap2), and give it the specified MAC address
(\xDE\xAD\xBE\xEF\xCA\xFE).
Finally, Netatalk's atalkd.conf needed to be edited.
add a new interface to the top of the file, "br0" and comment out the interface already specified.
Code:
br0
#eth0 -phase 2 -net 0-65534 -addr 65280.238
The other attributes will be magically populated when atalkd runs.
Now things are ready to run. If netatalk is already running it needs to be shut down, and tashrouter needs to be run first.
I use systemctl to stop all the netatalk services.
You can probably get away with just stopping the atalkd service though...
If you DO want to stop all the netatalk services, just substitute the particular service name in place of atalkd. there's 5 in total. atalkd, afpd, papd, a2boot, and timelord.
systemctl stop atalkd
Then tashrouter needs to be started (using the tap script above)
python3 ~/tashrouter/tap_router.py just note that this will NOT run in the background, use tmux or screen to run it in a seperate window for now
When tashrouter is running properly, start atalkd.
systemctl start atalkd
Then, check the status.
systemctl status atalkd
If everything worked, it should say something like this:
Code:
Jan 12 20:03:08 raspbx atalkd[543]: zip_getnetinfo for br0
Jan 12 20:03:08 raspbx atalkd[543]: zip gnireply from 3.125 (br0 812)
Jan 12 20:03:08 raspbx atalkd[543]: zip_packet configured br0 from 3.125
Jan 12 20:03:09 raspbx atalkd[543]: rtmp_packet gateway 3.125 up
Jan 12 20:17:41 raspbx atalkd[543]: ready 0/0/0
Jan 12 20:17:41 raspbx systemd[1]: Started Netatalk AppleTalk daemon.
Things should now be working, you should be able to see the netatalk share in the EtherTalk zone. Grab a few Macs and emulators and test if it works via ethertalk, localtalk, and LToUDP.
But you probably want things to start at boot and generally be a bit neater.
To make things tidy, make a systemd unit for tashrouter.
First, quit tashrouter, and shutdown atalkd.
nano /etc/systemd/system/tashrouter.service
yeah there's probably a better place to put this...
Code:
[Unit]
Description=TashRouter Service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/python3 /root/tashrouter/tap_router.py
[Install]
WantedBy=default.target
/root/tashrouter/tap_router.py = the location of your tap_router.py file in the tashrouter directory.
Save, reload systemd units.
systemctl daemon-reload
Then start the new unit.
systemctl start tashrouter
Check the status using
systemctl status tashrouter and check if it's working. If it is, then
systemctl enable tashrouter and it will start at boot.
This should be enough to have tashrouter start before netatalk, but if not... systemd overrides can be created to force netatalk to start after tashrouter.
i haven't included them as i don't have them set up properly yet