Simultaneous WiFi + Hotspot on Linux β without disconnecting
A lightweight C tool with a responsive ncurses TUI that creates a virtual AP interface alongside your existing WiFi connection, enabling internet sharing while staying connected.
On most Linux distributions (including Zorin, Ubuntu, Mint), enabling a Wi-Fi hotspot disconnects you from your current WiFi network. This is because the built-in hotspot feature takes exclusive control of the wireless adapter.
Linux Hotspot Enabler solves this by leveraging AP/STA concurrency β creating a virtual access point (ap0) on the same radio as your WiFi client connection, so both run simultaneously.
| Feature | Description |
|---|---|
| π‘ Simultaneous WiFi + Hotspot | Stay connected to WiFi while sharing your internet |
| π₯οΈ Responsive TUI | Beautiful ncurses terminal interface with 4 screens |
| π§ Auto-Detection | Automatically finds WiFi interface, channel & AP support |
| π Cross-Distro | Ubuntu, Zorin, Debian, Mint, Arch, Fedora, RHEL & more |
| π₯ Live Client Monitoring | See connected devices with IP, MAC, and hostname |
| π WPA2 Security | Hotspot is password-protected with WPA2/CCMP |
| π Auto Band Detection | Automatically matches client band (2.4/5 GHz) |
| π§Ή Clean Shutdown | Properly removes virtual interfaces, NAT rules & temp files |
| βοΈ Configurable | Edit SSID, password, channel, 5GHz mode, hidden network |
ββ WiFi Client ββββββββββββββββββββββββ ββ Hotspot βββββββββββββββββββββββββββββ
β Status: Connected β β Status: RUNNING β
β SSID: MyNetwork β β SSID: LinuxHotspot β
β IP: 192.168.1.42 β β Interface: ap0 β
β Channel: 6 β β Clients: 2 β
β Signal: -45 dBm β β Uptime: 1h 23m 15s β
βββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββ
ββ Hotspot Configuration ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SSID: LinuxHotspot β
β Password: β’β’β’β’β’β’β’β’β’β’β’β’ β
β Channel: Auto (match client) β
β Band: 2.4 GHz (auto) β
β Hidden: No β
β Max Clients: 10 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Tool | Purpose |
|---|---|
iw |
Wireless interface management |
hostapd |
Access Point daemon |
dnsmasq |
DHCP & DNS server for hotspot clients |
iptables |
NAT/firewall rules for internet sharing |
ncurses |
Terminal UI library (dev headers) |
gcc / make |
Build toolchain |
sudo apt update && sudo apt install -y iw hostapd dnsmasq iptables libncurses-dev build-essentialsudo pacman -Sy --noconfirm iw hostapd dnsmasq iptables ncurses base-develsudo dnf install -y iw hostapd dnsmasq iptables ncurses-devel gcc makesudo zypper install -y iw hostapd dnsmasq iptables ncurses-devel gcc make# Clone the repository
git clone https://github.com/SudharshanAIML/linux-hotspot-enabler.git
cd linux-hotspot-enabler
# Build
make
# (Optional) Install system-wide
sudo make installTo uninstall:
sudo make uninstallsudo ./hotspot-enablerNote: Root privileges are required to manage network interfaces, hostapd, dnsmasq, and iptables rules.
| Key | Action |
|---|---|
F1 |
Dashboard β WiFi & Hotspot status overview |
F2 |
Config β Edit SSID, password, channel, band |
F3 |
Clients β View connected devices |
F4 |
Log β Event and error log |
Tab |
Cycle through screens |
Enter |
Start/Stop hotspot (Dashboard) Β· Edit field (Config) |
β / β |
Navigate fields or scroll logs |
q |
Quit (with clean shutdown) |
ββββββββββββββββ ββββββββββββββββ
β Internet βββββββββββ Router β
ββββββββ¬ββββββββ ββββββββ¬ββββββββ
β β WiFi (e.g. channel 6)
β ββββββββ΄ββββββββ
β β wlo1 β β Your WiFi client
β β (managed) β
β ββββββββββββββββ€
β iptables NAT β ap0 β β Virtual AP interface
βββββββββββββββββββ (__ap) β
β ββββββββ¬ββββββββ
β β Hotspot (same channel)
β ββββββββ΄ββββββββ
β β Clients β
β β Phone, Tab β
β ββββββββββββββββ
- Detect your active WiFi interface and verify AP/STA concurrency support
- Create a virtual AP interface (
ap0) on the same physical radio - Configure NetworkManager to ignore the AP interface
- Launch
hostapdto broadcast your hotspot SSID (WPA2 secured) - Assign IP address to
ap0and configure the gateway - Launch
dnsmasqto provide DHCP/DNS to connected clients - Configure
iptablesNAT to forward traffic: hotspot β WiFi β internet - Monitor connections and provide live status via the TUI
- Stop
hostapdanddnsmasqprocesses - Remove
iptablesNAT rules - Delete the virtual
ap0interface - Restore NetworkManager configuration
- Clean up all temporary config files
linux-hotspot-enabler/
βββ include/
β βββ hotspot.h # Hotspot config, status structs & API
β βββ net_utils.h # Network utility structs & functions
β βββ tui.h # TUI state, screens & rendering
βββ src/
β βββ main.c # Entry point, root check, dependency verify
β βββ hotspot.c # Core hotspot management (hostapd, dnsmasq, NAT)
β βββ net_utils.c # Interface detection, AP support, client listing
β βββ tui.c # ncurses TUI (dashboard, config, clients, log)
βββ Makefile # Build system
βββ .gitignore
βββ LICENSE
βββ README.md
Your WiFi adapter must support AP/STA concurrency (most modern adapters do). Verify with:
iw list | grep -A 8 "valid interface combinations"Look for output containing both managed and AP:
valid interface combinations:
* #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1,
total <= 3, #channels <= 2
- Linux kernel 4.0+ (for proper nl80211 AP/STA support)
- Root/sudo access
- Active WiFi connection (to share internet from)
β "WiFi adapter does not support AP+STA concurrency"
Your adapter may not support running AP and client mode simultaneously. Try:
iw list | grep -A 8 "valid interface combinations"If the output does not show both managed and AP, your adapter's driver doesn't support this feature.
Workaround: Use a second USB WiFi adapter dedicated to the hotspot.
β "Failed to create virtual AP interface"
- Ensure your WiFi driver is loaded:
lsmod | grep <your_driver> - Check if rfkill is blocking:
rfkill listβsudo rfkill unblock wifi - Try unloading and reloading your WiFi driver
β "hostapd failed"
- Check the hostapd log:
cat /tmp/hotspot_enabler_hostapd.log - Ensure
hostapdisn't already running:sudo pkill hostapd - Your adapter may not support the selected channel β try a different one in Config (F2)
β "Failed to start dnsmasq"
Another DNS service may be using port 53:
sudo systemctl stop systemd-resolved
sudo systemctl stop dnsmasqThen try again.
β Clients connect but have no internet
- Verify IP forwarding:
cat /proc/sys/net/ipv4/ip_forward(should be1) - Check iptables rules:
sudo iptables -t nat -L - Ensure your WiFi connection itself has internet access
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License β see the LICENSE file for details.
Made with β€οΈ for the Linux community
If this project helped you, consider giving it a β!