Turning your Linux laptop or desktop into a hotspot is a skill that can save you in a critical situation. Modern distributions like Ubuntu, Fedora or Linux Mint, have built-in mechanisms for creating hotspots, but users often encounter limitations of the graphical interface or the need to fine-tune frequencies. When the standard buttons stop working, command-line tools come to the rescue, providing full control over the network adapter.
In this article, we will examine in detail how to distribute the Internet via Wi-Fi using both graphical shells and utilities. nmcli And hostapdYou'll learn how to check whether your adapter supports monitor and access point modes, as well as how to bypass 5 GHz frequency limitations if your router or driver is behaving unpredictably.
We'll cover not only basic setup but also advanced techniques, including creating a bridge and working with virtual interfaces. This will allow you to establish a stable connection even on equipment that doesn't formally support AP mode out of the box. The Flexibility of Linux It is fully manifested here, allowing you to adapt the network stack to any needs.
⚠️ Important: When setting up a 5 GHz hotspot, ensure that your region (regdomain) in the system settings allows the use of the selected channels. Violating these restrictions may result in the system blocking the wireless module.
Checking access point mode support
Before you begin configuration, you need to ensure that your network adapter is physically and software-wise capable of operating in access point mode. Not all Wi-Fi modules support this feature, especially older or budget USB dongles. For diagnostics, we'll use a utility. iw, which provides detailed information about the driver's capabilities.
Open a terminal and enter the command to list the interfaces and their capabilities. We are interested in the section Supported interface modes. If the word is present among the listed modes AP, then your hardware is ready to use. The absence of this option means that you won't be able to share Wi-Fi programmatically without replacing the hardware.
iw list | grep -A 10 "Supported interface modes"
It's also worth checking if the wireless interface is blocked by software. Utility rfkill will show the blocking status. If you see the status Soft blocked: yes, you need to remove the lock with the command rfkill unblock wifiThis is a common problem after a kernel update or an improper system shutdown.
Open source drivers such as ath9k or iwlwifi, usually work more stably in hotspot mode than proprietary modules broadcom-staHowever, even proprietary solutions can often be customized through hostapd, if the standard NetworkManager methods do not work.
Creating a hotspot via NetworkManager (GUI)
The easiest way to share Wi-Fi on Linux is available to users of the GNOME, KDE, or XFCE desktop environments via the built-in network manager. In distributions based on Ubuntu And Fedora This functionality is integrated into the connections control panel. It's ideal for those who don't want to delve into the depths of the command line.
To get started, open the network settings and find the Wi-Fi section. The menu usually has a button called "Use as an access point" or "Turn On Wi-Fi Hotspot." The system will automatically create a virtual interface, assign IP addresses, and start the DHCP server. All you need to do is set the network name (SSID) and password.
- 📡 Click the network icon in the tray and select "Wi-Fi settings".
- 🔌 In the upper right corner of the window, find the menu (three dots) and select "Turn on Wi-Fi hotspot."
- 🔐 Set the network name and password in the dialog box that appears.
- ✅ Connect the client device and check internet access.
However, the graphical method has limitations. It often only works at 2.4 GHz, even if the adapter supports 5 GHz. Furthermore, in some versions of NetworkManager, enabling a hotspot can disconnect the primary Wi-Fi connection if you only have one physical adapter. Simultaneous reception and distribution require driver support for virtual interfaces.
Configuring an access point via nmcli
For more flexible management, especially on servers without a graphical shell, a utility is used nmcli (NetworkManager Command Line Interface). It allows you to create connections that persist after reboots and fine-tune security settings. reliable way organize a permanent access point.
First, let's create a new connection of the type wifi with the regime ap (Access Point). The command requires the interface name, SSID, password, and frequency. Below is an example of creating a hotspot named "MyLinuxHotspot" with the password "SecurePass123" on channel 6.
nmcli con add type wifi ifname wlan0 con-name MyHotspot autoconnect yes ssid MyLinuxHotspotnmcli con modify MyHotspot 802-11-wireless.mode ap 802-11-wireless.band bg
nmcli con modify MyHotspot 802-11-wireless.channel 6
nmcli con modify MyHotspot 802-11-wireless-security.key-mgmt wpa-psk
nmcli con modify MyHotspot 802-11-wireless-security.psk "SecurePass123"
nmcli con modify MyHotspot ipv4.method shared
nmcli con up MyHotspot
The key parameter here is - ipv4.method sharedThis is what forces NetworkManager to start a DHCP server and configure NAT (masquerading) so that clients can access the internet through your primary connection. Without this parameter, devices will connect but won't receive IP addresses.
If you want to use the 5GHz frequency, change the setting band on a and select the appropriate channel (e.g., 36 or 40). Keep in mind that not all client devices support 5 GHz, so for maximum compatibility, it's best to stay in the 2.4 GHz band unless speed is a critical factor.
⚠️ Warning: nmcli commands are case-sensitive and syntax-sensitive. An error in a parameter (e.g.,
802-11-wirelessinstead of the correct one) will result in connection failure. Copy the commands carefully.
Using Hostapd and dnsmasq for Advanced Users
When standard tools fail, a team comes into play hostapd And dnsmasqThis is the "heavy artillery" for Linux networks. Hostapd (Host Access Point Daemon) takes care of wireless interface management and client authentication, and dnsmasq distributes IP addresses. This method provides maximum control over the process.
First, you need to install the packages. In Debian/Ubuntu, this is done via apt install hostapd dnsmasqAfter installation, you need to create a configuration file. /etc/hostapd/hostapd.confIt specifies the driver parameters, network name, password, and frequency.
interface=wlan0driver=nl80211
ssid=MyAdvancedHotspot
hw_mode=g
channel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=ComplexPassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Next, you need to configure a static IP address for the interface and start the DHCP server. Unlike NetworkManager, you manually manage every step. This requires a basic understanding of the TCP/IP networking model, but it allows you to implement complex schemes, such as separating guest traffic or limiting client speeds.
Why use Hostapd instead of NetworkManager?
Hostapd consumes fewer resources, operates more predictably at the kernel level, and allows for the use of specific driver features hidden in NM abstractions. It's the choice for enthusiasts and server solutions.
Comparison of Wi-Fi distribution methods
The choice of method depends on your goals and level of experience. A graphical interface is good for quickly sharing photos from a phone, a command line is good for servers, and hostapd is for deep customization. Below is a table to help you decide on the right tools.
| Method | Complexity | Flexibility | Stability |
|---|---|---|---|
| GUI (NetworkManager) | Low | Low | Average |
| nmcli | Average | High | High |
| Hostapd + Dnsmasq | High | Maximum | High |
| Scripts (bash) | High | Maximum | Depends on the script |
For most users of distributions like Mint or Zorin OS The GUI capabilities are quite sufficient. However, if you plan to deploy an access point in a public place or on a Raspberry Pi, learning nmcli It will be a great investment of time. Automation via scripts allows you to activate the hotspot at system startup without user intervention.
Please remember that when using manual configuration methods (hostapd) you will have to write the rules yourself. iptables for traffic forwarding (NAT). In NetworkManager, this happens automatically thanks to the parameter shared.
Solving typical problems and errors
A common issue is the "Could not start source mode" error or the inability to activate the access point. This is often due to the driver not supporting simultaneous operation in client and access point modes on the same channel. The solution is to use virtual interfaces or switch the primary connection to Ethernet.
If devices connect but do not receive an IP address, check your firewall settings (ufw or firewalld). They may block DHCP requests (UDP ports 67/68). You need to add an allow rule for the corresponding interface.
- 🔍 Check the logs:
journalctl -u NetworkManager -fwill help track the error in real time. - 🔄 Restarting the network service:
sudo systemctl restart NetworkManageroften solves daemon freezes. - 📡 Change channel: Try channels 1, 6 or 11, they are less susceptible to interference.
Another important consideration is power saving. Some adapters turn off to save power, disconnecting from clients. Disable power saving mode for Wi-Fi in the TLP configuration or through the driver settings to ensure stable hotspot operation.
☑️ Hotspot Problem Diagnosis
Questions and Answers (FAQ)
Is it possible to receive and broadcast Wi-Fi at the same time?
Yes, this is possible, but only if your Wi-Fi adapter and driver support virtual interfaces. In this case, the physical card is divided into two logical channels. If this isn't supported, you'll need a second USB Wi-Fi adapter or an Ethernet cable to connect to the internet.
Why isn't Wi-Fi sharing working on the 5 GHz frequency?
The 5 GHz frequency requires regional settings (regdomain). If the system is set to a region where certain 5 GHz channels are prohibited, the access point will not start. Check the region settings with the command iw reg get and change them if necessary through iw reg set.
How can I make the hotspot turn on automatically on boot?
When using nmcli it's enough to add a flag autoconnect yes when creating a connection. NetworkManager will automatically try to raise the access point at startup. For hostapd You need to enable and configure the corresponding systemd service.
Is it safe to use a public hotspot on Linux?
Using WPA2/WPA3 with a strong password provides basic protection. However, for complete security, it is recommended to use AP isolation to prevent devices from seeing each other, and to keep your system up-to-date, as vulnerabilities in the network stack can be critical.