0

I am trying to create a secure ad-hoc network generated from a pi 3b+ running Buster. I would like to have a password prompt to show up when I try to connect to the network on various devices. Here is what my interfaces file looks like:

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

auto wlan0
iface wlan0 inet static
  address IP
  netmask 255.255.255.0
  wireless-channel 1
  wireless-essid Network
  wireless-mode ad-hoc
  wireless-key KeyHere 

I have also tried modifying the wpa_supplicant.conf file to add my password like so:

network={
    ssid="Network"
    psk="password"
    key_mgmt=WPA-PSK
}

And in my interfaces file I used:

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

auto wlan0
iface wlan0 inet static
  address IP
  netmask 255.255.255.0
  wireless-channel 1
  wpa_conf /etc/wpa_supplicant/wpa_supplicant.conf

But the network stopped showing up on my phone.

Update with info from a comment:
I'm using Buster. I connect to this network on my iPhone. I don't run an access point from my phone. The ad-hoc network is generated from the Pi. This is a Wifi-Direct connection.

Ingo
  • 40,606
  • 15
  • 76
  • 189
goodkid38
  • 1
  • 1
  • What operating system, what version do you use? What does it mean: "*I select the network on my phone*" - do you run an access point on your iPhone? Or what is this network on your iPhone? What ad-hoc connection do you try to use? Is it IBSS? WiFi-Direct? – Ingo Nov 23 '20 at 20:32
  • I'm using Buster. I connect to this network on my iPhone. I don't run an access point from my phone. The ad-hoc network is generated from the Pi. This is a Wifi-Direct connection. – goodkid38 Nov 23 '20 at 22:13

1 Answers1

2

You are trying to use WiFi-Direct so you do not have to worry about security. WiFi-Direct uses WPA2 encryption by default.

You are using old style Debian networking managed with /etc/network/interfaces. This is deprecated on the Raspberry Pi OS based on Buster since years. I haven't used it for a long time so I cannot help much with it. I'm afraid you are alone with it.

The ad-hoc network is generated from the Pi

This is not seen with your settings in /etc/wpa_supplicant/wpa_supplicant.conf. There you have to define some options specific to WiFi-Direct.

I would like to have a password prompt to show up when I try to connect to the network on various devices.

WiFi-Direct uses two authorization methods: "pin entry" and "push button". So for your application you have to use the pin entry method. This is done with commands using wpa_cli. I do not have an iPhone but an Android Phone so I can only give an example with it. You may have a look at Connect Android smartphone with Wi-Fi Direct to a Raspberry Pi. This will give you an idea how WiFi-Direct works. The settings and using wpa_cli on the Raspberry Pi should not make a difference, in particular the options in /etc/wpa_supplicant/wpa_supplicant.conf and the commands with wpa_cli.

Ingo
  • 40,606
  • 15
  • 76
  • 189