Skip to content

Networkmanager


NetworkManager is the service that manages network configuration on many Linux desktop and server systems. nmcli is its command-line interface.

You have already seen the lower-level ip commands. ip shows and manipulates the kernel’s networking state directly. nmcli works at a higher level: it asks NetworkManager to manage connections, devices, addresses, routes, DNS settings, and wireless networks.

For this course, you don’t need to turn nmcli into a reference manual. The useful goal is to understand what it manages and be comfortable with a few practical commands, especially when working with Wi-Fi.

What Does nmcli Manage?

A useful distinction is:

NetworkManager
      │
      ├── Devices
      │     ├── Ethernet interface
      │     └── Wi-Fi interface
      │
      └── Connections
            ├── DHCP configuration
            ├── IP addresses
            ├── routes
            ├── DNS
            └── Wi-Fi settings

A device is the actual network interface.

A connection is a configuration that NetworkManager can apply to that device.

For example:

wlan0
  │
  └── Home Wi-Fi connection

The interface is the hardware/network device. The connection contains the configuration used to connect it to a particular network.

This distinction matters because one device can have multiple connection profiles.

Check NetworkManager’s View

If your system doesn’t have nmcli install it first and enable it.

sudo apt install network-manager
sudo systemctl enable --now network-manager

Start with:

nmcli device status

You might see something like:

DEVICE   TYPE      STATE      CONNECTION
eth0     ethernet  connected  Wired connection 1
wlan0    wifi      connected  Home WiFi
lo       loopback  unmanaged  --

This gives you a quick overview of the devices NetworkManager knows about.

For Wi-Fi specifically:

nmcli device wifi list

You may get:

IN-USE  BSSID              SSID          MODE   CHAN  RATE        SIGNAL
*       AA:BB:CC:DD:EE:FF  Home WiFi     Infra  6     270 Mbit/s  80
        11:22:33:44:55:66  Office WiFi   Infra  11    130 Mbit/s  55
        77:88:99:AA:BB:CC  Guest WiFi    Infra  1     130 Mbit/s  42

This asks NetworkManager to scan for available wireless networks.

Connect To A Wi-Fi Network

The practical command is:

nmcli device wifi connect "Home WiFi" password "your-password"

NetworkManager will find the specified wireless network, authenticate using the supplied password, and create or activate a connection profile.

If the network is hidden, you can explicitly provide its SSID:

nmcli device wifi connect "Home WiFi" password "your-password" hidden yes

For practice, use your own test network and never put a real password into a command that will remain in shell history.

Note

Wi-Fi authentication can involve more than just an SSID and password. Enterprise networks, certificates, WPA variants, and other authentication methods require additional configuration. The simple command above is intended for ordinary password-protected Wi-Fi.

Check The Active Connection

After connecting:

nmcli connection show --active

This shows the currently active connection profiles.

You can also inspect a particular connection:

nmcli connection show "Home WiFi"

This is useful when you want to see the configuration NetworkManager is using rather than just the current kernel state.

nmcli Versus ip

The commands overlap in what they can tell you, but they operate at different levels.

nmcli
  │
  │ asks NetworkManager
  ▼
NetworkManager
  │
  │ manages
  ▼
kernel networking state
  │
  ▼
interfaces / addresses / routes

So:

ip addr

asks the kernel about addresses currently configured on interfaces.

Whereas:

nmcli device show

asks NetworkManager for its view of the device and its configuration.

A useful rule is:

Use ip when you are investigating or manipulating the kernel’s networking state. Use nmcli when NetworkManager is responsible for managing that configuration.

A Short Wi-Fi Workflow

When working on a NetworkManager-managed machine, a practical Wi-Fi workflow is:

nmcli device status

Check that the wireless device exists.

Then:

nmcli device wifi list

Find the available networks.

Connect:

nmcli device wifi connect "Home WiFi" password "your-password"

Verify:

nmcli connection show --active

And, if you want to inspect the resulting IP configuration:

ip addr

This gives you both views:

NetworkManager
    ↓
nmcli
    ↓
connection configuration

Kernel
    ↓
ip
    ↓
actual interface/IP state

What You Should Remember

You don’t need to memorize hundreds of nmcli options.

The important concepts are:

Device
    → actual network interface

Connection
    → configuration managed by NetworkManager

nmcli device status
    → see managed devices

nmcli device wifi list
    → scan for Wi-Fi networks

nmcli device wifi connect ...
    → connect to Wi-Fi

nmcli connection show --active
    → see active connections

nmcli is therefore not a replacement for everything you have learned with ip. It is a higher-level management interface that becomes especially useful when NetworkManager is responsible for configuring the machine.

What’s Next

The next topic moves back toward the kernel and asks a more fundamental question: how does Linux actually process network traffic? We’ll connect interfaces, IP addresses, routing, sockets, and applications to the kernel’s networking path.

Last updated on