1. Why You Need a Static IP
A static IP makes your server reachable at a predictable address, critical for services like Asterisk, SSH, and web apps. DHCP‑assigned addresses can change, breaking SIP registrations and firewall rules.
2. Prerequisites
A server or VM running a NetworkManager‑enabled distro.
sudo privileges or root access.
The nmtui utility (ships with NetworkManager‑text‑ui). Install if missing:
sudo apt install network-manager network-manager-gnome #Debian/Ubuntu
sudo dnf install NetworkManager-tui #RHEL/Fedora/Rocky3. Step‑by‑Step Guide
3.1 Launch nmtui
sudo nmtui3.2 Select Edit a connection
Use ↑/↓ keys to highlight Edit a connection and press Enter.
3.3 Choose the Network Interface
Highlight your active interface (eth0, ens18, enp1s0, etc.) → Enter.
3.4 Switch IPv4 Method to Manual
Move to IPv4 CONFIGURATION.
Press Enter, choose Manual.
3.5 Enter IP, Gateway & DNS
Fill the fields:
Field | Example |
|---|---|
Address |
|
Gateway |
|
DNS servers |
|
3.6 Save & Quit
Hit OK → Back → Quit.
3.7 Activate the Connection
sudo nmcli connection up <interface-name>Replace <interface-name> with the one you edited (e.g., ens18).
4. Verify the Static IP
ip a | grep -A2 <interface-name>You should see your new IP (192.168.1.50). Test connectivity:
ping -c 4 8.8.8.85. Apply Changes Without Reboot
If you skipped step 3.7:
sudo systemctl restart NetworkManagerOr simply disconnect/reconnect the NIC:
nmcli device disconnect <interface-name>
nmcli device connect <interface-name>6. Common Errors & Fixes
Error | Cause | Fix |
DNS not resolving | Wrong DNS servers | Edit connection → enter correct DNS (1.1.1.1) |
No network after reboot | Wrong subnet mask | Ensure |
Connection activation failed | IP conflict | Pick unused IP, check DHCP pool |
7. Conclusion & Next Steps
You now have a persistent static IP configured via the user‑friendly nmtui tool. This is an essential foundation before installing services like Asterisk or FreePBX.
8. TL;DR for Power Users
sudo nmtui
# Edit connection → <interface> → IPv4 CONFIG → Manual
# Address: 192.168.1.50/24
# Gateway: 192.168.1.1
# DNS: 1.1.1.1,8.8.8.8
sudo nmcli connection up <interface>Continue the series:
👉 How to Check Your IP Address in Linux – 5 Ways (coming soon)
