lakinduakash / linux-wifi-hotspot

Feature-rich wifi hotspot creator for Linux which provides both GUI and command-line interface. It is also able to create a hotspot using the same wifi card which is connected to an AP already ( Similar to Windows 10).
BSD 2-Clause "Simplified" License
3.15k stars 294 forks source link

Not able to use wifi and enable hotspot at the same time. 😕 #263

Open SohamMalakar opened 2 years ago

SohamMalakar commented 2 years ago

Describe the bug wihotspot doesn't let me simultaneously enable the wifi and the hotspot. But instead, it shows me this- ERROR: Your adapter can not be a station (i.e. be connected) and an AP at the same time.

To Reproduce Steps to reproduce the behaviour:

  1. Enable the router and connect the PC via system settings. (e.g. GNOME settings) image
  2. Start the program by entering the wihotspot command on the terminal to see the error logs. image
  3. Now, clicking the Create hotspot button while setting both the Wifi interface and the Internet interface to a wireless network adapter (e.g. wlp4s0) will log an error message to the terminal. image

Network Adapters:

~ 
❯ sudo lshw -class network
  *-network                 
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: eno1
       version: 10
       serial: 54:05:db:ea:93:ac
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.15.0-46-generic firmware=rtl8168g-3_0.0.1 04/23/13 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:39 ioport:3000(size=256) memory:d1704000-d1704fff memory:d1700000-d1703fff
  *-network
       description: Wireless interface
       product: RTL8822CE 802.11ac PCIe Wireless Network Adapter
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: wlp4s0
       version: 00
       serial: 30:c9:ab:d4:09:cd
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rtw_8822ce driverversion=5.15.0-46-generic firmware=N/A ip=192.168.200.79 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:70 ioport:2000(size=256) memory:d1600000-d160ffff

Desktop:

Updates:

sigmaSd commented 2 years ago

It seems that your hardware doesn't support this.

SohamMalakar commented 2 years ago

Ahhh it sucks but I was confused because I can enable the hotspot and the wifi at the same time in windows. I thought it could be a driver issue.

sigmaSd commented 2 years ago

Its very probable that the wifi driver situation is better on windows

You can test if the script can get further but removing this if condition https://github.com/lakinduakash/linux-wifi-hotspot/blob/177c36c9e09409c58b6019b6ea80fe9edb5eb879/src/scripts/create_ap#L1379

SohamMalakar commented 1 year ago

Its very probable that the wifi driver situation is better on windows

You can test if the script can get further but removing this if condition

https://github.com/lakinduakash/linux-wifi-hotspot/blob/177c36c9e09409c58b6019b6ea80fe9edb5eb879/src/scripts/create_ap#L1379

Still no progress... I've commented out the if condition but now it's giving me the following error:

Config dir: /tmp/create_ap.wlp4s0.conf.VTritXhY
PID: 34186
Network Manager found, set ap0 as unmanaged device... DONE
wlp4s0 is already associated with channel 40 (5200 MHz)
multiple channels not supported,

fallback to channel 40
Creating a virtual WiFi interface... ap0 created.
RTNETLINK answers: Device or resource busy

ERROR: Maybe your WiFi adapter does not fully support virtual interfaces.
       Try again with --no-virt.

Doing cleanup.. done

Sorry for the late reply btw.

maravento commented 1 year ago

It also doesn't work with intel wireless 3160 (ubuntu mate 22.04.1). It stays forever create hotspot

connecting

cat /etc/create_ap.conf
CHANNEL=default
GATEWAY=192.168.12.1
WPA_VERSION=2
ETC_HOSTS=0
DHCP_DNS=gateway
NO_DNS=0
NO_DNSMASQ=0
HIDDEN=0
MAC_FILTER=0
MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept
ISOLATE_CLIENTS=0
SHARE_METHOD=nat
IEEE80211N=0
IEEE80211AC=0
HT_CAPAB=[HT40+]
VHT_CAPAB=
DRIVER=nl80211
NO_VIRT=0
COUNTRY=
FREQ_BAND=2.4
NEW_MACADDR=
DAEMONIZE=0
DAEMON_PIDFILE=
DAEMON_LOGFILE=/dev/null
NO_HAVEGED=0
WIFI_IFACE=wlp1s0
INTERNET_IFACE=wlp1s0
SSID=MyAccessPoint
PASSPHRASE=12345678
USE_PSK=0

and...

sudo systemctl status hostapd.service
hostapd.service - Access point and authentication server for Wi-Fi and Ethernet
     Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Tue 2023-05-30 15:47:59 -05; 905ms ago
       Docs: man:hostapd(8)
    Process: 1248376 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=1/FAILURE)
        CPU: 4ms