How to Set Up WiFi on Ubuntu: From Beginner to Pro

operating system Ubuntu In recent years, wireless networking has made a huge leap in terms of compatibility with modern hardware. While connecting to a wireless network could previously be a quest to find proprietary drivers, today, in most cases, it's enough to simply select a network and enter the password. However, hardware varies, and sometimes NetworkManager cannot automatically pick up the specific chipset of your adapter.

In this material we will analyze not only the standard algorithm of actions, but also delve into the operation of the terminal, which is critical skill For any Linux user. You'll learn how to diagnose problems when the interface is silent and how to force the necessary services to start. Understanding these processes will save you hours of frustration when upgrading the kernel or changing hardware.

We will look at working with Netplan — a modern network configuration tool that has replaced older methods in the server and desktop versions of the distribution. We'll also cover security: how to check if your MAC address is showing up in other people's logs and whether it's worth hiding. Most WiFi problems on Ubuntu can be solved by reinstalling firmware-linux packages or correct drivers for Broadcom/Realtek.

Diagnostics and checking the adapter status

Before diving into settings, you need to determine whether the system even sees your wireless device. Users often try to configure something that's physically disabled or not detected by the kernel. The first step should always be checking the radio module's status using a utility. rfkillThis is a built-in tool for blocking wireless interfaces, which can be in a "soft block" (software disablement) or "hard block" (physical disablement) state.

Launch the terminal and enter the command rfkill list allIf you see a line with the status Soft blocked: yes, this means that WiFi is disabled by software, and it can be unlocked with the command rfkill unblock wifiThe situation with Hard blocked more complicated - this usually means that there is a physical switch or key combination on the laptop case (often F2 or F12 with an antenna icon) that needs to be activated.

⚠️ Note: If the adapter is not displayed in the command output lspci (for internal cards) or lsusb (For USB dongles), the issue may be hardware-related. Check if the card is seated securely in the M.2 slot or if the USB port is working.

Next, you should make sure that the driver is loaded. The command lspci -k | grep -A 3 -i network will show which driver (kernel driver in use) is enabled for your network card. If the driver field is empty or specified unclaimed, the system lacks firmware. In such cases, installing packages often helps. linux-firmware or specific drivers through apt.

📊 Have you encountered the "Hard Blocked" problem on Ubuntu?
Yes, it was on the laptop.
No, it always works right away.
Only on USB adapters
I only use cable

Graphical configuration via NetworkManager

For most users of desktop Ubuntu editions (GNOME, KDE, XFCE), the easiest way to connect remains the graphical interface. NetworkManager — is a standard daemon that manages network connections and provides a convenient applet in the system tray. In modern versions of Ubuntu with the GNOME shell, the process is extremely simplified: clicking the network icon in the upper right corner opens a list of available access points.

When selecting a network, the system will ask for a password. It is important to note that for corporate networks with security WPA2-Enterprise or 802.1xThe interface will require additional parameters, such as the username, domain, and encryption method (PEAP, TLS). For a typical home user, entering the WPA/WPA2 security key is sufficient. If the network is hidden, you must select "Connect to a hidden network" and manually enter the SSID.

  • 📡 Auto-connection: Make sure the "Connect automatically" switch is active if you want the laptop to automatically find a familiar network after turning it on.
  • 🔒 Confidentiality: In the WiFi settings (not in the properties of a specific network, but in the general WiFi settings), you can enable MAC address randomization to increase anonymity in public places.
  • ⚙️ IPv4/IPv6: In the connection properties, in the IPv4 tab, you can set a static IP address if the router does not distribute addresses correctly via DHCP.

Sometimes the interface hangs in the connected state, but the internet connection doesn't appear. In this case, restarting the NetworkManager service without rebooting the entire system helps. This can be done with the command sudo systemctl restart NetworkManagerIt is also useful to check the system logs for errors related to wpa_supplicant using journalctl.

Setting up WiFi via a terminal and Netplan

Server versions of Ubuntu or minimalist builds may not have a graphical interface. This is where Netplan — a utility for easy network configuration that generates a backend for NetworkManager or systemd-networkd. Netplan configuration files are located in the directory /etc/netplan/ and have an extension .yamlYAML syntax is indentation-sensitive, so be careful when editing.

First, you need to find the name of your wireless interface. The command ip link or nmcli device will give a list of devices (for example, wlo1 or wlan0). Create or edit a configuration file, for example 01-network-manager-all.yamlThe file structure should clearly describe the renderer version and interface parameters.

network:

version: 2

renderer: NetworkManager

wifis:

wlo1:

dhcp4: true

access-points:

"MyHomeWiFi":

password: "SuperSecretPassword"

After making changes, the file must be applied. First, check the syntax for errors with the command sudo netplan tryThis command will apply the settings and roll them back after 120 seconds if you don't confirm success (this is a safeguard against losing access to the server). If everything went well, commit the changes with the command sudo netplan apply.

Why does Netplan use YAML?

YAML was chosen for its human- and machine-readability. Unlike JSON, it doesn't require quotes for keys and uses indentation instead of brackets, making configuration files more compact. However, one extra tab instead of two spaces can break the entire configuration.

Installing and updating WiFi drivers

The most common reason for a lack of WiFi is the lack of proprietary drivers. Ubuntu has an "Additional Drivers" feature that automatically scans your hardware and offers to install the necessary packages. You can launch this utility with the command ubuntu-drivers devices to view the list or sudo ubuntu-drivers autoinstall to automatically install everything you need.

Adapters from often cause a particular headache. Broadcom and some older models RealtekBroadcom usually requires a package bcmwl-kernel-sourceIf the automatic installation didn't work, but you have a cable connection (or you can share your phone's internet connection via a USB modem), try manually updating the driver database: sudo apt update And sudo apt install --reinstall bcmwl-kernel-source.

  • 🛠 DKMS: Drivers are often built using DKMS (Dynamic Kernel Module Support). This means that when the Linux kernel is updated, the driver is recompiled automatically. If you've updated the kernel and WiFi is gone, try reinstalling the driver package.
  • 💾 Offline installation: If there is no internet connection at all, download the driver deb packages on another computer and transfer them to a flash drive. Install them using the command sudo dpkg -i package_name.deb.
  • 🔄 Blacklists: Sometimes open and closed drivers conflict (for example, b43 And wl). It may be necessary to add the conflicting module to the blacklist in the file /etc/modprobe.d/blacklist.conf.
⚠️ Note: Interfaces and package names may change with the release of new versions of the distribution. Always check the package names for your version of Ubuntu (20.04, 22.04, 24.04) on the official website or in the repositories.

☑️ Driver installation checklist

Completed: 0 / 5

Setting up static IP and DNS

In some scenarios, such as setting up a home server, media center, or print server, dynamic address assignment (DHCP) is inconvenient. The address may change after a router reboot, and you will lose access to the device. static IP solves this problem by fixing the address to a specific MAC address of the interface.

Let's return to the Netplan configuration. To set a static address, you need to disable DHCP and manually enter the IP address, gateway, and DNS servers. The gateway address is usually the same as the router's address (often 192.168.0.1 or 192.168.1.1). DNS can be specified as public, for example, from Google (8.8.8.8) or Cloudflare (1.1.1.1), which sometimes speeds up network response.

Parameter Meaning Description
addresses 192.168.1.50/24 Your static IP and network mask
gateway4 192.168.1.1 Router address (default gateway)
nameservers 8.8.8.8, 1.1.1.1 DNS servers for name resolution
renderer NetworkManager Backend managing the network

After editing the YAML file, be sure to apply the changes. If you enter the wrong gateway address, your computer will lose access to the global network, although your local network may still work. You can check the settings using the command ip route (there must be a default route default via...) And ping 8.8.8.8.

Solutions to common problems and errors

Even with proper configuration, connection instability or complete disconnections may occur. One common issue in Ubuntu is aggressive power saving of the WiFi adapter. The system may attempt to "sleep" or reduce signal strength, leading to disconnects. This can be disabled by adjusting the power level in the driver or by creating a configuration file for NetworkManager.

Create a file /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf and write the parameter there wifi.powersave = 2 (where 2 means power saving is disabled, and 3 means it's enabled). This often solves problems with a flickering connection on laptops. It's also worth checking if a firewall is blocking it (ufw) required ports, although by default it should not interfere with outgoing connections.

If your WiFi speed is significantly slower than expected, check the frequency band your network is operating on. 2.4 GHz has a longer range, but is heavily interfered with by neighboring routers and microwaves. Frequency 5 GHz It provides high speeds, but is less effective at penetrating walls. Make sure your adapter supports the standard. 802.11ac or ax (WiFi 6) for maximum performance.

⚠️ Note: Changing power saving settings may increase your laptop's power consumption and reduce battery life. Use this method if your laptop is frequently plugged in.
Why doesn't Ubuntu see my WiFi adapter after updating?

A Linux kernel update may have caused a proprietary driver to become incompatible with the new kernel version. In this case, you should boot the old kernel via GRUB (Advanced options) and reinstall the driver packages or wait for the driver to be updated in the repositories.

How do I know if my adapter supports monitor mode?

Use the command iw listIn the output, look for the "Supported interface modes" section. If the word "monitor" is there, it means the adapter technically supports this mode, which is necessary for traffic analysis (for example, in Aircrack-ng).

Is it possible to share WiFi with Ubuntu?

Yes, Ubuntu can act as a hotspot. The NetworkManager GUI has a "Use as hotspot" option. In the terminal, you can do this via nmcli or by creating the appropriate config in Netplan/Hostapd.