As often happens… solved it myself. Heads up anyone who wants to use USB OTG for networking - don’t forget that the second gadget uses usb1!
For those other non-technicals like me who want a quick reference on how to do it…
To set up your zeros, follow the superb guide at http://blog.gbaman.info/?p=791 to change the two files in your boot directory. You can run:
sudo service --status-all | grep avahi
to check for
" [ + ] avahi-daemon "
to verify the USB gadget service is up.
I have two zeros hanging off one Pi2.
On the host (my Pi2), add this into your /etc/networking/interfaces file:
allow-hotplug usb0
iface usb0 inet static
address 192.168.2.1
netmask 255.255.255.0
allow-hotplug usb1
iface usb1 inet static
address 192.168.2.2
netmask 255.255.255.0
(continue with usb2 and usb3 for other connections as necessary)
You may also need to allow the zeros to NAT through the device. Assuming you’re sharing a wired connection and no pre-existing iptables policies:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
On the first zero, add this into your /etc/networking/interfaces file:
allow-hotplug usb0
iface usb0 inet static
address 192.168.2.5
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameservers 8.8.8.8
On the next zero, add this into your /etc/networking/interfaces file:
allow-hotplug usb0
iface usb0 inet static
address 192.168.2.6
netmask 255.255.255.0
gateway 192.168.2.2
dns-nameservers 8.8.8.8
…and repeat for other zeros. Note that usb0 stays as usb0 for each of the zeros, but the gateway matches the USB port on the host Pi.
Make sure you’re matching the correct USB port with the correct usb0/usb1/…
Finally, you will have to forward a port to your Volumio for the web interface. The NAT will allow it to go out and get your tunes/artwork, but you need to be able to control it via port 80.
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.2.6:80
Note that my volumio zero is the one on 192.168.1.6! Also, if your host is already running a server, pick a random port number for --dport and use that.
This allows me to have my Pi2 doing security camera and garage door opener with too much on the GPIO for hats; to connect out to my music player and dismounted parking sensor.