p2p_group_add setting own password and ssid

want to ask help, for setting the desired password for p2p_group_add command,

if we run p2p_group_add on wpa_cli, it will generate random ssid and passphrase

P2P-GROUP-STARTED p2p-wlan0-3 GO ssid="DIRECT-uv" freq=2437 passphrase="UqZ76VLR" go_dev_addr=0a:a1:12:84:45:6e

How can we set our own password ?

 

To setup your autonomous group owner, started with p2p_group_add, with a custom ssid and password you have to make it persistent and have a network block inserted in /etc/wpa_supplicant/wpa_supplicant.conf. The easiest way to get the network block in wpa_supplicant.conf is to let it do wpa_supplicant itself. Just start the p2p group with p2p_group_addas usual but persistent and remove it just after that again:

rpi ~$ wpa_cli -ip2p-dev-wlan0
> p2p_group_add persistent
> p2p_group_remove p2p-wlan0-0
> quit
rpi ~$

Now you should find the persistent network block in /etc/wpa_supplicant/wpa_supplicant.conf. From my test it looks like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
device_name=DIRECT-RasPi1
p2p_go_ht40=1
country=DE

network={
        ssid="DIRECT-Ca"
        bssid=56:1d:c5:95:c2:e9
        psk="yfmyjT8o"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
        mode=3
        disabled=2
}

Now just edit this and set ssid and psk as you like. When ready then restart your wpa_supplicant to make the change available.

The first network block has number 0 and so on. Now start the persistent autonomous group owner by addressing this network block with:

rpi ~$ wpa_cli -ip2p-dev-wlan0
> p2p_group_add persistent=0

That's it.


Reference:
[1] want to generate own password while running p2p_group_add in wpa_cli

你可能感兴趣的:(wifi,linux,wpa_supplicant)