Network Manager: How to Set Up WiFi and Manage Networks in Linux

In modern Linux distributions, managing network connections is no longer the preserve of select system administrators who know the syntax of configuration files by heart. Network Manager has become a de facto standard, providing a convenient and flexible interface for working with wireless connections. This daemon automatically handles network status changes, ensuring stable internet access without the need for manual intervention at each system startup.

However, graphical interfaces such as GNOME NetworkManager or KDE Plasma NetworkManager, don't always display the full range of available options. In situations where you need to fine-tune security settings, work with hidden access points, or diagnose connection problems, the command line comes to the rescue. Understanding how it works nmcli gives the user complete control over the network infrastructure.

In this article, we'll cover not only basic connection commands, but also advanced techniques for managing profiles, setting up static IP addresses, and debugging connections. Network Manager stores the configuration in the format keyfile, which makes profiles portable and easy to edit, but requires care when making manual changes.

Checking the status and available interfaces

Before making any changes, it is necessary to assess the current state of the network subsystem. Team nmcli general status Provides a summary of the daemon's global state, indicating whether network management is enabled. If the status shows "disconnected" or "unmanaged," further connection attempts will fail.

To obtain detailed information about physical and logical interfaces, use the command nmcli deviceIt displays a list of all network cards, their type, current status, and connected connection. It's important to distinguish between the device status (UP/DOWN) and the connection status (Connected/Disconnected).

  • 📡 DEVICE — the name of the network interface, for example, wlan0 or wlp2s0.
  • 🔌 TYPE — the type of device, in our case we are interested in wifi.
  • 🟢 STATE — current status, where connected means an active connection.
  • 🏷️ CONNECTION — the name of the active connection profile.
⚠️ Note: If you see "unmanaged" in the STATE column, this means Network Manager is ignoring this interface. This often occurs in server Linux builds where network management is delegated to systemd-networkd or configured manually via netplan.

For more detailed viewing, including IP addresses, DNS servers, and MAC addresses, add the flag show to the device name. This allows you to quickly confirm whether the interface has received an address via DHCP or whether manual configuration is required.

📊 Which Linux distribution do you use for WiFi?
Ubuntu/Debian
Fedora/CentOS
Arch/Manjaro
Other (Gentoo, Slackware)
I only use Windows/macOS

Network scanning and initial connection

The first step to establishing a connection is to detect available access points within range of your antenna. nmcli device wifi list Starts a scan and displays a list of visible networks. Please note that frequent use of this command can put a strain on the wireless adapter, so avoid running it in a loop unless necessary.

The command output contains the columns SSID, operating mode, channel, signal speed (SIGNAL), security, and current status. Signal strength is expressed as a percentage, with values ​​above 70% considered excellent and below 30% considered extremely unstable. To connect to an open network, simply specify the SSID.

nmcli device wifi connect "MyHomeWiFi"

If the network is password protected, it must be passed in the command via the parameter password. Network Manager will automatically create a connection profile and attempt to log in. If successful, the connection will be established, and the profile will be saved for automatic future connections.

  • 🔐 For WPA2/WPA3 networks, simply add the password at the end of the command.
  • 🙈 For hidden networks (Hidden SSID) add a flag hidden yes.
  • 🏢 For corporate networks, you may need to specify the authentication phase.

It is important to note that when you first connect to a new network Network Manager Creates a new connection profile. This profile's name is the same as the SSID by default, but can be changed by the user for easier administration, especially if you connect to multiple networks with the same name in different locations.

Managing connection profiles

Profiles are the heart of the network management system. Each profile contains a set of parameters: SSID, security type, passwords, IP and DNS settings. A list of all saved profiles can be obtained with the command nmcli connection showUnlike the device list, this displays logical configurations that may be active right now or waiting for their turn.

Switching between known networks does not require re-entering the password. Simply use the command nmcli connection up Followed by the profile name. This is especially useful in scenarios where the device moves between the office and home, where different configurations are used.

Team Description of action Example of use
nmcli c show Show all profiles List all saved networks
nmcli c up "Name" Activate profile Connecting to the "Office_WiFi" network
nmcli c down "Name" Deactivate profile Disconnection from the current network
nmcli c delete "Name" Delete profile Clearing old settings

Deleting a profile doesn't delete the physical interface; it only erases the saved settings. This is a safe operation if you want to reset a specific network's configuration and recreate it with clear parameters.

☑️ Connection diagnostic checklist

Completed: 0 / 4

Manual creation and editing of profiles

Automatic profile creation is convenient, but often requires manual fine-tuning. You can create a new profile from scratch, even if the network isn't currently visible (for example, a hidden network or a network with MAC filtering). The command nmcli connection add allows you to set all parameters explicitly.

nmcli connection add type wifi con-name "MyProfile" ifname wlan0 ssid "HiddenNet"

nmcli connection modify "MyProfile" wifi-sec.key-mgmt wpa-psk

nmcli connection modify "MyProfile" wifi-sec.psk "SuperSecretPassword"

nmcli connection modify "MyProfile" ipv4.method manual ipv4.addresses "192.168.1.50/24" ipv4.gateway "192.168.1.1"

In the example given we are creating a profile MyProfile, we bind it to the interface wlan0, configure WPA-PSK security, and assign a static IP address. Note the division of the command into stages: first, a connection "skeleton" is created, then its properties are modified. The changes take effect only after a profile or system reboot.

  • 🛠 con-name — an arbitrary profile name that is easy to remember.
  • 📶 ifname — the name of the physical interface to which the profile is bound.
  • 🔒 wifi-sec — a group of parameters responsible for encryption and passwords.
  • 🌐 ipv4.method — address assignment method (auto, manual, link-local).
⚠️ Warning: When editing active profiles, changes may not be applied immediately. It is recommended to modify execute nmcli connection down "Name" and then up "Name" to apply new settings.

To view all the parameters of a specific profile, use the command nmcli connection show "Name"The output will be very detailed, so it is convenient to use filtering via grep, if you are interested in a specific parameter, such as an IP address or DNS.

Setting up static IP and DNS

Corporate networks or servers often require a fixed IP address. Network Manager Allows you to easily switch from DHCP to static configuration. It's important to specify the correct subnet mask and gateway, otherwise the device will be isolated.

Group parameters are also used to configure DNS ipv4 (or ipv6). If you want to ignore the DNS servers provided by your ISP, you must explicitly specify the DNS retrieval method or enter the addresses manually. Automatic DNS retrieval sometimes leads to leaks or the use of slow servers.

nmcli connection modify "HomeWiFi" ipv4.addresses "192.168.1.100/24"

nmcli connection modify "HomeWiFi" ipv4.gateway "192.168.1.1"

nmcli connection modify "HomeWiFi" ipv4.dns "8.8.8.8, 1.1.1.1"

nmcli connection modify "HomeWiFi" ipv4.ignore-auto-dns yes

Parameter ipv4.ignore-auto-dns yes This is critical if you want to ensure that the system uses the DNS you specified, and not the one pushed by the router. After making changes, be sure to reconnect.

What is connection priority?

Network Manager assigns a priority to profiles (connection.autoconnect-priority). If multiple known networks are available, the profile with the highest priority will be selected. You can change it with the command: nmcli connection modify "Name" connection.autoconnect-priority 100 . The higher the number, the higher the priority.

Troubleshooting and debugging

Even in a well-functioning system, failures can occur. Network Manager provides powerful logging tools. The main log can be viewed via journalctl, filtering by unit NetworkManagerThis allows you to see the handshake process, authentication errors, or DHCP issues in real time.

A common problem is a device or profile becoming stuck in a state. In such cases, restarting the network daemon itself can help. This is a safe operation that rebuilds all configurations.

sudo systemctl restart NetworkManager
  • 🔍 journalctl -u NetworkManager -f — real-time log monitoring.
  • 🔄 nmcli radio wifi off/on — software switching the adapter on and off.
  • 🗑️ nmcli connection delete - deleting the problematic profile for a clean re-creation.

If your device is constantly losing connection, check your power saving settings. Some WiFi drivers aggressively disable the card to save battery, which can cause disconnects. This can be resolved by adding a setting. wifi.powersave with meaning 2 (disabled) in the profile configuration.

FAQ: Frequently Asked Questions

How do I find a saved WiFi password in Network Manager?

Passwords are stored in encrypted form, but nmcli can display them. Use the command: nmcli connection show "Name" | grep 802-11-wireless-security.key-mgmt to check the type, and to view the password itself (if you have root rights): sudo nmcli connection show "Name" | grep psk.

Why doesn't Network Manager see my WiFi adapter?

Most likely, the driver is missing or blocked. Check the output. lspci or lsusbAlso make sure that WiFi is not blocked by a hardware switch or command. rfkill. Perform rfkill list and, if necessary, rfkill unblock wifi.

Is it possible to set up WiFi distribution (Hotspot) using nmcli?

Yes, it is possible. You need to create a connection with the mode mode ap. Example: nmcli connection add type wifi ifname wlan0 con-name MyHotspot ssid MyHotspot mode ap wifi-sec.key-mgmt wpa-psk wifi-sec.psk "12345678" ipv4.method shared.

How to force the system to ignore certain networks?

Network Manager doesn't have a direct blacklist feature for scanning, but you can prevent automatic connections to known networks. Use the command: nmcli connection modify "BadNetwork" connection.autoconnect noThis will prevent the connection, but the network will still be visible in the list.