In today's mobile world, access to the global network is becoming a critical resource, and the Linux operating system, in particular the distribution Ubuntu, often serves as a reliable platform for setting up a workspace. Sometimes situations arise when only a computer has wired internet, while smartphones, tablets, or other gadgets require a wireless connection. Turning your PC into a full-fledged access point isn't just a convenient feature, but often a necessary measure to ensure the uninterrupted operation of the entire device ecosystem.
Modern versions of the distribution, such as Ubuntu 22.04 LTS or 24.04, are equipped with built-in tools that allow you to activate hotspot mode in just a few clicks. However, behind the simple interface lies a complex network settings system controlled by daemons. NetworkManager And systemdUnderstanding how these components work will help you not only enable the feature but also properly configure security to ensure your communication channel remains protected from unauthorized access.
In this article, we'll take a detailed look at software methods for creating a wireless network, focusing on the command line for advanced users, and examining potential hardware limitations. You'll learn how to avoid common driver errors and ensure stable data transfer rates for all connected clients. A willingness to experiment with configuration files will give you an advantage in unusual situations.
Checking network adapter compatibility
The first and most important step before attempting to share the internet is to diagnose your wireless module. Not all Wi-Fi adapters support this mode. Master Mode (access point mode), and many budget models are limited to client mode only. To obtain accurate information about the capabilities of your equipment, you need to use the utility iw, which is the de facto standard for managing wireless devices in Linux.
Open a terminal and enter the command to check supported interfaces. You're looking for the "Supported interface modes" line, which should include the word "AP." If this abbreviation isn't listed, you won't be able to programmatically launch an access point on this specific adapter without replacing the drivers or the hardware itself. In some cases, older drivers nl80211 may not display capabilities correctly, so it's always a good idea to check your firmware is up to date.
⚠️ Attention: Some USB adapters contain chips Realtek Require installation of additional packages from PPA repositories to function correctly in access point mode. Standard kernel drivers may not activate the required features.
It's also worth considering the physical frequency range. Modern routers and adapters operate in both the 2.4 GHz and 5 GHz bands. Older devices may not see the network if you force them to use only the 5 GHz band, while newer devices, on the contrary, will operate more slowly in the crowded 2.4 GHz band. Flexible configuration allows you to tailor the network to your specific needs.
Setting up an access point via a graphical interface
For most users, the graphical shell GNOME, which is the default in Ubuntu, provides the fastest and most intuitive way to set up a network. You don't need to know the command line or edit system files, as all the necessary options are located in the standard settings menu. This method is ideal for quickly setting up a temporary network in a cafe, office, or hotel room.
To activate this mode, go to system settings and find the "Wi-Fi" section. In the upper-right corner of the window, you'll see a menu where you should select "Use as Hotspot." The system will automatically suggest a network name (SSID) and generate a password, which you can change to something easier to remember. After confirming the setting, the network will become active and discoverable.
☑️ Check before launching Hotspot
It's important to note that when switching to access point mode, your computer may lose connection to another Wi-Fi network if you're using the same physical adapter. This is normal behavior, as the radio module can't simultaneously receive a signal from the router and broadcast its own if it doesn't support the technology. concurrent APIn this case, the Internet will be distributed to client devices via an Ethernet cable or USB modem.
Creating a Wi-Fi network via the terminal (nmcli)
For system administrators and minimalism lovers, tools nmcli (NetworkManager Command Line Interface) provides complete control over network connections. Using the command line allows you to automate the access point creation process by writing scripts to run automatically at system startup. This is especially useful for server versions of Ubuntu, which lack a graphical interface.
Creating a new connection is done by adding a profile with the type wifi and the regime apYou'll need to specify the interface name, network SSID, password, and security mode. For example, this command will create a network with WPA2 encryption, which is the current security standard. After creating the profile, you need to activate it, which only takes a few seconds.
nmcli connection add type wifi ifname wlan0 con-name "MyHotspot" ssid "UbuntuNet" mode apnmcli connection modify "MyHotspot" 802-11-wireless-security.key-mgmt wpa-psk
nmcli connection modify "MyHotspot" 802-11-wireless-security.psk "StrongPassword123"
nmcli connection up "MyHotspot"
The management of created profiles is also carried out through nmcliYou can change security settings at any time, disconnect the connection, or completely delete the profile if it's no longer needed. The flexibility of the command line allows you to fine-tune settings unavailable in the graphical interface, such as forcing a broadcast channel or bandwidth.
Reset network settings
If regular Wi-Fi stops working after experimenting with nmcli, use the "nmcli connection delete" command to delete the created profiles or reset NetworkManager settings via systemctl.
Using the create_ap utility for advanced features
When standard tools are not enough, a utility comes to the rescue create_ap, which is a script that combines hostapd, dnsmasq and network settings into one convenient tool. It allows you to create access points with NAT, forward internet from one interface to another, and even create bridges. This solution is popular among users who need the functionality of a full-fledged router in a laptop.
The utility is usually installed by cloning the GitHub repository or via a package manager if the version in the repositories is recent enough. The main advantage create_ap The script allows you to quickly change parameters on the fly without having to restart network services or manually edit configuration files. The script will automatically detect available channels and optimize settings.
| Parameter | Description | Example of meaning |
|---|---|---|
-c |
Broadcast channel | 6 (for 2.4 GHz) |
--hw-mode |
Operating mode (a/b/g/n/ac) | ac |
--hidden |
Hide network SSID | true/false |
--no-virt |
Do not create a virtual interface | false |
Despite the power of the tool, it is worth remembering that it may conflict with active connections. NetworkManagerBefore launch create_ap It is recommended to disable Wi-Fi management using standard system tools to avoid IP address conflicts or freezing of the wireless module. After the script completes, the network will need to be re-established using standard methods.
Solving typical problems and errors
During setup, users often encounter a situation where the access point is created, but clients are unable to connect or do not receive an IP address. The most common cause is incorrect service configuration. dnsmasq, which is responsible for distributing addresses. Check the system logs via journalctlto identify interface initialization errors.
Another common issue is power saving. Laptops running Ubuntu may automatically disable the Wi-Fi module or reduce its power to conserve battery life, resulting in disconnected connections with clients. You should disable power saving mode for the wireless adapter in the configuration files. TLP or NetworkManager.
⚠️ Note: Network settings interfaces and package names may change with the release of new Ubuntu versions. If the command doesn't work, check the syntax in the official documentation for your distribution.
It's also worth mentioning the problem of "dead zones" or weak signals. Built-in laptop antennas are often inferior to external routers. If you need to cover a large area, consider using an external USB adapter with a stronger antenna, which you can connect to your PC and configure as the primary device for distributing the signal.
Optimizing network speed and security
Once your network is successfully up and running, it's important to ensure it runs quickly and securely. Using an encryption protocol WPA2 or WPA3 This is a mandatory requirement, as open networks expose users' data to the risk of interception. Ubuntu uses WPA2 by default, which provides a good balance between compatibility and security.
To optimize speed, pay attention to channel selection. In apartment buildings, the 2.4 GHz band is often clogged with neighboring networks, causing interference and speed drops. Using the utility wavemon or iwlist will help you find the least congested channel and switch the access point to it, significantly improving the connection quality.
- 📡 Use the 5 GHz band for transferring large files and video streaming, as it is less noisy.
- 🔒 Change your hotspot password regularly, especially if it is used by temporary guests.
- ⚙️ Turn off your access point when not in use to reduce your attack surface and save resources.
Keep in mind that turning your computer into an access point increases the load on the processor and cooling system. When actively transferring data, make sure your laptop is in a well-ventilated area. Network stability directly depends on the technical condition of your equipment.
Firewall impact
If clients connect but the internet isn't working, check your UFW rules. IP forwarding may be blocked.
Frequently Asked Questions (FAQ)
Is it possible to receive and broadcast Wi-Fi at the same time?
In most cases, a single physical adapter cannot simultaneously operate as a client (STA) and access point (AP) on the same frequency. However, dual-band adapters exist that can receive a signal on 5 GHz and broadcast on 2.4 GHz, or vice versa. Using a second USB Wi-Fi adapter is also possible.
Why do phones see the network but say "Failed to connect"?
Most often, this is a problem with the security protocol or channel. Try changing the broadcast channel in the access point settings or temporarily disabling SSID hiding. Also, check if there are any MAC address restrictions.
How to share the Internet if it is via a USB modem (3G/4G)?
When creating a hotspot in Ubuntu, select your USB modem as the internet source. The system will automatically configure NAT (masquerading), and traffic from Wi-Fi clients will be routed through the mobile network. Speed will be limited by the mobile network's signal.
Are access point settings reset after reboot?
If you created your profile through nmcli or a graphical interface, it will be saved in the system and will automatically start upon connection if autostart is configured. Scripts create_ap require separate configuration of autoload via systemd or rc.local.