Phase 1: Information Gathering
Before changing anything, you need to know your current environment.
| Goal | Command | What to look for |
| Find Interface Name | nmcli dev | Look for eth0, enp0s3, etc. |
| Find Current Profile | nmcli con show | The name in the NAME column. |
| Get IP/Gateway/DNS | nmcli 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"
Leave a Reply
You must be logged in to post a comment.