Von English mit KI übersetzt ·
Wir haben im Feld noch einige davon. Der Unterschied liegt darin, wer DHCP steuert.Bei wpa-conf startet ifupdown wpa_supplicant mit Ihrer Konfiguration und führt danach dhclient auf wlan0 selbst aus. wpa_supplicant wählt ein Netzwerk aus den Blöcken in der Datei, ifupdown kümmert sich nicht darum, welches. Einfach, und ausreichend für „verbinde dich mit dem, der von diesen beiden gerade in Reichweite ist“.Bei wpa-roam läuft wpa_supplicant im Roaming-Modus und ruft bei jeder Verbindung und jeder Trennung wpa_action auf, das dann eine logische Schnittstelle aktiviert. Jeder Netzwerkblock kann eine id_str tragen, die die zu verwendende logische Schnittstelle benennt; alles ohne diese fällt auf iface default zurück. Es ist für unterschiedliche IP-Einstellungen pro Netzwerk gedacht. Der Haken: wpa_action muss die Trennung sehen, um die alte Lease abzubauen. Wenn der Knoten weggetragen wird und der AP in ungünstiger Reihenfolge verschwindet, bleibt man mit einer Assoziation ohne Lease zurück. Das ist Ihr Symptom im Feld.Für zwei DHCP-Netzwerke verwenden Sie wpa-conf und Prioritäten:
# /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
}
Auf der Hermetry-Seite gilt: Jeder Wechsel zwischen Netzwerken trennt die MQTT-Sitzung. Lassen Sie Ihren Client daher mit Backoff neu verbinden und erneut abonnieren. Wenn der Knoten einen Offline-Alarm hat, setzen Sie seine Open-after-Zeit länger als einen Weg vom Labor zur Parzelle, sonst bekommen Sie bei jeder Fahrt einen.
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.

