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

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

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