2

What I would like to accomplish One is a dedicated pair of RPi's using Wi-Fi Direct (p2p), one GO (group owner) and the other its client. The GO is not to be an access point, as neither RPi needs to connect elsewhere; they only talk to each other.

I have read through these questions and answers: Setting up Wifi direct (wifi p2p) and DHCP server, Howto migrate from networking to systemd-networkd with dynamic failover, and Configure Rpi as router - error when starting network and DHCP interfaces and many other posts here and elsewhere. But my lack of in-depth networking knowledge and skills is a problem.

Current state for both RPi: fresh Buster install using with sudo bash -c 'apt update && apt full-upgrade && reboot' as suggested in Setting up Wifi direct (wifi p2p) and DHCP server. However, the script that's laid-out is for communication between an RPi and SmartPhone, rather than a second RPi - which is where my knowledge deficit takes over.

Goal: eth0 remains accessible for both devices on my local network (192.168.1.024-IP is static or DHCP assignment), with the wireless connection on a separate network (e.g. 192.168.4.1 & 192.168.4.2). I have read elsewhere that it is possible for the RPi to have eth0 and wlan0 on separate networks.

I understand that the GO needs to be a DHCP server for its wlan, and that the client will be assigned its wireless IP by the GO. Further, I believe the GO also needs to manage the routes for that wireless network.

For now, the two devices sit next to each other (for convenience). With wpa_cli and wpa_gui, I have run through numerous configurations without achieving my goal. I have seen numerous messages between the devices indicating they "see" each other, but have not been able to get them to successfully ping each other. So, suggestions for setting-up such a paired system would be greatly appreciated and would likely contribute to getting a bit more sleep...

Thanks in advance!

Edit - Adding contents of wpa_supplicant-wlan0.config and /etc/system/network configuration files.

p2p GO: wpa_supplicant-wlan0.conf:

ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

eapol_version=1

device_name=DIRECT-RPi3-NanCam
device_type=1-0050F204-1
p2p_go_intent=15
p2p_go_ht40=1


network={
    ssid="DIRECT-CA"
    psk="12345670"
    key_mgmt=WPA-PSK
    proto=RSN WPA
}

/etc/systemd/network files: 04-wired.network: (Note: Works as expected)

[Match]
Name=e*

[Network]
#Option using a DHCP server
DHCP=yes

#Option using link-local ip addresses
#LinkLocalAddressing=yes
#MulticastDNS=yes

# Option use static ip address (example, use your settings)
#Address=192.168.1.111/24
#Gateway=192.168.1.1
#DNS=192.168.1.1

08-wifi.network (note: no ip address assigned)

[Match]
Name=wl*
[Network]
#to use static IP (with your settings) toggle commenting the next 8 lines.
Address=192.168.4.61/24
DNS=192.168.4.1
[Route]
Gateway=192.168.4.1
Metric=20
#DHCP=yes
#[DHCP]
#RouteMetric=20

12-p2p-wlan0.network

[Match]
Name=p2p-*
[Network]
Address=192.168.4.1/24
DHCPServer=yes

p2p CL:

wpa_supplicant-wlan0.conf:

ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
eapol_version=1

device_name=DIRECT-RPi3-NanDisp
device_type=1-0050F204-1
p2p_go_intent=15
p2p_go_ht40=1


network={
    ssid="DIRECT-CA"
    psk="12345670"
    key_mgmt=WPA-PSK
    proto=RSN WPA
}

/etc/systemd/network files: 04-wired.network: (Note: Works as expected)

[Match]
Name=e*

[Network]
#Option using a DHCP server
DHCP=yes

#Option using link-local ip addresses
#LinkLocalAddressing=yes
#MulticastDNS=yes

#Option use static ip address (example, use your settings)
#Address=192.168.1.111/24
#Gateway=192.168.1.1
#DNS=192.168.1.1

08-wifi.network (note: no ip address assigned)

[Match]
Name=wl*
[Network]
#to use static IP (with your settings) toggle commenting the next 8 lines.
#Address=192.168.50.61/24
DNS=
[Route]
Gateway=192.168.4.1
DHCP=yes
[DHCP]
RouteMetric=20

12-p2p-wlan0.network

[Match]
Name=p2p-*

[Network]
DHCP=yes



[DHCP]
RouteMetric=20

Once again, thanks for helping.

9
  • Do you need to have wifi-direct? That isn't the simplest protocol. If you only need an add-hoc WiFi network there is another simple solution without a group owner.
    – Ingo
    Commented Jul 6, 2020 at 8:56
  • A succinct question. I'll try to be equally succinct answering. The intent is a secure video stream between two RPi devices for a simple, portable video monitoring system. Though initially a maker-driven idea, there are now others involved who want the system to not access the net, nor need any other hardware/software to function. Any reprogramming or related functions would require direct physical access. My readings indicated p2p was likely the "best" solution. FWIW, before entering nursing, I was a software engineer for 15+ years, but I did GUI development with little networking. - Bob
    – NurseBob
    Commented Jul 6, 2020 at 16:12
  • Hmm.. not easy to decide what's the best solution. Your question is very interesting for me and I would like to have a look at it, but it will take some effort to setup a proper test environment and I'm just busy with other projects. But I have bookmarked the question and I will see if I can come back to it after one or two weeks. Meanwhile you may have a look at ad-hoc networking using IBSS. It's more a base system where you can use other applications on top of it, e.g. encryption.
    – Ingo
    Commented Jul 6, 2020 at 18:29
  • Thank you for the follow-up reply. I can be patient! In the meantime I'll keep reading docs and trying variations on the theme. "Hmm.. not easy to decide what's the best solution," lets me feel a bit better about my challenges. A good friend, and practicing SE, said their team ran into similar challenges and confusion. So, if and when you have time to experiment: two RPi 3 B+, both running Buster Desktop, one with an IR Camera link When not totally frustrated, I do enjoy the challenge. :) Thanks for the link
    – NurseBob
    Commented Jul 6, 2020 at 19:14
  • Have been focused on gaining deeper understanding of p2p comms. and believe I've made progress. Configured both pi 3 b+ devices as described in Setting up Wifi direct (wifi p2p) and DHCP server and Howto migrate from networking to systemd-networkd with dynamic failover. Note: Only the GO is setup to be a DHCP Server.
    – NurseBob
    Commented Jul 15, 2020 at 18:38

1 Answer 1

2

Solved the connection issues with both Stretch & Buster. With Stretch reconfigured with systemd-networkd as described in Setting up Wifi direct (wifi p2p) and DHCP server. To connect an RPi client instead of the Android, I used a matching wpa_supplicant-wlan0.conf file and the command sequence followed in this TI reference: https://processors.wiki.ti.com/index.php/WiFi_Direct_Configuration_Scripts#Connect_in_Pin_.28PIN_Number.29_where_EVM_.231_is_defined_as_the_group_owner. Further, the client needs an entry in the /etc/systemd/network folder for it to receive a DHCP assigned address from the group owner.

My thanks to @Ingo for the networking pointers.

Finally, I was able to get an out-of-the-box Buster implentation working without altering the networking, though I had to do a manual ip assignment on the client to match the created address on the group owners p2p-wlan0-0 ip. I'll update this post when I have the final configuration determined.

3
  • Please mark the answer as the accepted one with a click on the tick on its left side. That prevents your Question from being shown as an unsolved Post to the community and saves them/us a lot of work.
    – Ingo
    Commented Dec 10, 2020 at 20:47
  • @Ingo, sorry for the delay. I've been more than a little busy following the loss of our home and all contents in one of the California wildfires at the end of Sept. In the mean time have moved to Colorado, bought a new home, and am busy replacing/rebuilding everything. FWIW, this was the easiest move ever; when we evacuated at 05:30 we got out with only the four cats and two cars. Looking forward to getting back to projects.
    – NurseBob
    Commented Dec 11, 2020 at 22:43
  • Thanks for accepting. (Off topic now) What a misfortune! We must fight against global heating
    – Ingo
    Commented Dec 12, 2020 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.