
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:2. Create a new Ethernet connection
In this example we’ll create a static IPv4 Ethernet connection with these parameters:type:ethernetifname:enp0s3(interface name)con-name:custom-connection(human-friendly connection name)ipv4.addresses:10.0.2.18/24ipv4.gateway:10.0.2.1ipv4.dns:8.8.8.8ipv4.method:manual
DEVICE column shows -- when not active):
3. Activate the connection
Bring the connection up: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.4. Modify an existing connection (add a second IPv4 address)
Usenmcli connection modify together with the + operator to append an IPv4 address:
5. Delete the custom connection
When you no longer need the connection, remove it:Quick reference: common nmcli commands
Links and references
- NetworkManager documentation: https://networkmanager.dev/docs/
- nmcli manual:
man nmcli - Red Hat NetworkManager guide: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/