How to Connect Wi-Fi on Linux: From Beginner to Pro

Modern Linux distributions such as Ubuntu, Fedora, or Linux Mint often allow you to connect to a wireless network immediately after installation using a graphical interface. However, on server versions or when using minimalist window managers, users are forced to use the command line. Understanding how network interfaces work in this operating system allows for more detailed configuration and troubleshooting.

The setup process may vary depending on the distribution and kernel version you are using. Network manager NetworkManager is the de facto standard for most desktop environments, while system administrators prefer lighter utilities or direct configuration. Regardless of the chosen method, the basic principles remain the same: adapter identification, network scanning, and authorization.

In this article, we'll cover all the current methods for activating a wireless connection. We'll cover both graphical methods and terminal-based configuration, which is especially important for remote server management. A willingness to perform manual configuration is a sign of a confident user, capable of solving problems even without a graphical interface.

Checking the presence and status of a Wi-Fi adapter

Before attempting to set up a connection, you need to make sure that the operating system sees your wireless hardware. It often happens that the adapter is physically present, but software-disabled or doesn't have the required settings. driverThe first step should always be to diagnose the hardware.

To get a list of all network devices, use the command ip link or more detailed lspci for PCI devices. If you see your adapter in the list, but the status shows DOWN, this means that the interface exists but is not activated. In some cases, unlocking it is required via rfkill, especially if Wi-Fi was turned off programmatically.

Make sure the kernel module is loaded. You can do this using the command lsmod | grep wifi Or search by chipset name. A missing module may indicate the need to install proprietary drivers, which is common with Broadcom or Realtek adapters. Without the correct driver, further configuration is pointless.

  • 📡 Use ip a to quickly view the status of all interfaces.
  • 🔍 Team lspci -k will show which driver is used for the network card.
  • 🚫 Check the radio module lock with the command rfkill list.
  • 💾 Install the package linux-firmware, if the drivers are not in the database.
⚠️ Note: If the adapter shows as "unclaimed" in the lspci output, the system was unable to find the driver. In this case, you will need to connect via Ethernet to download the missing components.
📊 Which Linux distribution do you use most often?
Ubuntu/Debian
CentOS/RHEL
Arch Linux
Linux Mint
Another

Using the NetworkManager GUI

In most desktop environments, such as GNOME or KDE Plasma, network management is done through NetworkManagerThis is the most user-friendly method for beginners, allowing you to connect to Wi-Fi in just a few clicks. The interface is usually accessible from the system tray or system settings.

For manual control via a graphical utility in the terminal, you can run nm-connection-editorHere you can not only select a network from the list but also configure a static IP address, DNS servers, and proxy settings. All changes are applied instantly and saved for future sessions.

If the graphical interface is not responding, you can use a pseudo-graphical utility nmtuiIt works in any terminal, supporting keyboard navigation. It's the perfect compromise between menu convenience and command-line functionality.

  • 🖱️ Click on the network icon in the tray and select the desired SSID.
  • ⌨️ Launch nmtui for control via text menu.
  • ⚙️ In nm-connection-editor You can set a static IP.
  • 🔐 The password is saved in the system keychain.

Setting up Wi-Fi via the command line (nmcli)

For server versions of Linux or when debugging network problems, this is an indispensable tool. nmcli (NetworkManager Command Line Interface). It provides complete control over network connections without the need for a graphical shell. The command syntax may seem complex, but it is logical and structured.

First, you need to turn on the Wi-Fi radio if it's turned off. Then, scan for available access points. The command nmcli device wifi list will display a list of networks, their signal strength, and security type. This allows you to choose the optimal connection point.

To connect directly, use the command nmcli device wifi connectYou will need to know the network name (SSID) and password. Once successfully completed, the system will create a new connection and attempt to obtain an IP address via DHCP.

nmcli radio wifi on

nmcli device wifi rescan

nmcli device wifi connect"MyWiFi" password"SuperSecret123"

It is important to note that nmcli Saves connection profiles. This means that when you reappear within range of the network, the connection will be established automatically. You can view saved profiles with the command nmcli connection show.

  • 📡 Team nmcli dev wifi Displays available networks and signal strength.
  • 🔌 Connection is made with one line indicating the password.
  • 💾 Profiles are saved and used automatically in the future.
  • 🗑️ You can delete the connection using the command nmcli connection delete.
⚠️ Note: When entering a password on the command line, it may be visible in the bash history. Use the --ask option or escape characters if the password contains special characters.

☑️ Connection algorithm via nmcli

Completed: 0 / 4

Configuration via wpa_supplicant

In lightweight distributions or minimalist builds that don't use NetworkManager, the main tool remains wpa_supplicantThis is a daemon that manages connections to secure wireless networks. Working with it requires manually creating a configuration file.

The main configuration file is usually located at /etc/wpa_supplicant/wpa_supplicant.conf. You need to add a block with the network description. To generate a hashed password (PSK) instead of plaintext, it is recommended to use the utility wpa_passphrase.

After editing the configuration, you need to start the daemon, specifying the interface and path to the file. At the same time, start the DHCP client (for example, dhcpcd or dhclient) to obtain an IP address. This method provides maximum control, but requires careful attention to syntax.

wpa_passphrase"MySSID""MyPassword" >> /etc/wpa_supplicant/wpa_supplicant.conf

wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

dhclient wlan0

Usage wpa_supplicant This is critical for understanding how the handshake with the access point occurs. Unlike high-level managers, here you see the authentication process "from the inside." This is useful for debugging security protocol compatibility issues.

  • 📝 The configuration file stores data about all known networks.
  • 🔐 Password hashing improves the security of the configuration file.
  • 🚀 Starting the daemon requires specifying a specific network interface.
  • 🔄 The DHCP client must be launched separately to obtain an IP.
What to do if wpa_supplicant does not connect?

Check if NetworkManager is running concurrently, as they may conflict with each other for device control. Also, make sure the driver supports the mode specified in the configuration file (usually nl80211).

Setting up a static IP address and DNS

By default, Linux uses the protocol DHCP to automatically obtain network settings. However, corporate networks or servers often require a static IP address. This ensures predictability and allows for access to a permanent address.

In NetworkManager this can be done via nmcli, modifying an existing connection. You must specify the IPv4 address, network mask, gateway, and DNS servers. Changes take effect after reconnecting or restarting the service.

If you use Netplan (standard for Ubuntu Server), the configuration is stored in YAML files in the directory /etc/netplan/The syntax requires strict indentation. An error in the YAML file will result in the network not being able to boot.

Parameter Description Example of meaning
IP Address Static device address 192.168.1.50/24
Gateway Default gateway address 192.168.1.1
DNS Domain name servers 8.8.8.8, 1.1.1.1
Interface Network interface name wlan0 or wlp2s0

After making changes to the static network configuration files, be sure to test their application. Command ip addr show should display the new address. Checking internet access via ping will confirm that the gateway and DNS settings are correct.

  • 📍 A static IP is required for servers and printers.
  • 📄 Netplan uses YAML syntax that is sensitive to indentation.
  • 🌐 You can specify multiple DNS for backup.
  • ✅ Always check the ping after setup.
⚠️ Important: When setting up a static IP, make sure the selected address is not in the router's DHCP range, otherwise an address conflict will occur and the network will not work.

Diagnostics and problem solving

Even with proper configuration, connection issues may still occur. Common causes include an unstable signal or incorrect power-saving settings. The Linux kernel can automatically disable the Wi-Fi adapter to save power, leading to connection drops.

To disable power saving, you need to create a configuration file in /etc/NetworkManager/conf.d/ or change the driver settings. It's also worth checking the system logs (/var/log/syslog or journalctl), which often contains the exact reason for the connection error.

DNS issues are another common scenario where the network appears to be connected, but pages won't load. In this case, manually entering public DNS (for example, from Google or Cloudflare) can help. Sometimes, clearing the DNS cache is necessary.

If all else fails, try resetting your network settings to factory defaults. Deleting connection configuration files and restarting the NetworkManager service often works wonders. Keep in mind that kernel updates can break proprietary drivers.

  • 🔋 Disable power saving mode for the Wi-Fi module.
  • 📜 Logs journalctl -u NetworkManager will tell you about the reasons for the failure.
  • 🌐 Changing DNS to 8.8.8.8 often solves the access problem.
  • 🔄 Rebooting your router and computer is a classic solution that works.
Why doesn't Wi-Fi work after updating the kernel?

When upgrading the Linux kernel, proprietary drivers (such as those for Broadcom or NVIDIA) may stop compiling for the new version. This can be resolved by reinstalling the driver packages or installing kernel headers (linux-headers) before the update.

How do I find out which frequencies are supported (2.4 or 5 GHz)?

Use the command iwlist wlan0 frequency or iw dev wlan0 infoThis will show what frequency your current connection is operating on and what channels are available to your adapter.

Is it possible to share Wi-Fi from a Linux laptop?

Yes, most modern distributions allow you to create a hotspot directly through the NetworkManager settings. The adapter must support AP mode.