Raspberry Pi 3 Ad-Hoc-Funknetzwerk mit wpa_supplicant / WPA2-Konfiguration

4313
greggigon

Ich brauche Hilfe bei der Absicherung des Ad-Hoc-Netzwerks mit wpa_supplicant.

Ich habe versucht, ein Ad-Hoc-Drahtlosnetzwerk zwischen Raspberry PIs 3 mit dem integrierten WLAN-Adapter einzurichten.

pi@raspberrypi3bare:~ $ iw list Wiphy phy0 max # scan SSIDs: 10 max scan IEs length: 2048 bytes Retry short limit: 7 Retry long limit: 4 Coverage class: 0 (up to 0m) Device supports T-DLS. Supported Ciphers: * WEP40 (00-0f-ac:1) * WEP104 (00-0f-ac:5) * TKIP (00-0f-ac:2) * CCMP (00-0f-ac:4) * CMAC (00-0f-ac:6) Available Antennas: TX 0 RX 0 Supported interface modes: * IBSS * managed * AP * P2P-client * P2P-GO * P2P-device Band 1: Capabilities: 0x1020 HT20 Static SM Power Save RX HT20 SGI No RX STBC Max AMSDU length: 3839 bytes DSSS/CCK HT40 Maximum RX AMPDU length 65535 bytes (exponent: 0x003) Minimum RX AMPDU time spacing: 16 usec (0x07) HT TX/RX MCS rate indexes supported: 0-7 Bitrates (non-HT): * 1.0 Mbps * 2.0 Mbps (short preamble supported) * 5.5 Mbps (short preamble supported) * 11.0 Mbps (short preamble supported) ... * 54.0 Mbps Frequencies: * 2412 MHz [1] (20.0 dBm) ... * 2472 MHz [13] (20.0 dBm) * 2484 MHz [14] (disabled) Supported commands: * new_interface * set_interface * new_key * start_ap * join_ibss * set_pmksa * del_pmksa * flush_pmksa * remain_on_channel * frame * set_channel * tdls_oper * start_sched_scan * start_p2p_device * crit_protocol_start * crit_protocol_stop * connect * disconnect Supported TX frame types: * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0 Supported RX frame types: * managed: 0x40 0xd0 * P2P-client: 0x40 0xd0 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0 * P2P-device: 0x40 0xd0 software interface modes (can always be added): valid interface combinations: * #{ managed } <= 1, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1, total <= 3, #channels <= 2 * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1, total <= 4, #channels <= 1 

Demnach wird P2P (Ad-Hoc) unterstützt.

Meine Netzwerkschnittstellenkonfiguration sieht folgendermaßen aus:

auto wlan0 iface wlan0 inet static address 192.168.0.10 netmask 255.255.255.0 wireless-channel 11 wireless-essid FooBar2 wireless-mode ad-hoc # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf 

Wenn kein wpa_supplicant aktiviert ist, kann ich wlan0 auf zwei verschiedenen Pi'es (zwei verschiedenen IP-Adressen) starten und es funktioniert einwandfrei. Ich kann einen Pi von einem anderen pingen (und umgekehrt).

Wenn ich versuche, wpa_supplicant darüber (auf beiden Pi'es) auszuführen, kann ich sie nicht dazu bringen, zu arbeiten.

Die wpa_supplicant-Konfigurationsdatei sieht folgendermaßen aus:

pi@raspberrypi3bare:~ $ sudo cat /etc/wpa_supplicant/wpa_supp.conf ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 ap_scan=2 network={ ssid="FooBar2" key_mgmt=WPA-PSK psk=102ea4041e1612cc5905c4b9008f5e9aaebe91d20792ca16ab7754fd137865a8 mode=1 proto=RSN group=CCMP pairwise=CCMP frequency=2462 } 

Die Ausgabe des Startbefehls:

pi@raspberrypi3bare:~ $ sudo wpa_supplicant -c /etc/wpa_supplicant/wpa_supp.conf -D nl80211 -i wlan0 Successfully initialized wpa_supplicant Note: nl80211 driver interface is not designed to be used with ap_scan=2; this can result in connection failures wlan0: Trying to associate with SSID 'FooBar2' wlan0: Associated with 7e:6c:29:3d:49:eb wlan0: CTRL-EVENT-CONNECTED - Connection to 7e:6c:29:3d:49:eb completed [id=0 id_str=] WMM AC: Missing IEs wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0   pi@raspberrypi3bare:~ $ ping 192.168.0.30 PING 192.168.0.30 (192.168.0.30) 56(84) bytes of data. From 192.168.0.10 icmp_seq=1 Destination Host Unreachable 

Ein paar andere Details:

pi@raspberrypi3bare:~ $ wpa_supplicant -v wpa_supplicant v2.6 Copyright (c) 2003-2016, Jouni Malinen <j@w1.fi> and contributors pi@raspberrypi3bare:~ $ uname -a Linux raspberrypi3bare 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l GNU/Linux 

Irgendeine Idee, was könnte ich ändern, damit wpa_supplicant funktioniert?

1
Warum möchten Sie ein Ad-hoc-Netzwerk einrichten? Was auch immer Sie mit * hostpad * erreichen möchten, einschließlich der WP2-PSK-Authentifizierung, können Sie problemlos erreichen. MariusMatutiae vor 7 Jahren 0

1 Antwort auf die Frage

1
Spiff

Übrigens: P2P ist Wi-Fi Direct, was eine ganz andere Sache ist als Ad Hoc. Ad Hoc bezieht sich ausschließlich auf IBSS. Der Rest dieser Antwort geht davon aus, dass Sie IBSS und nicht P2P meinten.

WPA2-PSK-Authentifizierung über IBSS ist möglich (der IEEE 802.11-Standard legt die Vorgehensweise fest), es ist jedoch etwas kompliziert zu implementieren, daher bin ich mir nicht sicher, wie verbreitet es ist. Es würde mich nicht wundern, wenn wpa_supplicant es nicht unterstützt, da der Supplicant in einigen Fällen die Rollen wechseln und der Authentifikator werden muss. In anderen Fällen fungiert er als Supplicant, je nachdem, welches Gerät die höhere MAC-Adresse hat. Normalerweise spielt hostapd auf einem Gerät im AP-Modus die Rolle des WPA2-PSK-Authenticators. Ich bin nicht sicher, ob in wpa_supplicant ein Authentifizierungscode vorhanden ist.

Versuchen Sie, Ad-hoc (IBSS) mit 40-Bit-WEP zu arbeiten. Sobald dies funktioniert hat, sollten Sie herausfinden, ob wpa_supplicant WPA2-PSK über IBSS unterstützt und wie es eingerichtet wird.

Sie haben Recht, wenn Sie IBSS annehmen. Ich werde versuchen, es heute Abend mit WEP zum Laufen zu bringen. Beim Nachschlagen von Dokumenten in der Konfigurationsdatei wpa_supplication habe ich das Gefühl, dass WPA2-PSK für IBSS https://w1.fi/cgit/hostap/plain/wpa_supplicant/wpa_supplicant.conf (unten in der Datei mit Beispielen) unterstützt werden sollte. Danke für Ihre Antwort Spiff, sehr erfreut! greggigon vor 7 Jahren 0
@greggigon Ich bin damit einverstanden, dass es so aussieht, als wpa_supplicant WPA2-PSK auf IBSS unterstützt (ich war vorher auf dem Handy oder hätte mich selbst verifiziert). Nun würde ich sagen, vielleicht schauen Sie sich die Warnung an, die Sie darüber informiert, wie die Verwendung von "ap_scan = 2" mit diesem Treiber zu Verbindungsfehlern führen kann. Die von Ihnen verlinkte .conf-Datei enthält weitere Informationen. Wenn "ap_scan = 1" für Sie funktioniert, posten Sie dies als Ihre eigene Antwort und akzeptieren Sie Ihre eigene Antwort. Spiff vor 7 Jahren 0