Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4906

Networking and servers • Re: Both access point and Wi-Fi connection on the same device (Network Manager solution)

$
0
0
Creating a wireless hotspot and sharing internet using nmcli with a single wifi adapter

I myself use a solution for raspberry pi 4&5 to create an AP-STA mode with networkmanager

Creating a wireless hotspot and sharing internet using nmcli with a single wifi adapter

it should also work for Raspberry Pi Zero 2 W because I was able to read on the net by searching for "raspberry-pi-zero-2-w-simultaneous-ap-and-client"

RaspAP has an option called AP-STA that allows this. Confirmed to work on my Raspberry Pi Zero 2 W.

To have the AP-STA with a single wifi adapter

Add the script below with the name 00-virtualwlan1 in /etc/NetworkManager/dispatcher.d with execution rights for the file
(restart the machine to activate)
and thus to have a wlan1 virtual card at each startup (see iw command)

wlan0 is the STA
wlan1 is the AP

Code:

# cat /etc/NetworkManager/dispatcher.d/00-virtualwlan1#!/bin/shif [ "$1" = "wlan0" ]thenif [ "$2" = "up" ]then    # create wlan1 interface for AP    ### SSID="interface name networkmanager"    SSID=$(nmcli -g NAME,ACTIVE  connection | grep -s ":no$" | cut -d':' -f1)sudo iw dev wlan0 interface add wlan1 type __apsudo nmcli c modify $SSID connection.interface-name wlan1sudo nmcli con up id $SSID# echo $SSID >>var/testme1fiif [ "$2" = "down" ]then      # delete wlan1 interface      sudo iw dev wlan1 del fifiexit 0

Statistics: Posted by Seolmedia — Sat Jun 15, 2024 7:31 am



Viewing all articles
Browse latest Browse all 4906

Trending Articles