nmcli is the command-line interface for NetworkManager, the Linux service that manages network devices and connection profiles. Unlike the lower-level ip command, which inspects and changes kernel networking state directly, nmcli works through NetworkManager and can create persistent profiles that survive reboot.
This lesson follows Linux Command #56 – ethtool. ethtool focuses on the physical and driver side of an Ethernet interface; nmcli focuses on the managed connection profile, addressing, routes, DNS, Wi-Fi, and activation state.
Red Hat Enterprise Linux demonstrates why nmcli is useful for persistent network configuration and automation.
Elementary Overview
NetworkManager separates a device from a connection profile. A device is the actual interface, such as enp1s0 or wlan0. A connection profile is the saved configuration that NetworkManager can apply to that device. A single interface can have multiple profiles—for example, a DHCP profile and a static-IP profile—but only the appropriate profile is active at a given time.
The official NetworkManager manual describes nmcli as a tool for reporting network status and for creating, displaying, editing, deleting, activating, and deactivating connections. It is especially useful on servers, headless systems, and terminals where no graphical network tool is available.
Start Read-Only
Before changing a production host, inspect its state:
nmcli general status
nmcli device status
nmcli connection show
nmcli connection show --active
nmcli device status shows the devices NetworkManager sees, their type, state, and active connection. nmcli connection show lists saved profiles. This distinction is important: a profile can exist even when it is not currently active.
Inspect One Interface
To inspect a specific network interface card:
nmcli device show enp1s0
The output can include hardware address, state, current IPv4 and IPv6 addresses, default gateway, DNS servers, routes, and other properties. Compare that with ip addr and ip route when you need to distinguish NetworkManager’s intended configuration from the kernel’s current state.
Inspect a Saved Connection Profile
nmcli connection show "Wired connection 1"
This displays the stored settings for that profile. NetworkManager’s current documentation describes connection profiles as persistent network configurations that are applied to devices when activated.
Activate and Deactivate a Connection
sudo nmcli connection up "Wired connection 1"
sudo nmcli connection down "Wired connection 1"
Use these cautiously on remote systems. Bringing down the profile that carries your SSH session can immediately disconnect you.
Learn with Imran Afzal demonstrates NetworkManager, nmcli, connection profiles, static addressing, and related RHEL networking workflows in English.
Configure DHCP
To configure a profile for automatic DHCP addressing:
sudo nmcli connection modify "Wired connection 1" ipv4.method auto
sudo nmcli connection up "Wired connection 1"
After activation, verify the assigned address, gateway, lease behavior, and DNS information rather than assuming the command succeeded merely because it returned without an error.
Configure a Static IPv4 Address
sudo nmcli connection modify "Wired connection 1" \
ipv4.method manual \
ipv4.addresses 192.0.2.50/24 \
ipv4.gateway 192.0.2.1 \
ipv4.dns "192.0.2.53 1.1.1.1"
Then activate the profile:
sudo nmcli connection up "Wired connection 1"
Replace the documentation-only example addresses with values appropriate to your network. Before changing a remote server, verify the server network configuration, switch VLAN, subnet, gateway, DNS server, and rollback plan.
DNS Management
nmcli can persist DNS servers inside a NetworkManager profile:
sudo nmcli connection modify "Wired connection 1" ipv4.dns "192.0.2.53 192.0.2.54"
NetworkManager may integrate with systemd-resolved, dnsmasq, or distribution-specific resolver handling. Do not assume that manually editing /etc/resolv.conf is persistent when NetworkManager owns resolver configuration.
Wi-Fi From the Terminal
nmcli radio wifi
nmcli device wifi list
sudo nmcli device wifi connect "SSID_NAME" password "PASSWORD"
Do not expose real credentials in screenshots, shell history, documentation, or tickets. The official manual also provides --ask for interactive prompting when required credentials are missing.
Terse Output for Scripts
For automation, nmcli -t provides terse output intended for machine processing. The documentation also recommends using the C locale when scripts depend on stable English output:
LC_ALL=C nmcli -t -f DEVICE,STATE device status
This matters because normal nmcli output can be localized. Scripts that parse translated human-readable output can fail unexpectedly on another host.
Monitor NetworkManager Changes
nmcli monitor
nmcli device monitor enp1s0
nmcli connection monitor "Wired connection 1"
Monitoring is useful when an interface repeatedly drops, reconnects, changes addresses, or switches profiles. Pair it with ethtool for physical-link evidence and with systemd logs when NetworkManager itself appears unstable.
This English nmcli tutorial covers devices, connections, static IP addressing, DNS, NetworkManager, and common administrative workflows.
nmcli vs. ip
The ip utility from iproute2 works directly with current kernel networking state. nmcli controls NetworkManager and its persistent profiles. A temporary ip address add change may disappear after reboot or after NetworkManager reapplies its own configuration, while a properly modified NetworkManager profile can persist.
This is why technicians should know which component owns the interface before changing it. On a NetworkManager-managed server, mixing manual ip changes with persistent NetworkManager profiles can create confusing differences between intended state and running state.
A Red Hat community discussion illustrates why modern administrators still learn NetworkManager and nmcli, especially for persistent configuration and automation. Community comments are practical experience, not a substitute for distribution documentation.
Common Failure Patterns
- Device shows unmanaged: NetworkManager may be configured not to manage that interface, another network service may own it, or distribution policy may exclude it.
- Profile exists but is not active: inspect
nmcli connection show --activeand device state. - Static address appears correct but traffic fails: verify prefix, gateway, VLAN, route, DNS, and duplicate-address conditions.
- Changes disappear after reboot: confirm you modified the persistent connection profile rather than only runtime kernel state.
- Remote session drops after a change: the active profile may have been deactivated or replaced. Use console access and a rollback plan for risky changes.
- DNS behaves differently from the profile: inspect resolver integration and whether another service is modifying DNS state.
Hands-On Exercise
On a Linux system you control, run nmcli general status, nmcli device status, nmcli connection show, and nmcli connection show --active. Identify the active interface and the profile currently attached to it. Then run nmcli device show INTERFACE and record the IPv4 address, gateway, and DNS servers.
If you have a disposable lab interface or virtual machine, clone or create a test profile and practice switching between DHCP and a static documentation-range address. Do not perform the configuration-changing portion on a production or remotely administered interface.
Knowledge Check
- What service does
nmclicontrol? - What is the difference between a network device and a connection profile?
- Which command lists active profiles?
- Why can a temporary
ipcommand differ from the persistent NetworkManager configuration? - Which
nmclicommand displays detailed information for one device? - What does
ipv4.method autonormally request? - Why is changing an active remote-management profile risky?
- Why is
nmcli -tuseful in scripts? - Why can manual edits to
/etc/resolv.confdisappear? - What command can watch NetworkManager activity in real time?
Answers
- NetworkManager.
- The device is the interface itself; the profile is the saved configuration that NetworkManager can apply to it.
nmcli connection show --active.- Because
ipcan change current kernel state without changing the persistent NetworkManager profile. nmcli device show INTERFACE.- Automatic IPv4 configuration, commonly through DHCP.
- Deactivating or replacing it can immediately sever SSH or other remote access.
- It provides terse output intended for machine parsing.
- NetworkManager or another resolver-management service may regenerate it.
nmcli monitor.
Primary References
- NetworkManager — nmcli Reference Manual
- NetworkManager Reference Manual
- NetworkManager — nm-settings-nmcli
BitcoinVersus.Tech Editor’s Note:
We volunteer daily to ensure the credibility of the information on this platform is Verifiably True. If you would like to support to help further secure the integrity of our research initiatives, please donate using the QR code provided

For best QR-code scanning results, please scan this donation code from a desktop or larger screen. Mobile screens may prevent camera recognition.
BitcoinVersus.Tech provides technical education and analysis for informational purposes only.

Leave a Reply