How to Set Up Wi-Fi in Ubuntu: From Beginner to Pro

Transition to an operating system Linux is often accompanied by the expectation of difficulties with the network connection, however, modern distributions such as Ubuntu, have powerful automatic configuration tools. In most cases, the system automatically detects the wireless adapter and offers a list of available networks immediately after installation, but sometimes users encounter missing drivers or configuration conflicts. Understanding how the Linux network stack works will allow you to quickly troubleshoot issues and ensure stable internet access.

In this article, we'll cover all aspects of setting up a wireless connection: from simple network selection in the graphical interface to in-depth configuration via the command line. You'll learn how to check driver status, set up a static IP address, and diagnose the causes of an unstable signal. Proper network setup — is the foundation for comfortable work in any operating system, and Ubuntu is no exception, providing flexible tools for any use case.

Before taking any action, make sure your wireless module is physically enabled and not blocked by hardware switches on the laptop. Sometimes the problem isn't software-related, but something as simple as Wi-Fi or airplane mode being disabled. Let's look at how the system sees your hardware and what steps you need to take to get started.

Hardware diagnostics and driver testing

The first step in resolving any connection issues is identifying the wireless adapter. The operating system must correctly recognize the device in order to load the appropriate kernel module. For detailed information about the installed hardware, you can use the utility lspci for internal cards or lsusb For external USB adapters. These commands will list all connected devices with their vendor IDs, which is critical for finding specific drivers.

Users often encounter a situation where an adapter is detected but doesn't work due to a lack of proprietary firmware. Ubuntu has a convenient mechanism for managing additional drivers that automatically scans the system and offers to install missing components. This is especially relevant for owners of laptops with adapters. Broadcom or Realtek, which often require closed binary modules to function properly.

If standard methods don't help, you need to check whether the interface is blocked programmatically. Utility rfkill Shows the wireless interface lock status and allows you to manage them. Locks can be either "hard" (hardware) or "soft" (software), and resolving each requires different approaches. Below is a table of the main diagnostic commands:

Team Description of action Result of execution
lspci | grep -i network Finding PCI network controllers Displaying the adapter model and vendor
rfkill list all Checking the blocking status List of interfaces with Soft/Hard block flags
ip link show Displaying the status of links UP/DOWN status and MAC addresses of interfaces
nmcli device status Device status in NetworkManager Shows whether the device is connected or disconnected
⚠️ Note: If you see the "hard blocked" status when running the rfkill command, software unlocking methods won't work. You'll need to find a physical switch on the laptop case or use a key combination (usually Fn + the antenna key).

It's important to understand the difference between a missing driver and one that's not working properly. In the former case, the system simply doesn't see the device as a network interface; in the latter case, the interface may be created but won't scan networks. Kernel logs are available via the command dmesg | grep firmware, often contain indications of microcode loading errors, which is the key to solving the problem.

📊 What type of Wi-Fi problem are you experiencing?
The adapter is not visible at all.
There is a driver, but it doesn't connect.
Constant connection breaks
Slow connection speed

Connecting via the GNOME graphical interface

For most desktop users Ubuntu Network interaction occurs through the GNOME desktop environment's graphical interface. This is the simplest and most intuitive method, requiring no command line knowledge. The system tray, located in the upper right corner of the screen, displays the network indicator. Clicking it opens a menu with a Wi-Fi switch and a list of detected access points.

When you select your network from the list, the system will ask for a security password. Ubuntu supports major encryption protocols, including WPA2-Personal and modern WPA3After entering the password and confirming, the system will attempt to obtain an IP address via DHCP and configure DNS servers automatically. If the credentials are correct, a lock icon and signal strength indicator will appear next to the network name.

☑️ Connection algorithm in the GUI

Completed: 0 / 4

In some cases, manual IP configuration is required, for example, on corporate networks or for servers. To do this, select "Wi-Fi Settings" in the network menu, navigate to the desired profile, and open its properties. The IPv4 tab allows you to switch the method from "Automatic (DHCP)" to "Manual," where you can enter a static address, subnet mask, gateway, and DNS. Static IP Useful when you need a permanent address for port forwarding or accessing a machine over the network.

The graphical interface also allows you to manage known networks. You can delete a network profile if the password has changed or set up a scheduled connection. However, it's important to remember that the GUI hides many of the finer settings accessible via the terminal. If the graphical interface is glitchy or doesn't display networks, switching to console utilities is often the only option.

⚠️ Important: When setting up a static IP address, make sure the selected address is not in the DHCP range of your router, otherwise an address conflict will occur and the connection will be unstable.

Configuring a network via the terminal and nmcli

For system administrators and users of server versions of Ubuntu, such as Ubuntu Server, the graphical interface is unavailable. In these cases, the utility becomes the primary tool nmcli (NetworkManager command line interface). It provides complete control over network connections and allows you to perform all the same actions as the GUI, but using text commands. It's a powerful tool worth mastering for professional work.

The first thing you need to do is find the name of your wireless device. The command nmcli device will list all interfaces. Typically, a wireless interface is called wlp2s0, wlan0 or similar. Before scanning networks, it is advisable to make sure that the device is turned on with the command nmcli radio wifi onIf the device is turned off by software, this command will turn it on.

nmcli device wifi list

This command will display a list of available networks with their SSID, security mode, and signal strength. To connect to a network, use the command where you need to replace SSID to the name of your network, and PASSWORD to password:

nmcli device wifi connect"SSID" password"PASSWORD"
What should I do if nmcli reports "Secrets were required, but not provided"?

This error often occurs when special characters in a password are improperly escaped. Try enclosing the password in single quotes or using double backslashes before special characters.

After successful connection nmcli will create a connection profile that will automatically activate whenever this network is available in the future. You can view the details of the active connection with the command nmcli connection show --activeAdvanced users can create complex profiles with multiple access points or configure 802.1x authentication for the corporate sector.

Using the terminal offers the advantage of speed and automation. You can write a script that will check for network availability and reconnect if the connection is lost, something that's impossible to do with standard GUI tools without installing additional software. Command line In Linux, it is not a relic of the past, but an effective management tool.

Troubleshooting Broadcom and Realtek Drivers

The most common cause of Wi-Fi problems in Ubuntu is the manufacturer's adapters. Broadcom And RealtekThese manufacturers often don't provide open source drivers, relying on proprietary modules that aren't included in the standard Linux kernel due to licensing restrictions. Fortunately, Ubuntu's repositories contain packages. bcmwl-kernel-source for Broadcom and firmware-realtek for Realtek, which solve most of the problems.

To install Broadcom drivers on a system with Internet access (for example, via a USB modem or Ethernet cable), simply run the command:

sudo apt update

sudo apt install bcmwl-kernel-source

After installation, a reboot may be required or the module may need to be loaded manually via modprobe wlThe situation with Realtek Sometimes it's more complicated, as drivers for new adapter models may not be included in the standard kernel. In such cases, you have to compile the driver from source code downloaded from GitHub, which requires installing packages. build-essential And linux-headers.

If automatic installation doesn't help, it's worth checking if there's a conflict with the open driver. bcma or b43 with proprietary wlSometimes it is necessary to add a module to the blacklist (blacklist) to prevent the system from loading the incompatible driver. Blacklist files are located in the directory /etc/modprobe.d/, and editing them requires superuser rights.

⚠️ Important: When compiling drivers from source, remember that after every Linux kernel update, you will have to recompile the module, otherwise Wi-Fi will stop working. Use this method only if there are no pre-built packages.

Setting up static IP and DNS servers

While DHCP is convenient for home networks, some situations require hard-coded network settings. This may be necessary for setting up port forwarding, network printers, or accessing a server via a fixed address. In Ubuntu 20.04 and newer, network configuration is often managed by a daemon. Netplan, which uses YAML files to describe settings, or through NetworkManager in desktop versions.

To configure via Netplan, you need to create or edit a configuration file in the directory /etc/netplan/, For example 01-network-manager-all.yamlYAML syntax is indentation-sensitive, so be careful when editing. An example configuration for a static IP looks like this:

network:

version: 2

ethernets:

enp3s0:

dhcp4: no

addresses: [192.168.1.50/24]

gateway4: 192.168.1.1

nameservers:

addresses: [8.8.8.8, 1.1.1.1]

After making changes, the configuration must be applied using the command sudo netplan applyIf you are using desktop Ubuntu with NetworkManager, it is easier to use the utility nmtui, which provides a pseudo-graphical interface for configuration. Launch it in the terminal, select "Edit a connection," find your Wi-Fi profile, and change the IPv4 configuration to Manual.

DNS settings deserve special attention. Providers often provide their own DNS servers, which can be slow or block some resources. Replacing them with Google's public DNS (8.8.8.8) or Cloudflare (1.1.1.1) can speed up page loading and improve security. DNS servers affect only the speed of domain name resolution, but not the speed of file downloads.

⚠️ Note: Netplan interfaces use CIDR format for the subnet mask (e.g., /24 instead of 255.255.255.0). An error in the YAML file (an extra space) will prevent the network from coming back up after a reboot.

The applied settings are checked using the command ip addr show And cat /etc/resolv.confMake sure the address matches the specified one and the correct nameservers are specified in the resolver file. If the settings reset after a reboot, it means NetworkManager is taking over and overwriting the Netplan configuration, and you need to configure it.

Common mistakes and how to fix them

Even with proper configuration, users may experience unstable Wi-Fi performance: low speed, constant connection drops, or an inability to connect to the 5 GHz network. One common cause is power saving mode, which disables the adapter to conserve battery life. In Ubuntu, this can be disabled by creating a configuration file for NetworkManager or by changing kernel module parameters.

Adding a row wifi.powersave = 0 to file /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf Forces the system to ignore requests from the adapter. This may slightly increase power consumption, but significantly stabilizes the connection. It's also worth checking whether your router is using a channel that's heavily polluted by neighboring networks. Switching to a less congested channel in the router settings often works wonders.

Why are 5 GHz networks not visible?

Make sure the correct country code is set in the region settings (regulatory domain). The default may be US or 00, which may not allow all channels. Use the command: sudo iw reg set RU.

IPv6 issues can also cause connection delays. If your ISP doesn't support IPv6, try disabling it in your connection settings, leaving only IPv4. The system will spend less time attempting autoconfiguration, and websites will load faster. You can test this in the terminal by pinging IPv6 addresses.

In conclusion, setting up Wi-Fi in Ubuntu is a process that requires attention to detail, but is quite manageable. Knowing basic diagnostic commands and understanding how network daemons work will allow you to feel confident in any situation. Linux provides a level of system transparency that's hard to find in other operating systems, allowing you to tweak settings to suit your needs.

How do I know which driver is used for my Wi-Fi adapter?

Use the command lspci -k and look for the line "Kernel driver in use" in the output. This will indicate the name of the module that controls your device. If this line is missing, the driver is not loaded.

Why doesn't Ubuntu see my Wi-Fi adapter after updating?

When updating the Linux kernel, the header files may have been updated, causing the proprietary driver to no longer build or load. Try reinstalling the driver package or running sudo ubuntu-drivers autoinstall.

Is it possible to share Wi-Fi from an Ubuntu laptop?

Yes, this is possible. There's a "Hotspot" tab in the network settings (Wi-Fi). You can also do this through the terminal by creating a virtual interface and configuring hostapd.

How to reset all network settings in Ubuntu?

The easiest way is to delete the connection configuration files in the folder /etc/NetworkManager/system-connections/ (care required) or just forget all networks in the GUI and recreate them again.