New: the AI firewall watches the whole platform and explains each incident in plain words. See how it works

Old tutorial uses wpa-roam in /etc/network/interfaces, others say wpa-conf. Which one?

Old tutorial uses wpa-roam in /etc/network/interfaces, others say wpa-conf. Which one?

Solved 5 4

Another networking one from me, sorry. Our research group has a Pi 3 sensor node (soil moisture + air temp) that gets carried between the lab and a field plot. It needs to join “LAB-WIFI” in the lab and a 4G hotspot (“FIELD-AP”) at the plot, and keep reporting to Hermetry wherever it is.

The image is old (Buster, inherited from a previous student) and uses ifupdown. Half the tutorials have

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

and the other half have iface wlan0 inet dhcp with wpa-conf. The current file has wpa-roam and the node sometimes sits on the field AP with no IP address at all until someone power-cycles it. What is the actual difference between the two, and which should I use for two networks?

Timestamps in UTC or it didn't happen.
♥ 2

Before anything: is moving it to Bookworm an option? NetworkManager makes this whole question go away.

♥ 2

Not this term, the soil sensor driver only builds on the old kernel apparently.

Timestamps in UTC or it didn't happen.
♥ 0

We still have a few of these in the field. The difference is who drives DHCP.

With wpa-conf, ifupdown starts wpa_supplicant with your config and then runs dhclient on wlan0 itself. wpa_supplicant picks a network from the blocks in the file, ifupdown doesn’t care which one. Simple, and enough for “connect to whichever of these two is around”.

With wpa-roam, wpa_supplicant runs in roaming mode and calls wpa_action on every connect and disconnect, which then brings up a logical interface. Each network block can carry an id_str that names the logical interface to use, and anything without one falls to iface default. It’s meant for different IP settings per network. The catch is that wpa_action must see the disconnect to take the old lease down; when the node is carried away and the AP disappears in a funny order, you end up associated with no lease. That’s your field symptom.

For two DHCP networks use wpa-conf and priorities:

# /etc/network/interfaces
allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

# /etc/wpa_supplicant/wpa_supplicant.conf
network={
    ssid="LAB-WIFI"
    psk="..."
    priority=10
}
network={
    ssid="FIELD-AP"
    psk="..."
    priority=5
}

On the Hermetry side, each move between networks drops the MQTT session, so make your client reconnect with backoff and resubscribe. If the node has an offline alarm, set its open-after time longer than a walk from the lab to the plot or you’ll get one every trip.

Accepted solution♥ 4

Also put a cron’d ip addr show wlan0 | grep -q inet || systemctl restart networking in as a belt-and-braces. Saved us more than one trip.

♥ 0

Swapped to wpa-conf with priorities like above and carried it out and back twice, it picked up a lease each time within about 20 s and Hermetry showed the gap and then fresh readings. Raised the offline alarm to 30 minutes too, the walk is 15. Thanks!

Timestamps in UTC or it didn't happen.
♥ 0
Viewing 6 posts – 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Join the conversation

Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

Share