Quiz Entry - updated: 2026.07.14
How do you create a new static IP connection with nmcli?
Use nmcli con add with ipv4.method manual plus the address, gateway, and DNS — that one command both creates and persists a static-IP profile.
con add creates a brand-new connection profile (vs con mod, which edits an existing one). For a static address the decisive parameter is ipv4.method manual — without it the profile would default to DHCP and ignore your address. Everything is saved to disk, so it survives reboots.
nmcli con add con-name "static-ens3" \
type ethernet \
ifname ens3 \
ipv4.addresses 192.168.0.5/24 \
ipv4.gateway 192.168.0.1 \
ipv4.dns 8.8.8.8 \
ipv4.method manual \
connection.autoconnect yes
Breakdown:
| Parameter | Purpose |
|---|---|
con-name |
Name for this connection profile |
type |
Connection type (ethernet, wifi, etc.) |
ifname |
Network interface to bind to |
ipv4.addresses |
IP address with CIDR prefix |
ipv4.gateway |
Default gateway |
ipv4.dns |
DNS server |
ipv4.method |
manual (static) or auto (DHCP) |
connection.autoconnect |
Connect automatically at boot |
Activate:
nmcli con up "static-ens3"