Setting Up Wi-Fi in Ubuntu 20.04: From Beginner to Pro

Installing a Linux operating system is often the first step to gaining full control over a computing device, but immediately after installation, the user may encounter a lack of internet connection. Ubuntu 20.04 Focal Fossa is renowned for its stability, but in some cases, especially on laptops with newer or more specialized hardware, the wireless module fails to activate automatically. This creates a classic "chicken and egg" problem: installing drivers requires internet access, and internet access requires drivers.

Most modern distributions have a graphical interface GNOME While it handles the bulk of network discovery, understanding the underlying setup processes is essential for every administrator. We'll cover not only standard connection methods via the menu but also advanced ways to resolve hardware conflicts via the terminal. NetworkManager — this is the main service that manages connections, and it is with this that we will interact.

It's important to understand that the absence of the Wi-Fi icon in the upper right corner of the screen doesn't always indicate hardware failure. Often, the problem lies in a disabled kernel-level module or in software blocking the radio signal within the operating system. The key to a successful connection is following the correct sequence of steps: from checking the physical switch to setting up a static IP address. Let's look at all the stages in detail.

Initial diagnostics of the wireless adapter

Before you begin complex manipulations with configuration files, you need to make sure that the operating system even "sees" your wireless adapter. In Ubuntu 20.04, the primary tool for checking the hardware status is the utility lshw or a simpler command ip linkIf the adapter appears in the list but is inactive, the problem is most likely software-related. If the device is completely absent from the list, it may be disabled at the BIOS/UEFI level or physically faulty.

Often users forget about the existence of hardware switches on the laptop case or key combinations (usually Fn plus one of the function keys with an image of an antenna). Software blocking can also be activated by the utility rfkill, which controls the radio modules. To check the lock status, enter the following command in the terminal:

rfkill list all

If you see the status Soft blocked: yes, this means that the system has software-based blocking of the module. To unblock it, simply run the command sudo rfkill unblock wifiIn case Hard blocked: yes The situation is more complex - it indicates a physical switch or a setting in the BIOS that cannot be changed programmatically from within the OS.

  • 📡 Check if the wireless network indicator on the laptop case or keyboard is lit.
  • 💻 Make sure that the built-in Wi-Fi module is not disabled in the BIOS/UEFI (Wireless, Network, or Onboard Devices section).
  • 🔍 Use the command lspci (for internal cards) or lsusb (for USB adapters) to identify the device vendor.
⚠️ Attention: If the team lspci If the wireless device is not showing, but it is enabled in the BIOS, try performing a full power cycle (Shutdown, disconnect from the network, wait 10 seconds, turn on), as some modules do not initialize during a warm reboot.

Connecting via the GNOME graphical interface

For most Ubuntu 20.04 users, network interaction occurs through a graphical interface. GNOME It's intuitive, but it hides a number of useful features for advanced users. To connect to the network, click the system menu in the upper right corner of the screen (where the sound and power icons are located) and select Wi-FiIf the slider is off, activate it.

Once turned on, the system will begin scanning for available networks. Select your network from the list and click "Connect." If the network is password-protected, a window for entering the security key will appear. It is important to select the correct security type (usually WPA/WPA2 Personal), although in 99% of home cases, the system detects it automatically. If the password is entered successfully, a lock icon and a signal strength indicator will appear next to the network name.

If the network is hidden (not broadcasting its SSID), select "Connect to Hidden Network." Here, you'll need to manually enter the network name (SSID) and select the security type. You can also find the "Network Profile" button or the gear icon next to the connected network in the Wi-Fi settings, where you can access IP address settings.

📊 Which Wi-Fi connection method do you use most often?
Graphical interface (GNOME)
Command line (nmcli)
Configuration files (Netplan)
Automatic connection on boot

The graphical interface is convenient for quick work, but it can hide connection errors. If the password is entered correctly, but the connection keeps dropping or stays stuck in the "Connecting..." status, it's worth consulting the logs or using the command line for a more accurate diagnosis. Often, the problem lies not with the password, but with incompatible encryption protocols.

Setting up Wi-Fi via the terminal (nmcli)

For system administrators and minimalists, the graphical interface may be redundant or unavailable (for example, in server versions of Ubuntu). The tool nmcli (NetworkManager Command Line Interface) provides complete control over network connections. It allows you to not only connect to networks but also create persistent profiles, manage VPNs, and change DNS.

The first step is to scan for available networks. To do this, use the command:

nmcli dev wifi list

The output will show a list of networks, their signal (SIGNAL), security (SECURITY), and status. Find your network name (SSID) and copy it exactly, taking into account the case of the letters. To connect, use the following structure, replacing the data with your own:

sudo nmcli dev wifi connect "Network_Name" password "Your_Password"

If the connection was successful, NetworkManager will save the profile and automatically connect to this network in the future. If you are in a non-graphical environment, this method is the primary one. Also, through nmcli You can easily change DNS servers, which is often necessary to bypass provider blocks or speed up response times.

  • 🔧 Use the flag --ask at the end of the command if you don't want to enter the password directly in the terminal command history.
  • 📝 To view all saved profiles, use the command nmcli connection show.
  • 🗑️ To delete a network profile, follow these steps: nmcli connection delete "Network_Name".
⚠️ Note: When working in the terminal, be careful with quotation marks. If your network name contains spaces, it must be enclosed in double quotation marks, otherwise the command will not execute correctly.

Working with drivers and installing proprietary software

One of the most common reasons for Wi-Fi not working in Ubuntu 20.04 is the lack of necessary drivers, especially for adapters. Broadcom or RealtekThe open-source Linux kernel contains many drivers, but some devices require proprietary (closed) modules. Ubuntu provides a convenient mechanism for installing them through a repository. multiverse.

To search for available drivers, you can use the utility ubuntu-driversRun the command:

sudo ubuntu-drivers devices

The system will analyze your hardware and provide a list of recommended drivers. If there is an alternative driver for your device (marked as distro free or recommended), it can be installed automatically by the command sudo ubuntu-drivers autoinstallAfter installation, be sure to restart your computer.

What to do if the drivers are not in the repository?

If the standard Ubuntu repositories don't contain a driver for your exotic adapter (often found with new Realtek RTL88xx models), you'll need to compile the driver manually from the source code on GitHub. This requires installing the build-essential package and the kernel headers (linux-headers-generic). The process involves cloning the repository, running make, and then make install. Be careful: you may need to repeat this process if you update the kernel.

In some cases, a driver may conflict with an already installed module. For example, the driver bcma may interfere with work wlIn this situation, you need to add the conflicting module to the blacklist (blacklist) in the file /etc/modprobe.d/blacklist.confThis will prevent it from loading at system startup.

  • 📦 Make sure the repositories are connected multiverse And restricted in application sources.
  • 🔄 After installing the drivers through apt or dkms Always perform a reboot, not just reconnecting the module.
  • 🛡️ Verify the signature of drivers if you download them from third-party resources to avoid the introduction of malicious code.

Netplan Configuration for Static IP and DNS

Since version 17.10, Ubuntu uses Netplan as a standard network configuration tool. Netplan configuration files are written in YAML and are located in the directory /etc/netplan/While DHCP (automatic address acquisition) is often sufficient for home use, servers or specific tasks may require a static IP.

To edit the configuration, find the file with the extension .yaml (For example, 01-network-manager-all.yaml). Before making any changes, create a backup. Example configuration for Wi-Fi with a static address:

network:

version: 2

renderer: NetworkManager

wifis:

wlan0:

dhcp4: no

addresses: [192.168.1.50/24]

gateway4: 192.168.1.1

nameservers:

addresses: [8.8.8.8, 1.1.1.1]

access-points:

"Network SSID":

password: "Password"

Please pay attention to indentation in YAML files: it is critical. Using tabs instead of spaces will result in a parsing error. After editing, apply the changes with the command sudo netplan applyIf the configuration is incorrect, the system will return an error and roll back the changes, preventing loss of access to the server.

Parameter Description Example of meaning
renderer Backend for network management NetworkManager, networkd
dhcp4 Use DHCP for IPv4 true, false
addresses Static IP and mask 192.168.1.10/24
gateway4 Default Gateway 192.168.1.1
nameservers DNS servers [8.8.8.8, 8.8.4.4]
⚠️ Note: YAML syntax requires strict indentation (usually 2 spaces). Do not use tabs. Indentation errors will cause the command to be incomplete. netplan apply will not execute and the network may stop working until the file is corrected.

Solving common problems and conflicts

Even with proper configuration, Wi-Fi may become unstable, disconnect spontaneously, or experience slow speeds. A common issue in Ubuntu 20.04 is related to the wireless adapter's power-saving mode. The system may overly aggressively disable the module to conserve battery life, resulting in connection drops.

To disable power saving for Wi-Fi, create a configuration file /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf with the following contents:

[connection]

wifi.powersave = 2

Meaning 2 means disabling the power saving mode (meaning 3 turns it on). After changing the changes, you need to restart the NetworkManager service with the command sudo systemctl restart NetworkManager. It's also worth checking if your firewall is blocking (ufw) required ports, although by default it should not interfere with outgoing connections.

☑️ Diagnosing Wi-Fi problems

Completed: 0 / 4

Another cause of unstable performance may be interference from neighboring networks, especially if you're in an apartment building. In this case, changing the channel on your router to a less crowded one (for example, 1, 6, or 11 for the 2.4 GHz band) can help. You should also try switching to the 5 GHz band if your equipment and router support the standard. 802.11ac or ax.

  • 📉 Use the utility wavemon or iwlist to analyze the signal and noise levels on the air.
  • 🔄 Updating the Linux kernel (linux-generic-hwe-20.04) frequently adds support for new hardware and fixes driver bugs.
  • 🔌 When using USB adapters, avoid USB 3.0 ports if the adapter operates in the 2.4 GHz band, as they may cause interference.

Frequently Asked Questions (FAQ)

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

Updating the system kernel may have caused the proprietary driver to become incompatible with the new kernel version. In this case, you will need to reinstall the driver packages (e.g. bcmwl-kernel-source (for Broadcom) or wait for the DKMS modules to be updated. Also, check if the blacklist file in the module configuration has been reset.

How do I connect to Wi-Fi without a GUI if I forgot my sudo password?

Without superuser rights (sudo) you won't be able to change network settings or install drivers. However, if the network is open or uses WPS, you can try connecting via wpa_supplicant with a configuration file in the home directory, but root privileges are still required to apply system settings. Restoring sudo access is only possible through Recovery Mode during boot.

Is it possible to share Wi-Fi with Ubuntu 20.04 (access point mode)?

Yes, it's possible. In the GNOME GUI, the Wi-Fi menu has an option called "Turn On Wi-Fi Hotspot." In the terminal, you can do this via nmcli, creating a new connection of the type wifi-hotspotPlease note that not all adapters support simultaneous operation of a client and an access point.

Where can I find Wi-Fi connection error logs?

The main NetworkManager event log is located at /var/log/syslog or /var/log/journal (when using systemd). To view errors in real time, use the command journalctl -u NetworkManager -fThis will help identify the causes of authorization failure or DHCP issues.

How to reset all Ubuntu network settings to factory defaults?

For a complete reset, you can delete the NetworkManager configuration files in the directory /etc/NetworkManager/system-connections/ (requires sudo). It's also worth clearing the cache of known networks. After that, restart the service with the command sudo systemctl restart NetworkManagerThis will return your network settings to the way they were after installation.