NetworkManager(nmcli)를 사용하여 WiFi Direct(WiFi-P2P)를 설정해야 하는 경우가 있었습니다. 현재 우분투 20.04를 사용하고 있습니다. 내 네트워크 어댑터가 WiFi-P2P 연결을 지원해야 하는 것 같습니다.
iw 목록 출력:
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* monitor
* P2P-client
* P2P-GO
* P2P-device
valid interface combinations:
* #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1, #{ P2P-d evice } <= 1,
total <= 3, #channels <= 2
안타깝게도 NetworkManager 기능을 사용하여 P2P-GO와 WiFi-Direct 연결을 설정하는 방법에 대한 공식 정보를 찾을 수 없습니다. 포럼에서 일부 게시물만 찾아서 병합했습니다.
nmcli connection add connection.type wifi-p2p ifname p2p-dev-wlp1s0 wifi-p2p.peer <REMOTE DEVICE MAC> autoconnect no
nmcli con up wifi-p2p-p2p-dev-wlp1s0
불행히도 작동하지 않습니다. 다음 출력을 얻습니다.
nmcli con up wifi-p2p-p2p-dev-wlp1s0
Error: Connection activation failed: The base network connection was interrupted
Hint: use 'journalctl -xe NM_CONNECTION=5e2e6f4a-0818-4344-afc1-70fd6b490c0d + NM_DEVICE=p2p-dev-wlp1s0' to get more details
NetworkManager[659]: <info> [1645564279.6405] manager: (p2p-dev-wlp1s0): new 802.11 Wi-Fi P2P device (/org/freedesktop/NetworkManager/Devices/6)
NetworkManager[2525]: <info> [1645564287.3484] manager: (p2p-dev-wlp1s0): new 802.11 Wi-Fi P2P device (/org/freedesktop/NetworkManager/Devices/6)
NetworkManager[2525]: <info> [1645564287.3495] device (p2p-dev-wlp1s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
NetworkManager[2525]: <info> [1645564287.3530] device (p2p-dev-wlp1s0): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed')
NetworkManager[2525]: <info> [1645564314.1324] device (p2p-dev-wlp1s0): state change: disconnected -> unavailable (reason 'supplicant-failed', sys-iface-state: 'managed')
NetworkManager[2525]: <info> [1645564344.0619] device (p2p-dev-wlp1s0): state change: unavailable -> disconnected (reason 'supplicant-available', sys-iface-state: 'managed')
NetworkManager[2525]: <info> [1645566035.2989] device (p2p-dev-wlp1s0): Activation: starting connection 'wifi-p2p-p2p-dev-wlp1s0' (5e2e6f4a-0818-4344-afc1-70fd6b490c0d)
NetworkManager[2525]: <info> [1645566035.2996] device (p2p-dev-wlp1s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
NetworkManager[2525]: <info> [1645566039.0283] device (p2p-dev-wlp1s0): state change: prepare -> unavailable (reason 'supplicant-failed', sys-iface-state: 'managed')