nmcli Command in Linux: Network Configuration, IP, DNS, Routing & Examples

nmcli is the command-line client for NetworkManager. It lists devices and connections, sets IPv4/IPv6 addresses, DNS, routes, hostname, and applies profile changes without editing ifcfg files by hand.

Published

Updated

Read time 15 min read

Reviewed byDeepak Prasad

nmcli Command in Linux: Network Configuration, IP, DNS, Routing & Examples
About nmcli is the command-line client for NetworkManager. It lists devices and connections, sets IPv4/IPv6 addresses, DNS, routes, hostname, and applies profile changes without editing ifcfg files by hand.
Tested on RHEL/CentOS 8; nmcli 1.22.x; NetworkManager with ifcfg files under /etc/sysconfig/network-scripts/
Package network-manager (apt/deb) · NetworkManager (dnf/rpm)
Man page nmcli(1)
Privilege root / sudo for most changes
Distros

Any Linux distro that runs NetworkManager (Fedora, RHEL, AlmaLinux, Ubuntu Desktop/Server with NM).

Distros without NetworkManager: use ip or distribution-specific tools — not nmcli.

Related guide

nmcli — quick reference

General status and hostname

Check whether NetworkManager is running and read or set the system hostname.

When to use Command
See if NetworkManager is running (terse yes/no) nmcli -t -f RUNNING general
Show connectivity, Wi‑Fi/WWAN state, metered hint nmcli general
Show current hostname nmcli general hostname
Set hostname through NetworkManager sudo nmcli general hostname new-name

Devices

List interfaces NetworkManager manages and inspect live addresses on a device.

When to use Command
Short device list with state and active profile nmcli dev status
Full details for all devices nmcli dev show
Details for one interface (IP, routes, DNS) nmcli dev show IFACE
Disconnect an interface (drops active connection) sudo nmcli dev disconnect IFACE
Reconnect using autoconnect profiles sudo nmcli dev connect IFACE
Terse device:state pairs for scripts nmcli -t -f DEVICE,STATE dev

Connections — list and inspect

Connection profiles are saved settings; a device may activate one profile at a time.

When to use Command
List all saved connection profiles nmcli con show
List only active profiles nmcli con show --active
Show every property on one profile nmcli con show NAME
Print one field (labelled) nmcli -f ipv4.dns,ipv4.addresses con show NAME
Print field values only (good for scripts) nmcli -g IP4.ADDRESS con show NAME
Reload profiles from disk after manual file edits sudo nmcli con reload

Connections — create, modify, delete

When to use Command
Add an Ethernet profile bound to an interface sudo nmcli con add type ethernet ifname IFACE con-name NAME
Rename a profile sudo nmcli con mod OLD connection.id NEW
Set a single property sudo nmcli con mod NAME PROPERTY VALUE
Delete a profile (disconnects if active) sudo nmcli con del NAME
Activate a profile on its interface sudo nmcli con up NAME
Deactivate a profile sudo nmcli con down NAME
Edit a profile in an interactive prompt sudo nmcli con edit NAME
Control boot autoconnect sudo nmcli con mod NAME connection.autoconnect yes

IPv4 addressing and gateway

When to use Command
Static IPv4 address and prefix sudo nmcli con mod NAME ipv4.method manual ipv4.addresses 192.0.2.10/24
Default gateway for IPv4 sudo nmcli con mod NAME ipv4.gateway 192.0.2.1
Switch profile to DHCP sudo nmcli con mod NAME ipv4.method auto
Remove one static address sudo nmcli con mod NAME -ipv4.addresses 192.0.2.10/24
Prevent this profile from being default route sudo nmcli con mod NAME ipv4.never-default yes
Disable IPv6 on a profile sudo nmcli con mod NAME ipv6.method disabled
Ignore IPv6 entirely (older profiles) sudo nmcli con mod NAME ipv6.method ignore

IPv6 addressing

When to use Command
Static IPv6 address and prefix sudo nmcli con mod NAME ipv6.method manual ipv6.addresses 2001:db8::a/64
SLAAC / router advertisements sudo nmcli con mod NAME ipv6.method auto
DHCPv6 only (no SLAAC) sudo nmcli con mod NAME ipv6.method dhcp
Set IPv6 gateway sudo nmcli con mod NAME ipv6.gateway 2001:db8::1
Append IPv6 DNS server sudo nmcli con mod NAME +ipv6.dns 2001:db8::dns
Ignore DNS from DHCPv6 sudo nmcli con mod NAME ipv6.ignore-auto-dns yes

DNS and search domains

When to use Command
Replace DNS list with one server sudo nmcli con mod NAME ipv4.dns 1.1.1.1
Append another DNS server sudo nmcli con mod NAME +ipv4.dns 8.8.8.8
Remove a DNS entry sudo nmcli con mod NAME -ipv4.dns 8.8.8.8
Ignore DNS from DHCP sudo nmcli con mod NAME ipv4.ignore-auto-dns yes
Set DNS search domain sudo nmcli con mod NAME ipv4.dns-search example.com
When to use Command
Add a static IPv4 route sudo nmcli con mod NAME +ipv4.routes "10.0.0.0/8 192.0.2.1"
Remove a static route sudo nmcli con mod NAME -ipv4.routes "10.0.0.0/8 192.0.2.1"
Set Ethernet MTU sudo nmcli con mod NAME 802-3-ethernet.mtu 9000
Bind profile to a MAC address sudo nmcli con mod NAME 802-3-ethernet.mac-address AA:BB:CC:DD:EE:FF

Monitoring and output control

When to use Command
Watch connection and device events nmcli monitor
Watch one profile for changes nmcli con monitor NAME
Tab-separated script-friendly output nmcli -t -f FIELD dev status
Pretty multi-line output (default for humans) nmcli -p con show NAME
Show built-in help nmcli --help
Show nmcli version nmcli --version

nmcli — command syntax

nmcli groups commands by object. Synopsis from nmcli --help on Ubuntu 25.04 (nmcli 1.52.0):

text
nmcli [OPTIONS] OBJECT { COMMAND | help }

OBJECT
  general       NetworkManager general status and hostname
  networking    overall networking control
  radio         Wi‑Fi/WWAN radio switches
  connection    connection profiles
  device        devices managed by NetworkManager
  agent         secret or polkit agent
  monitor       watch for changes

Most day-to-day work uses nmcli dev …, nmcli con …, and nmcli general …. Profiles are stored under /etc/NetworkManager/system-connections/ on current Ubuntu and Fedora. On RHEL/CentOS 7/8, the same nmcli con mod properties often map to keys in /etc/sysconfig/network-scripts/ifcfg-* — see the tables below when you read or hand-edit those files.


nmcli — nm-settings vs ifcfg directives

On RHEL-family systems that still use ifcfg-* files, each nmcli con mod property has a legacy key name. The Effect column is what you care about on the wire; the two left columns show how the same setting is named in nmcli vs ifcfg.

IPv4 mapping

nmcli con mod property ifcfg-* key Effect
ipv4.method manual BOOTPROTO=none IPv4 address configured statically
ipv4.method auto BOOTPROTO=dhcp Use DHCPv4
ipv4.addresses 192.168.0.10/24 IPADDR=192.168.0.10
PREFIX=24
Static IPv4 address and prefix
ipv4.gateway 192.168.0.1 GATEWAY=192.168.0.1 Default IPv4 gateway
ipv4.dns 8.8.8.8 DNS1=8.8.8.8 Nameserver written to resolver config
ipv4.dns-search example.com DOMAIN=example.com DNS search domain
ipv4.ignore-auto-dns yes PEERDNS=no Ignore DNS from DHCP
connection.autoconnect yes ONBOOT=yes Activate profile at boot
connection.id eth0 NAME=eth0 Profile display name
connection.interface-name eth0 DEVICE=eth0 Bind profile to interface name
802-3-ethernet.mac-address … HWADDR=… Bind profile to MAC address
ipv4.never-default yes DEFROUTE=no Do not use this profile's gateway as default route
ipv4.never-default no DEFROUTE=yes Allow default route from this profile

IPv6 mapping

nmcli con mod property ifcfg-* key Effect
ipv6.method manual IPV6_AUTOCONF=no Static IPv6
ipv6.method auto IPV6_AUTOCONF=yes SLAAC from router advertisements
ipv6.method dhcp IPV6_AUTOCONF=no
DHCPV6C=yes
DHCPv6 without SLAAC
ipv6.addresses 2001:db8::a/64 IPV6ADDR=2001:db8::a/64 Static IPv6 address
ipv6.gateway 2001:db8::1 IPV6_DEFAULTGW=2001:db8::1 IPv6 default gateway
ipv6.dns … DNS0=… (and higher) IPv6 nameserver
ipv6.dns-search example.com DOMAIN=example.com DNS search domain
ipv6.ignore-auto-dns yes IPV6_PEERDNS=no Ignore DNS from DHCPv6
connection.autoconnect yes ONBOOT=YES Activate profile at boot
connection.id eth0 NAME=eth0 Profile name
connection.interface-name eth0 DEVICE=eth0 Interface binding
802-3-ethernet.mac-address … HWADDR=… MAC binding
ipv6.method disabled or ignore IPV6INIT=no Turn off IPv6 on the profile

Use +property and -property on multi-value settings (ipv4.dns, ipv4.addresses, bond.options, and similar) to append or remove single entries without replacing the whole list.


nmcli — command examples

Essential Check NetworkManager and list devices

You can use the commands below to check if NetworkManager is running and to list all available devices.

Check if NetworkManager is running:

text
# nmcli -t -f RUNNING general
running

To get a general status:

text
# nmcli general
STATE      CONNECTIVITY  WIFI-HW  WIFI     WWAN-HW  WWAN
connected  full          enabled  enabled  enabled  enabled

To view and list all available devices:

text
# nmcli dev status
DEVICE      TYPE      STATE         CONNECTION
eth0        ethernet  connected     eth0
virbr0      bridge    disconnected  --
eth1        ethernet  disconnected  --
eth2        ethernet  disconnected  --
lo          loopback  unmanaged     --

If RUNNING is not running, start NetworkManager with sudo systemctl start NetworkManager before changing profiles.

Essential Read and set hostname with nmcli

You can change hostname with hostnamectl, but NetworkManager can also read and update it.

To get the current hostname:

text
# nmcli general hostname
centos-8.example.com

Next, update the hostname:

text
# nmcli general hostname centos-8.golinuxcloud.com

Verify the same:

text
# nmcli general hostname
centos-8.golinuxcloud.com

# hostname
centos-8.golinuxcloud.com

On systemd distros this aligns with hostnamectl for many setups.

Essential List connections and inspect selected fields

List all available connections:

text
# nmcli con show
NAME  UUID                                  TYPE      DEVICE
eth1  01fa0bf4-b6bd-484f-a9a3-2b10ff701dcd  ethernet  eth1
eth0  2e9f0cdd-ea2f-4b63-b146-3b9a897c9e45  ethernet  eth0
eth2  186053d4-9369-4a4e-87b8-d1f9a419f985  ethernet  eth2

To view all configured values of an interface:

text
# nmcli con show eth2
connection.id:                          eth2
connection.uuid:                        186053d4-9369-4a4e-87b8-d1f9a419f985
connection.interface-name:              eth2
connection.autoconnect:                 yes

To get the IPv4 address of eth1 (value only):

text
# nmcli -g ip4.address connection show eth1
10.10.10.4/24

To print selected fields with labels:

text
# nmcli -f ipv4.dns,ipv4.addresses,ipv4.gateway con show eth1
ipv4.dns:                               8.8.8.8,8.2.2.2
ipv4.addresses:                         10.10.10.4/24
ipv4.gateway:                           10.10.10.1

Use -g for scripts; use -f when you want field names. For the live address on the wire, prefer nmcli -g IP4.ADDRESS dev show IFACE.

Common Create an Ethernet profile with static IPv4

In this example nmcli configures eth2 statically with address 10.10.10.4/24 and gateway 10.10.10.1. The profile is saved to /etc/sysconfig/network-scripts/ifcfg-eth2.

text
# nmcli con add con-name eth2 type ethernet ifname eth2 ipv4.method manual ipv4.address 10.10.10.4/24 ipv4.gateway 10.10.10.1
Connection 'eth2' (460b16aa-e755-403e-b0ec-5e1560dcc441) successfully added.

Verify the ifcfg file:

text
# egrep 'BOOTPROTO|IPADDR|PREFIX|GATEWAY' /etc/sysconfig/network-scripts/ifcfg-eth2
BOOTPROTO=none
IPADDR=10.10.10.4
PREFIX=24
GATEWAY=10.10.10.1

Run sudo nmcli con up eth2 from console if this is the NIC you use for SSH.

Common Create an Ethernet profile with DHCP

The following command adds a connection for eth2 that gets IPv4 settings from DHCP and autoconnects at startup. Configuration is saved in /etc/sysconfig/network-scripts/ifcfg-eth2.

text
# nmcli con add con-name eth2 type ethernet ifname eth2 ipv4.method auto
Connection 'eth2' (d75cb87f-cd15-40a2-9c33-138e69a06a1f) successfully added.

Verify in the ifcfg file:

text
# egrep BOOTPROTO /etc/sysconfig/network-scripts/ifcfg-eth2
BOOTPROTO=dhcp
Common Switch a profile between DHCP and static

Change eth2 from DHCP to static — modify ipv4.method to manual:

text
# nmcli con mod eth2 ipv4.method manual ipv4.address 10.10.10.4/24 ipv4.gateway 10.10.10.1

Verify the network configuration file:

text
# egrep 'BOOTPROTO|IPADDR|PREFIX|GATEWAY' /etc/sysconfig/network-scripts/ifcfg-eth2
BOOTPROTO=none
IPADDR=10.10.10.4
PREFIX=24
GATEWAY=10.10.10.1

Change eth2 from static back to DHCP — set ipv4.method to auto:

text
# nmcli con mod eth2 ipv4.method auto

Verify the ifcfg file again:

text
# egrep 'BOOTPROTO|IPADDR|PREFIX|GATEWAY' /etc/sysconfig/network-scripts/ifcfg-eth2
BOOTPROTO=dhcp
IPADDR=10.10.10.4
PREFIX=24
GATEWAY=10.10.10.1

Bring the profile up and check the live address:

text
# nmcli con up eth2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/23)

# ip addr show dev eth2
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 10.10.10.5/24 brd 10.10.10.255 scope global noprefixroute dynamic eth2

Stale IPADDR lines may remain in ifcfg after switching to DHCP, but DHCP assigns the live address — here 10.10.10.5.

Common Add, append, and remove DNS servers on eth1

Use ipv4.dns to set DNS on a connection. Currently there is no DNS server on eth1:

text
# egrep DNS /etc/sysconfig/network-scripts/ifcfg-eth1

Add a DNS server:

text
# nmcli con mod eth1 ipv4.dns 8.8.8.8

Verify:

text
# egrep DNS /etc/sysconfig/network-scripts/ifcfg-eth1
DNS1=8.8.8.8

Append a second DNS server with the + prefix:

text
# nmcli con mod eth1 +ipv4.dns 8.2.2.2

Verify:

text
# egrep DNS /etc/sysconfig/network-scripts/ifcfg-eth1
DNS1=8.8.8.8
DNS2=8.2.2.2

Remove DNS entries with the - prefix:

text
# nmcli con mod eth1 -ipv4.dns 8.2.2.2,8.8.8.8

Verify:

text
# egrep DNS /etc/sysconfig/network-scripts/ifcfg-eth1

The same + and - prefixes work on other multi-value properties such as ipv4.addresses and bond.options.

Common ONBOOT, DEFROUTE, and disable IPv6 on eth2

Change ONBOOT (autoconnect) — verify before changing:

text
# egrep 'ONBOOT' /etc/sysconfig/network-scripts/ifcfg-eth2
ONBOOT=yes

Disable autoconnect:

text
# nmcli con mod eth2 connection.autoconnect no

Re-verify:

text
# egrep 'ONBOOT' /etc/sysconfig/network-scripts/ifcfg-eth2
ONBOOT=no

Change DEFROUTE (never use as default gateway) — verify first:

text
# egrep '^DEFROUTE' /etc/sysconfig/network-scripts/ifcfg-eth2
DEFROUTE=yes

Turn off default gateway for this profile:

text
# nmcli con mod eth2 ipv4.never-default yes

Re-verify:

text
# egrep '^DEFROUTE' /etc/sysconfig/network-scripts/ifcfg-eth2
DEFROUTE=no

Disable IPv6 — verify IPV6INIT:

text
# egrep 'IPV6INIT' /etc/sysconfig/network-scripts/ifcfg-eth2
IPV6INIT=yes

Disable IPv6 on the connection:

text
# nmcli con mod eth2 ipv6.method ignore

Re-verify:

text
# egrep 'IPV6INIT' /etc/sysconfig/network-scripts/ifcfg-eth2
IPV6INIT=no

Supported ipv6.method values include ignore, auto, dhcp, link-local, manual, and shared.

Common Reload, activate, deactivate, and delete connections

Reload all connection files from disk (use after hand-editing ifcfg or keyfiles):

text
# nmcli con reload

Activate a connection:

text
# nmcli con up eth2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/23)

Verify active connections:

text
# nmcli con show --active
NAME  UUID                                  TYPE      DEVICE
eth1  01fa0bf4-b6bd-484f-a9a3-2b10ff701dcd  ethernet  eth1
eth0  2e9f0cdd-ea2f-4b63-b146-3b9a897c9e45  ethernet  eth0
eth2  186053d4-9369-4a4e-87b8-d1f9a419f985  ethernet  eth2

Deactivate a connection:

text
# nmcli con down eth1
Connection 'eth1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/32)

Verify active connections again:

text
# nmcli con show --active
NAME  UUID                                  TYPE      DEVICE
eth0  d05aee6a-a069-4e55-9fe4-771ca3336db6  ethernet  eth0

con reload does not push new addresses to active connections — use con up for routine IP or DNS changes. Deactivating the interface you use for SSH will drop your session. Delete profiles with nmcli con del NAME.

Advanced Create an active-backup bond with two slave interfaces

Delete any existing configuration for the slave interfaces:

text
# nmcli con del "eth1"
# nmcli con del "Wired connection 1"

Add the bond master (mybond0, active-backup mode):

text
# nmcli con add type bond ifname mybond0 bond.options "mode=active-backup,downdelay=5,miimon=100,updelay=10"
Connection 'bond-mybond0' (a5c76dbe-550b-4abf-8dc0-88184ade369e) successfully added.

Add slave 1 bound to eth1:

text
# nmcli con add type ethernet ifname eth1 master mybond0
Connection 'bond-slave-eth1' (54dc4282-b90b-4469-9cbf-82bce042de85) successfully added.

Add slave 2 bound to eth2:

text
# nmcli con add type ethernet ifname eth2 master mybond0
Connection 'bond-slave-eth2' (41a5b4a6-8e6b-4df9-bff2-b67c5328311a) successfully added.

List active connections:

text
# nmcli con show
NAME             UUID                                  TYPE      DEVICE
bond-mybond0     25ce17b2-fffb-4bf1-a5a3-e7593299f303  bond      mybond0
bond-slave-eth1  54dc4282-b90b-4469-9cbf-82bce042de85  ethernet  eth1
bond-slave-eth2  41a5b4a6-8e6b-4df9-bff2-b67c5328311a  ethernet  eth2
eth0             d05aee6a-a069-4e55-9fe4-771ca3336db6  ethernet  eth0

Set static IP, gateway, DNS, and DNS search on the bond:

text
# nmcli con mod bond-mybond0 ipv4.method manual ipv4.address 10.10.10.8/24 ipv4.gateway 10.10.10.1 ipv4.dns 8.8.8.8 ipv4.dns-search example.com

Activate the bond:

text
# nmcli con up bond-mybond0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)

Verify the bond IP address:

text
# ip addr show mybond0
7: mybond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 10.10.10.8/24 brd 10.10.10.255 scope global noprefixroute mybond0

For round-robin bonding use bond.options "downdelay=5,miimon=100,mode=balance-rr,updelay=10". Remove the bond with nmcli con del bond-mybond0 bond-slave-eth1 bond-slave-eth2. See also the NIC teaming and network bridge guides.

Advanced Monitor changes and edit a profile interactively

Run nmcli con monitor eth1 in one terminal. In another terminal, modify the connection:

text
# nmcli con mod eth1 ipv4.method manual ipv4.address 10.10.10.4/24

The monitor terminal shows:

text
# nmcli con monitor eth1
eth1: connection profile changed

Interactive edit — change eth1's IP address with nmcli con edit:

text
# nmcli con edit eth1

===| nmcli interactive connection editor |===

Editing existing '802-3-ethernet' connection: 'eth1'

nmcli> print ipv4.address
ipv4.addresses: 10.10.10.4/24
nmcli> remove ipv4.address "10.10.10.4/24"
nmcli> set ipv4.address 10.10.10.5/24
Do you also want to set 'ipv4.method' to 'manual'? [yes]: yes
nmcli> verify
Verify connection: OK
nmcli> save
Connection 'eth1' (7e3a1246-1743-4bb8-9eab-09664ab996b8) successfully updated.
nmcli> quit

Verify the change in the ifcfg file:

text
# egrep IPADDR /etc/sysconfig/network-scripts/ifcfg-eth1
IPADDR=10.10.10.5

nmcli — when to use / when not

Use nmcli when Use something else when
  • NetworkManager manages your interfaces (typical on RHEL, Fedora, Ubuntu Desktop)
  • You want persistent profiles without hand-editing keyfiles or ifcfg files
  • You need scriptable IP, DNS, route, or autoconnect changes
  • You must apply changes with con up rather than restarting the whole stack
  • The host uses systemd-networkd, ifupdown, or netplan without NetworkManager → use that stack's tools
  • You only need a temporary address for one session → ip route or ip addr add
  • You prefer a menu-driven TUI → nmtui on the same host
  • You are on minimal cloud images with cloud-init owning network config → change cloud-init/netplan, not NM profiles
  • Advanced bonding/bridge walkthroughs → dedicated guides linked in References

nmcli vs nmtui

Both talk to the same NetworkManager daemon; they differ in interface and automation fit.

nmcli nmtui
Interface Non-interactive CLI Text menu (TUI)
Scripting Excellent (-t, -g, -f) Poor — manual clicks
Learning curve Must know property names Guided forms
SSH / CI Natural fit Needs a TTY
Best for Automation, docs, remote one-liners Quick manual edits on a console

Use nmtui when you want forms; use nmcli when the steps must be repeatable.


Tools in the same workflow — link, address, route, and saved profiles.

Command One line
nmcli NetworkManager CLI (this page)
ip Temporary addresses and routes without saved profiles
ss List listening sockets and connections

Browse the full index in our Linux commands reference.


nmcli — interview corner

What is nmcli in Linux?

nmcli is the command-line front end for NetworkManager. NetworkManager is the daemon that brings interfaces up, applies DHCP or static settings, and stores connection profiles on disk.

When you run nmcli dev status, you see each interface, its state, and which saved profile is active. When you run nmcli con mod, you change a profile; nmcli con up applies it to the hardware.

That separation — device (hardware) vs connection (saved settings) — is the core model interviewers expect.

A strong answer is:

"nmcli controls NetworkManager from the shell — devices are interfaces, connections are saved profiles, and con up applies profile changes to the live link."

Do I need to restart NetworkManager after nmcli changes?

Usually no. After nmcli con mod, run nmcli con up CONNECTION on that profile. That reactivates the interface with the new IP, DNS, or routes.

nmcli con reload only rereads files from disk; it does not change addresses on active connections. Restarting NetworkManager (systemctl restart NetworkManager) drops every interface and is a last resort.

A strong answer is:

"Most changes only need nmcli con up on that profile — reload rereads files but does not apply them; full service restart is for when NM itself is stuck."

How do you set a static IPv4 address with nmcli?

Set method to manual, assign address/prefix, set gateway if needed, then bring the profile up:

bash
sudo nmcli con mod eth0 ipv4.method manual ipv4.addresses 192.0.2.10/24
sudo nmcli con mod eth0 ipv4.gateway 192.0.2.1
sudo nmcli con up eth0

Verify with nmcli -g IP4.ADDRESS dev show eth0 or ip -4 addr show eth0.

A strong answer is:

"ipv4.method manual, ipv4.addresses with CIDR, optional ipv4.gateway, then con up — verify with nmcli dev show or ip addr."

What is the difference between nmcli and nmtui?

Both use NetworkManager. nmcli is for scripts and exact property names. nmtui is a fullscreen text UI for interactive edits.

Choose nmcli for Ansible, cloud-init follow-up fixes, and SSH one-liners. Choose nmtui when you are at the console and prefer menus.

A strong answer is:

"Same backend — nmcli for automation and precision, nmtui for interactive editing on a TTY."

Can nmcli configure DNS and static routes?

Yes. DNS lives on the connection profile: ipv4.dns, +ipv4.dns to append, ipv4.ignore-auto-dns yes to ignore DHCP DNS.

Static routes use +ipv4.routes with "NETWORK GATEWAY" syntax, for example:

bash
sudo nmcli con mod eth0 +ipv4.routes "10.10.0.0/16 192.0.2.1"

Apply with sudo nmcli con up eth0. IPv6 mirrors the same idea with ipv6.* properties.

A strong answer is:

"Yes — DNS and routes are connection properties; use +ipv4.routes and +ipv4.dns to append, then con up to apply."


Troubleshooting

Symptom Likely cause Fix
Error: NetworkManager is not running Service stopped sudo systemctl start NetworkManager
Profile changes not on interface Edited disk only sudo nmcli con up NAME
invalid field 'ip4.address' Wrong field name for -g Use IP4.ADDRESS or nmcli -g IP4.ADDRESS dev show IFACE
SSH drops after con up Changed address on SSH NIC Edit from console or secondary NIC; use dummy/autoconnect no tests first
Connection activation failed Cable/VLAN/DHCP issue nmcli dev show IFACE; fix link or DHCP
Device unmanaged NM ignored in config Check /etc/NetworkManager/NetworkManager.conf and unmanaged-devices

References

Rohan Timalsina

is a technical writer and Linux enthusiast who writes practical guides on Linux commands and system administration. He focuses on simplifying complex topics through clear explanations.