The Ubuntu operating system, based on the Linux kernel, has long established itself as a reliable and secure platform for workstations and servers. However, unlike some proprietary systems, initial network setup, especially wireless, can be challenging for users accustomed to fully automated processes. Connecting to a wireless network is the first and critical step for installing updates, drivers, and necessary software.
In modern versions of the distribution, such as Ubuntu 22.04 LTS or 24.04 LTS, connecting to the internet is simplified thanks to the GNOME graphical interface. The system automatically scans the air, detects available access points, and prompts you to enter a password. However, even in the graphical interface, nuances related to encryption or specific network card drivers may arise, requiring manual intervention or the use of the command line.
In this article, we'll take a detailed look at all the available methods for connecting Ubuntu to WiFi. We'll cover the standard graphical method and advanced setup using a utility. nmcli and low-level configuration through netplan or wpa_supplicantWe'll also cover troubleshooting if your device can't see the network or obtain an IP address from the router.
NetworkManager GUI: Basic Connection
For most Ubuntu Desktop Edition users, the easiest and fastest way to connect to the internet is using the built-in network manager. The GNOME interface provides intuitive access to WiFi settings, hidden in the upper-right corner of the screen. By clicking the system tray, where the sound and battery status are displayed, you'll see a wireless network icon (usually shaped like a fan or antenna).
Clicking the icon will open a drop-down menu with a list of available wireless networks. If you see your network in the list, simply click it. If the network is password-protected (which is the security standard) WPA2/WPA3), the system will ask for an access key. Enter the password, making sure it's capitalized correctly, and click "Connect."
In some cases, especially on newer laptops or specific motherboards, you may need to install proprietary drivers. Ubuntu often prompts you to do this through the "Additional Drivers" menu, but sometimes you need to do it manually. If the WiFi button in the menu is disabled (grayed out) or missing entirely, check whether the wireless module is blocked by a hardware switch on the laptop or a key combination. Fn + F-key.
- 📶 Click the network icon in the upper right corner of the taskbar.
- 🔍 Select your network from the list of available SSIDs.
- 🔑 Enter your security password and confirm the action.
- ✅ Wait for the connection icon to appear and check your internet access.
It's worth noting that the graphical interface saves connection profiles. This means that the next time you turn on your computer, Ubuntu will automatically attempt to connect to a known network. If the automatic connection doesn't occur, you can go to Settings → Wi-Fi, click the gear next to the network name and make sure the "Connect automatically" switch is turned on.
Connecting via terminal using nmcli
For system administrators or users of server versions of Ubuntu (Server Edition), where there is no graphical shell, the utility becomes an indispensable tool nmcli (NetworkManager Command Line Interface). It allows you to manage network connections without restarting network services or manually editing configuration files, reducing the risk of syntax errors.
The first step is always to check the status of the network interface. The command nmcli dev status will show a list of all network devices and their current status. You need to find a device with the type wifi. If the device status disconnected, then the interface is active but not connected. If the status unavailable, this may indicate missing drivers or a disabled module.
nmcli dev wifi list
Running the scan command will display a list of available networks with their signals, channels, and security levels. Find your network name (SSID) in the list. To connect, use the command where you need to replace SSID_NAME to the name of your network, and YOUR_PASSWORD to the real password.
nmcli dev wifi connect"SSID_NAME" password"YOUR_PASSWORD"
It's important to properly escape special characters in the password, if any. If the password contains spaces or special characters, it's best to enclose it in quotation marks, as shown in the example above. After the command successfully completes, NetworkManager will create a connection profile and attempt to obtain an IP address via DHCP.
☑️ Check before connecting via nmcli
Sometimes it's useful to know that nmcli allows you to create connections with a static IP address, which is often required in corporate networks or for servers. This is done using the modifier ipv4.method manual and specifying the address, gateway, and DNS. However, for home use, dynamic address acquisition is the standard.
⚠️ Note: When entering a password in the command line, the command history may be saved in a file .bash_historyTo enhance security after a successful connection, it is recommended to clear the history or use a secure password entry field if the interface allows it.
Setting up WiFi via Netplan (for Ubuntu Server and newer versions)
Starting with Ubuntu 17.10, Canonical has implemented a utility Netplan as a standard network configuration tool. It uses YAML files to describe network configuration, which are then translated into commands for the backend (usually NetworkManager or systemd-networkd). This is especially relevant for server builds, where configuration reproducibility is important.
Netplan configuration files are located in the directory /etc/netplan/The file name may differ, for example, 00-installer-config.yaml or 50-cloud-init.yamlBefore editing, be sure to create a backup copy of the file. Open the file with root privileges using a text editor. nano or vim.
sudo nano /etc/netplan/00-installer-config.yaml
The YAML structure requires strict indentation (usually 2 or 4 spaces, tabs are not allowed). To configure WiFi, you must specify a renderer. NetworkManager (for Desktop) or networkd (for Server), the interface name (e.g. wlo1) and block wifi with the SSID and password data. The password can be stored in cleartext or a hashed key can be used.
| Parameter | Description | Example of meaning |
|---|---|---|
| renderer | Backend for network management | networkd |
| ssid | Wireless network name | Home_WiFi_5G |
| password | Network security key | SuperSecretPass123 |
| addresses | Static IP (optional) | 192.168.1.50/24 |
After making changes, you need to apply the configuration with the command sudo netplan applyIf the YAML syntax is incorrect, the system will return an error and not apply the changes, which prevents loss of network access. In case of errors, use the command sudo netplan try, which will apply the settings and revert them back after 120 seconds if you do not confirm success.
Example of a complete Netplan configuration for WiFi
network:
version: 2
renderer: networkd
wifis:
wlo1:
dhcp4: true
access-points:
"MyNetwork":
password:"MyPassword"
Using wpa_supplicant for complex cases
Utility wpa_supplicant is a fundamental Linux component responsible for wireless security and support for the WPA/WPA2 protocols. It is used under the hood by most graphical desktop environments, but can be launched manually when other methods fail or maximum control over the authentication process is required.
To connect manually, you first need to generate a configuration file with a hashed password. This is more secure than storing the password in plaintext. The command wpa_passphrase takes the SSID and password as input, producing a ready-made configuration block. This block needs to be added to the file /etc/wpa_supplicant/wpa_supplicant.conf.
wpa_passphrase"SSID_NAME""PASSWORD" | sudo tee -a /etc/wpa_supplicant/wpa_supplicant.conf
After preparing the configuration, you need to start the daemon, specifying the interface and the path to the configuration file. You may need to run dhclient or dhcpcd to obtain an IP address. This method is often used in minimalist builds or when debugging drivers when the standard NetworkManager is unstable.
- 🔧 Configuration generation:
wpa_passphrase. - 📝 Editing a file:
/etc/wpa_supplicant/wpa_supplicant.conf. - 🚀 Starting the daemon:
wpa_supplicant -B -i wlo1 -c /etc/wpa_supplicant/wpa_supplicant.conf. - 🌐 Obtaining an IP:
sudo dhclient wlo1.
Usage wpa_supplicant directly provides insight into how exactly the handshake with the access point occurs. If the connection fails, the daemon logs (usually available via journalctl) contain detailed information about the reasons for the failure, whether it was an invalid key or an incompatibility of the encryption protocol.
⚠️ Warning: Directly editing system configuration files may cause conflicts with NetworkManager. If you are using a graphical shell, avoid manual editing. wpa_supplicant.conf, so as not to disrupt the operation of standard network management tools.
Diagnosing and resolving driver problems
The most common problem when connecting Ubuntu to WiFi is a lack of suitable drivers, especially for Broadcom, Realtek, or newer Intel wireless cards. The system may simply not recognize the WiFi adapter, displaying no available interfaces. The first step in troubleshooting is to check the command output. lspci (for PCIe cards) or lsusb (for USB whistles).
If the device is found in the list but does not work, check the status of the kernel modules. Utility rfkill shows whether WiFi is blocked by software or hardware. The command rfkill list all will display a list of devices and their blocking status. If there is a check mark Soft blocked: yes, unlock the device with the command rfkill unblock wifi.
sudo rfkill unblock wifi
For proprietary drivers (often required for Broadcom) use the utility ubuntu-driversIt will scan your hardware and offer to install recommended drivers. This is critical, as open-source drivers bcma or b43 may not support all the features of modern cards or may work unstably.
If you have DHCP issues, such as a connection but no IP address (status "Obtaining IP address..."), try manually renewing the address lease or restarting the NetworkManager service. Clearing the DHCP cache or temporarily disabling the firewall to test the issue often helps.
Managing saved profiles and security
Ubuntu stores all connection settings in configuration files, allowing for automatic reconnection upon reboot. However, if you change your router password or move to a new office, old settings may become inconvenient. Profile management is conveniently done through nmcli or graphical interface, removing unnecessary connections.
The security of stored credentials is also important. In Linux, WiFi passwords are typically stored in the user's keyring. This means that connecting may require entering the account password upon login. For servers without interactive login, passwords are stored in configuration files with root-only access (600 or 644).
It's recommended to periodically check the list of known networks and delete those you no longer use, especially if they're old, open networks. This reduces the risk of automatically connecting to malicious access points with the same name (SSID) you previously used.
How to delete a saved WiFi profile in Ubuntu?
To delete a profile, use the command: nmcli connection delete"Profile_Name"The profile name can be found through nmcli connection showThis action will irreversibly delete the settings and passwords for this network.
Why can't Ubuntu see 5GHz networks?
This is most often due to regional WiFi settings. Check the country code in the router settings and in the system (parameter country in the kernel module cfg80211). Some 5 GHz channels are prohibited in certain regions.
Is it possible to share WiFi with Ubuntu?
Yes, Ubuntu supports hotspot mode. In the graphical interface, this is done through the WiFi → "Use as hotspot" menu. In the terminal, this is done using nmcli with connection type wifi-hotspot.
Where are WiFi passwords stored in Ubuntu?
Passwords are stored encrypted in the GNOME Keychain (file ~/.local/share/keyrings/login.keyring) or in text form in files /etc/NetworkManager/system-connections/ (only available to root).
How to speed up WiFi connection during download?
Make sure your connection's IPv4 settings are set to "Use this proxy for addresses only" if you don't need a proxy, or disable scanning for nearby networks if you don't need it for the job.