How to Connect Ubuntu to Wi-Fi: A Complete Guide

operating system Ubuntu Linux has long ceased to be the exclusive domain of programmers and system administrators, becoming a fully-fledged platform for everyday use. However, unlike Windows or macOS, where connecting to a wireless network often occurs automatically and seamlessly, in Linux this process sometimes requires attention. Wireless adapters in the Linux environment, they may behave capriciously due to the lack of proprietary drivers or kernel features.

There are several ways to establish a connection: from the graphical interface, familiar to beginners, to the command line, which gives full control over network settings. In this article, we will cover all the current methods, including working with NetworkManager And netplanUnderstanding the principles of network interfaces in Ubuntu will allow you to quickly restore Internet access even if the graphical shell crashes.

Before attempting any complex manipulations, it's worth making sure that the problem lies in the software and not the hardware. Wi-Fi module It must be physically functional and turned on. If you're using a laptop, check for a hardware switch or function key (often Fn + F2 or F12) that disables wireless interfaces at the BIOS or firmware level.

Modern versions of the distribution, such as Ubuntu 22.04 LTS And 24.04 LTS, they use systemd-networkd And NetworkManager for managing connections. This means that the old methods that worked in versions 16.04 or 18.04 (for example, editing a file /etc/network/interfaces), may not work or conflict with the current configuration. It is critical that you use the correct configuration method for your Ubuntu version and the network stack you are using.

Checking hardware and installing drivers

The first step should always be hardware diagnostics. The system must "see" your wireless adapter before attempting to connect to it. To do this, open a terminal and use the utility lspci for internal cards or lsusb For external USB dongles, these commands will list all connected devices. Look for a line containing the words "Wireless," "Wi-Fi," or manufacturer names like Intel, Realtek, or Broadcom.

⚠️ Attention: If the team lspci or lsusb If your adapter isn't showing up, there may be a hardware issue. Check that the card is firmly inserted into the slot (if it's a PC) or try a different USB port. Some adapters can also be disabled in the BIOS.

It often happens that the device is detected, but does not work properly due to the lack of proprietary firmware. Ubuntu There is a convenient mechanism for solving this problem through a graphical interface or terminal. The utility ubuntu-drivers will automatically scan the system and offer to install the necessary packages.

To automatically install the recommended drivers, run the command:

sudo ubuntu-drivers autoinstall

After the process is complete, a system reboot is required. If the automatic search fails, you'll have to manually search for the driver on the manufacturer's website, download the source code, and compile it. This is a more complex approach, requiring the installation of packages. build-essential And linux-headers.

Adapter owners Broadcom Users often need to connect to the internet via an Ethernet cable or a smartphone's USB modem for the initial driver installation. Without this step, the system simply won't be able to download the necessary files from the repositories.

Connecting via the NetworkManager graphical interface

In the standard desktop version Ubuntu (with GNOME shell) is responsible for network management NetworkManagerThis is the easiest and safest method for most users. In the upper-right corner of the screen is the system tray, where the network icon (usually two arcs or a computer) appears.

Click the network icon. If your wireless adapter is active, you'll see a list of available access points. Find your network name (SSID) in the list and click it. If the network is password-protected, a dialog box will appear asking you to enter the security key. GNOME Shell will automatically save the settings and try to connect.

  • 📶 If the network is hidden, select "Connect to a hidden network" and enter the SSID manually.
  • 🔒 For corporate networks (WPA2-Enterprise), you will need to select an encryption method and enter the username/password.
  • ⚙️ By clicking the gear next to the network name, you can set up a static IP address or DNS servers.

Sometimes the interface freezes and can't detect networks, even though the driver is installed. In this case, restarting the NetworkManager service without rebooting the entire system helps. This can be done with the command:

sudo systemctl restart NetworkManager

After running the command, the network icon in the tray may disappear for a few seconds and then reappear. This is normal behavior and indicates that the network management daemon has restarted. If networks reappear after this, the problem is resolved.

In newer versions of Ubuntu, network settings are also accessible via the Settings -> Wi-Fi menu. The interface here is more granular and allows you to manage known networks, forget unneeded ones, or change connection priorities.

📊 Which Wi-Fi connection method do you prefer?
Graphical User Interface (GUI): Terminal (nmcli): Terminal (iwconfig/netplan): Automatically on boot

Setting up Wi-Fi via the terminal using nmcli

For server versions Ubuntu Server Or for minimalists, a graphical interface may be unavailable or excessive. In such cases, a command-line utility comes to the rescue. nmcli (Network Manager Command Line Interface). It has all the functionality of its graphical counterpart.

First of all, check the status of the radio module. Command nmcli radio wifi will show whether Wi-Fi is enabled. If the status is "disabled", enable it with the command nmcli radio wifi onNext, you need to scan the airwaves for available networks.

nmcli dev wifi list

In the command output you will see a table with available access points, their signal (SIGNAL), security barriers (BARS) and name (SSID). Find the desired network in the list and remember the exact name, as it is case-sensitive.

To connect, use the following design:

nmcli dev wifi connect "Network_Name" password "Your_Password"

If the connection was successful, nmcli will create a connection profile and activate it. The system will then connect to this network automatically when detected. Saved profiles can be managed with the command nmcli connection.

⚠️ Warning: When entering a password on the command line using the password argument, it may be saved in the bash command history. For security, it's best to use interactive input or escape special characters in the password.

To delete an old or problematic connection profile, use the command nmcli connection delete"Profile_Name"This often helps if the settings are lost and a new connection fails to establish over the old errors.

Using Netplan for static configuration

Starting with version 17.10, Ubuntu implemented Netplan as a standard network configuration tool. It uses YAML files to describe settings, which are then translated into commands for NetworkManager or systemd-networkdThis method is preferred for servers and desktop workstations.

Configuration files are located in the directory /etc/netplan/. Usually there is a file there with a name like 01-network-manager-all.yaml or 50-cloud-init.yamlBefore editing, be sure to create a backup copy of the file.

An example configuration for connecting to Wi-Fi via Netplan looks like this:

network:

version: 2

renderer: NetworkManager

wifis:

wlan0:

access-points:

"MyHomeWiFi":

password:"SuperSecretPassword"

dhcp4: true

Here wlan0 — the name of your wireless interface (you can find out through ip link). Renderer Specifies who will manage the connection. After making changes to the YAML file, the configuration must be applied.

The settings are applied using the command:

sudo netplan apply

If the YAML syntax is incorrect (for example, with incorrect indentation), the command will return an error and not apply the changes, protecting the system from losing network access. Always check the file for errors before applying it.

Common YAML Errors in Netplan

The most common mistake is using tabs instead of spaces. YAML requires indentation with spaces (usually 2 or 4). The case of the keys is also critical: 'network', 'version', and 'wifis' must be written strictly in lowercase.

Diagnostics and troubleshooting

Even with proper setup, connection stability issues may still occur. Logging In Linux, it's a powerful tool for troubleshooting failures. The main log where NetworkManager records its events is accessible via systemd.

You can view the latest network-related events using the command:

journalctl -u NetworkManager -f

Flag -f means "follow," meaning the output will be updated in real time. When attempting to connect, watch for lines with the words "failed," "error," or "timeout." These will indicate the specific stage of the connection failure.

A common issue is IP address conflicts or incorrect DNS settings. If you're connected but can't access websites, try setting public DNS servers (such as Google or Cloudflare). It's also worth checking if something is blocking your access. Firewall (ufw) connection.

Problem Possible cause Solution
The adapter is not visible Disabled in BIOS/UEFI Enable in BIOS or with the Fn key
No driver Lack of firmware sudo ubuntu-drivers autoinstall
Weak signal Channel interference Change the channel on the router (1, 6, 11)
Frequent breaks Energy saving Disable power saving for Wi-Fi

Another hidden reason for unstable operation may be the power saving mode. Ubuntu By default, it may disable the Wi-Fi adapter to save power, which causes disconnects. This can be disabled by adding the appropriate directive to the NetworkManager configuration.

Managing known networks and security

Over time, a user accumulates a list of networks they've connected to. In public places (cafes, airports), this can be unsafe, as the system will automatically attempt to connect to open networks with similar names. It's recommended to periodically clear this list.

Wi-Fi network passwords in Ubuntu They are stored in a secure keystore (keyring), usually encrypted and linked to the user's password. However, with physical access and the account password, they can be retrieved. For increased security on shared computers, use "Guest" mode.

  • 🔐 Use WPA3 if your router and adapter support this encryption standard.
  • 🚫 Avoid automatically connecting to open networks without a VPN.
  • 📝 Update your system regularly (sudo apt update && sudo apt upgrade) to obtain kernel security patches.

If you're using a corporate network with a certificate, make sure your computer's time is synchronized with the network time (NTP). Time desynchronization often results in authentication errors, even if the password is entered correctly.

☑️ Wi-Fi Security Check

Completed: 0 / 1

Questions and Answers (FAQ)

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

Most likely, your system is missing a proprietary driver for your wireless card model. Try connecting to the internet via a cable or USB modem, then run "Additional Drivers" or the command sudo ubuntu-drivers autoinstall.

How to find out the name of the wireless interface?

Use the command ip link or iwconfigWireless interfaces in Linux are usually named wlan0, wlp2s0, or, in contrast to wired ones (eth0, enp3s0).

Is it possible to share Wi-Fi with Ubuntu (create an access point)?

Yes, modern versions of NetworkManager support creating an access point (Hotspot) directly through the graphical interface in the Wi-Fi settings or via the command nmcli.

Where are Wi-Fi passwords stored in Ubuntu?

Passwords are stored in NetworkManager configuration files in the directory /etc/NetworkManager/system-connections/Only root has access to them, and the passwords themselves can be encrypted.