Manual ip addressing – nmcli

Written by

in

Phase 1: Information Gathering

Before changing anything, you need to know your current environment.

GoalCommandWhat to look for
Find Interface Namenmcli devLook for eth0, enp0s3, etc.
Find Current Profilenmcli con showThe name in the NAME column.
Get IP/Gateway/DNSnmcli dev show <interface>IP4.ADDRESS, IP4.GATEWAY, IP4.DNS

Phase 2: The Implementation

If you want to rename the connection and set the static IP in a clean, two-step process, use these commands (replace bracketed text with your actual info):

1. Rename the connection (Optional):

sudo nmcli connection modify "Old Name" connection.id "NewName"

2. Set Static IP, Gateway, and DNS:

Bash

sudo nmcli con mod "NewName" \
ipv4.addresses 192.168.1.100/24 \
ipv4.gateway 192.168.1.1 \
ipv4.dns "8.8.8.8 1.1.1.1" \
ipv4.method manual

3. Apply the changes:

Bash

sudo nmcli con up "NewName"

Comments

Leave a Reply