Unstable internet connections on Linux systems often come as an unpleasant surprise to newcomers, even though the Linux kernel is renowned for its network stability. Wireless connection issues in Ubuntu Problems can arise due to driver conflicts, aggressive power-saving settings, or improper router configuration. Unlike proprietary systems, this approach gives the user full control over the network stack, but requires an understanding of the terminal's basic operating principles.
Before undertaking any complex operations, it's necessary to conduct a preliminary diagnosis of the current network state. Often, the solution lies in simple steps: rebooting network interfaces or updating the driver database. Connection stability directly depends on the quality of interaction between the hardware of the Wi-Fi adapter and the software shell of the operating system.
In this guide, we'll explore proven methods for eliminating connection interruptions and improving data transfer speeds. You'll learn how to manage network priorities, disable interfering features, and configure DNS settings to speed up response times. Changing DNS servers to public ones (for example, Google or Cloudflare) often solves the problem of long waits when loading pages, even if the channel speed is low.
Diagnostics of the current network state
The first step should always be collecting information about the specific adapter being used and the driver responsible for it. Without this information, any further actions will be like shooting blindfolded. In the terminal, you need to run a command that will display detailed information about the network devices.
lspci -knn | grep -iA2 net
For USB adapters, use the command lsusb. Pay attention to the line Kernel driver in use: if it is empty or contains a name ath9k, iwlwifi or rtl8xxxu, which means the basic driver is loaded. However, the presence of the driver does not guarantee its correct operation.
Check the signal level and connection quality using the utility iwconfig or more modern iwLow signal strength (less than -70 dBm) is often a physical cause of connection drops, which is difficult to fix with software. In such cases, the only solution is to move the router or install an external antenna.
⚠️ Attention: If the command outputdmesg | grep firmwareIf you see errors related to missing firmware files, it means that your device requires additional binaries, which are often included in the package.linux-firmware.
Installing and updating drivers
One of the most common reasons for unstable Wi-Fi is the use of drivers from the repository linux-firmware, which may be outdated for new devices. Ubuntu has a convenient mechanism for managing additional drivers that allows you to switch between open and proprietary versions.
Open the Additional Drivers app (Software & Updates -> Additional Drivers) and wait for the system to scan for devices. If the system offers an alternative driver for your Wi-Fi module, such as one from Broadcom or Realtek, it might be worth trying.
Broadcom devices often require a package bcmwl-kernel-sourceYou can install it via a terminal, after connecting to the internet using another method (for example, a USB modem or cable).
sudo apt update
sudo apt install bcmwl-kernel-source
After installation, be sure to reboot your system. Drivers can sometimes conflict with new kernel versions, so it's important to stay up-to-date with system updates. Regular kernel updates frequently brings fixes for network controllers.
⚠️ Warning: When installing drivers from third-party PPA repositories, always check the repository's last update date. Using abandoned sources may lead to system instability after a kernel update.
Setting up energy saving options
By default, Ubuntu is configured to maximize power savings, which is especially important for laptops. However, this feature often results in the Wi-Fi adapter periodically disconnecting or reducing its power to conserve battery life, which causes connection drops.
To disable power saving for Wi-Fi, you need to edit the NetworkManager configuration file. Create or open the file /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf.
sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
Find the line that starts with wifi.powersave, and change its value to 2. A value of 3 means power saving is enabled, and 2 means it's disabled. This action will force the adapter to run in maximum performance mode at all times.
☑️ Optimization checklist
After making changes, restart the network management service with the command sudo systemctl restart NetworkManagerThe effect should be noticeable immediately: micro-delays and network outages during downtime will disappear.
It's worth noting that some adapters may ignore these settings if they're hardcoded into the device's firmware. In this case, the only solution is to upgrade the hardware or use an external adapter with better Linux support.
IPv6 and DNS Optimization
The IPv6 protocol, implemented by ISPs, can cause connection delays in some Ubuntu configurations while the system attempts to resolve addresses. If your ISP doesn't require IPv6, you can disable it or prioritize IPv4.
To disable IPv6, create a configuration file in /etc/sysctl.d/This will speed up the process of obtaining an IP address and eliminate lag when opening pages in the browser.
sudo nano /etc/sysctl.d/99-disable-ipv6.conf
Add the following line to the file net.ipv6.conf.all.disable_ipv6 = 1 and save the changes. Apply the settings with the command sudo sysctl -pIt is also critical to set up fast DNS servers.
| DNS provider | Preferred DNS | Alternative DNS | Peculiarities |
|---|---|---|---|
| Google Public DNS | 8.8.8.8 | 8.8.4.4 | High speed, global availability |
| Cloudflare | 1.1.1.1 | 1.0.0.1 | Focus on privacy and speed |
| OpenDNS | 208.67.222.222 | 208.67.220.220 | Phishing filtering |
| Quad9 | 9.9.9.9 | 149.112.112.112 | Blocking malicious domains |
You can change DNS in the network settings graphical interface or through the terminal by editing the file /etc/resolv.conf (Although in modern systems, it's better to do this through NetworkManager.) Using a reliable DNS significantly speeds up website response times.
Network priority and roaming management
If you move between multiple access points or use a USB modem in addition to Wi-Fi, the system may try to switch between them, causing disconnects. In Ubuntu, you can configure connection priority.
In the connection settings (via nm-connection-editor) You can set a metric for each interface. The lower the number, the higher the priority. Set the metric to 100 for a wired connection and 200 for Wi-Fi to make the system prefer cable.
Aggressive roaming is also worth paying attention to. If you're in range of several routers with the same SSID, the adapter may constantly scan the airwaves for the "best" signal, interrupting your current connection. Disabling background scanning may help.
The command used for this is iw, but be careful: some drivers don't support manual scanning control. In such cases, adjusting the parameter scan_radar_time in the kernel module.
⚠️ Note: Interfaces and commands for managing roaming may vary depending on the NetworkManager version and the backend used (wpa_supplicant or iwd). Please check the syntax against the documentation for your distribution version.
Works with 2.4 GHz and 5 GHz frequency ranges
Modern routers operate in two bands: the congested 2.4 GHz band and the freer 5 GHz band. Sometimes Ubuntu defaults to the weaker 2.4 GHz signal, ignoring the faster 5 GHz band, or, conversely, loses connection to the 5 GHz band over distance.
You can force the adapter to use a preferred band. To do this, you need to know the name of your wireless interface (usually wlan0 or wlp2s0) and use the command iw.
sudo iw dev wlan0 set txpower fixed 20
Although this command adjusts the power, it's better to use the router settings to select the frequency, separating the SSIDs for different frequencies (for example, HomeWiFi and HomeWiFi_5G). Then, in Ubuntu, simply connect to the desired network.
Why is 5 GHz better?
The 5 GHz band provides higher data transfer speeds and is less susceptible to interference from microwaves and neighboring routers, but has a shorter range and is less able to penetrate walls.
If your adapter is older, it may not support 5 GHz. Check the model specifications. Wi-Fi module On the manufacturer's website. Using a dual-band USB adapter (AC or AX standard) is the best solution for older laptops.
Reset and restart network services
Sometimes accumulated errors in the DNS cache or network daemons require a complete reset. Instead of rebooting the computer, you can restart just the network services, which often resolves the "connected, but no internet" issue.
A comprehensive reset can be performed with the following sequence of commands. They will clear the cache, reset IP settings, and restart the connection manager.
sudo systemctl restart NetworkManagersudo ip link set wlan0 down
sudo ip link set wlan0 up
sudo dhclient -r
sudo dhclient
These commands will force the connection to be disconnected, request a new IP address from the router, and update the DNS cache. This is the "gold standard" of first aid for network problems in Linux.
If all else fails, delete the NetworkManager configuration files (after making a copy of them) so that the system recreates them with factory settings. The files are located in /etc/NetworkManager/system-connections/.
Why is Wi-Fi slower in Ubuntu than in Windows on the same laptop?
Drivers are often the issue. In Windows, laptop manufacturers supply optimized proprietary drivers, while Linux uses universal open-source drivers that may not utilize the hardware's full potential. Windows also has different power-saving settings.
How do I know if my adapter supports monitor mode for network auditing?
Use the command iw listIn the output, find the "Supported interface modes" section. If the word "monitor" is there, your adapter supports this mode. Most modern Atheros cards and some Realtek cards support it out of the box.
Is it possible to increase Wi-Fi transmit power in Ubuntu?
Theoretically yes, by team iwconfig or iw, but this is limited by the driver and legislation in your country. Exceeding the permissible power may result in fines and interference with other equipment. Software increases often don't provide real gains without hardware support.