Skip to main content
In this lesson you’ll learn how to manage network connectivity using nmcli, the command-line tool for NetworkManager. This demo walks through inspecting device status, creating a new Ethernet connection, verifying IP/routing/DNS, modifying addresses, and deleting the connection.
A dark-themed presentation slide with the title "Demo" and the subtitle "Working with nmcli" on the left. A large empty dark rectangle occupies the right side of the slide.
Callouts
Run nmcli commands as root (or with sudo) because most connection operations require privileges. You can inspect system-managed connection files under /etc/NetworkManager/system-connections/.

1. Check current devices and connections

Start by listing device status to discover available interfaces:
Then list configured connections and the devices they are bound to:

2. Create a new Ethernet connection

In this example we’ll create a static IPv4 Ethernet connection with these parameters:
  • type: ethernet
  • ifname: enp0s3 (interface name)
  • con-name: custom-connection (human-friendly connection name)
  • ipv4.addresses: 10.0.2.18/24
  • ipv4.gateway: 10.0.2.1
  • ipv4.dns: 8.8.8.8
  • ipv4.method: manual
Run the add command:
Verify the connection was created (note the DEVICE column shows -- when not active):
To inspect the connection’s full properties:
(That command prints the connection’s stored properties, such as IPv4/IPv6 settings, MAC address, autoconnect, and more.)

3. Activate the connection

Bring the connection up:
Then verify the interface has the configured IP address:
Confirm the routing table shows the configured gateway:
Check DNS as configured by NetworkManager:
Do not edit /etc/resolv.conf manually when NetworkManager is managing it — changes may be overwritten. Configure DNS via nmcli or NetworkManager config files if you need persistent edits.
Test connectivity by pinging the DNS server and resolving a hostname:

4. Modify an existing connection (add a second IPv4 address)

Use nmcli connection modify together with the + operator to append an IPv4 address:
If the connection is active, reapply it to make changes take effect:
Verify both IP addresses are present:

5. Delete the custom connection

When you no longer need the connection, remove it:
Confirm removal:

Quick reference: common nmcli commands

This concludes the demo on using nmcli to create, modify, activate, verify, and delete NetworkManager connections.

Watch Video