The MiniPiRack is designed for simple setup and expansion. Just plug in a network cable and power and you’ve got three ready-to-use Linux instances at your ssh-tips. However, in many scenarios, acquiring an active network cable is difficult ask. Most offices and homes these days use primarily WiFi for network access.
Last weekend Kali the Wonder Dog and I created an ansible configuration script that sets the MiniPiRack so that it uses a WiFi network for its main connection instead of a required wired connection. Once the config is complete, the MiniPiRack only requires power, unless of course you are chaining multiple MiniPiRacks together, in which case you’ll still need to connect each MiniPiRack together with an ethernet cable. But the requirement for a hardwire network drop is gone!
To configure the MiniPiRack to use wifi, one of the boards (p1-r1, but let’s call it ‘master’) is configured to run as a gateway, DHCP server and a NAT. On the master, the wifi network interface (wlan0) is enabled with ssid and password set so it’ll happily connect to an existing wifi network. That gives the master (p1-r1) access to the network and (hopefully) Internet.
The ethernet adapter (eth0) on the master is then switched from DHCP to static. Additionally, a DHCP server is started on that adapter and routing rules are set so that any traffic is forwarded back and forth to the wireless adapter. This setup creates two networks: one external and one internal.
In this configuration, p1-r1 essentially becomes a jump server. To access p2-r1 or p3-r1, 1st log into p1-r1 from your main PC using its wifi IP address. Then, from the same shell prompt, ssh into either p2-r1 or p3-r1. All three can see the outside network and all three can see each other internally. But no one from outside the MiniPiRack internal network can access the internal network without going through p1-r1 first!
Adding more MiniPiRacks just works. All the additional MiniPiRacks are addressable through p2-r1. It’s a private lan built just for the MiniPiRacks!
Now, here’s a fun question. After you’ve enabled the MiniPiRack to use the WiFi and you reboot, how do you find the IP address of the master/p1-r1? If you are lucky and your network supports Avahi service discovery, then it’s likely that ‘p1-r1.local’ will resolve to the correct IP address. (For the record, all the networks I’ve tested this on support Avahi, or a compatible Bonjouir or Zeroconf.)
However, what if p1-r1.local doesn’t resolve? How do you find out what the IP address of p1-r1? The new ansible script helps by enabling the Bluetooth adapter on the master. Once enabled, you can pair the Bluetooth on your laptop using your OS-specific Bluetooth tools.
After that, creating a tty session through Bluetooth gives you full access to the master, just like using a typical ssh terminal session. From there, you can use all the tools you are used to using in a terminal session, like ifconfig to find the IP address of the wlan0 adapter and then you are off to the races. Simple!
Check out the ansible script and all the details on the official MiniPiRack github.