GICT knowledge base
Using Nmcli to Set a Static IP (Replacing DHCP) on AlmaLinux (RHEL Based) – Recommended for control panel systems
Published
If you have been managing servers for a while, you probably remember the days when control panels like cPanel and Plesk absolutely hated NetworkManager. For years, the standard practice was to disable NetworkManager entirely and rely on the old network-scripts.
Times have changed. With the release of AlmaLinux 9 and 10, NetworkManager is now the default (and often only) way to manage networking. While modern control panels have adapted, we still see edge cases where the default DHCP configuration causes stability issues.
At InterServer, we recommend switching your VPS to a static IP configuration if you are running a control panel like Plesk, cPanel, DirectAdmin, or Webuzo. It eliminates the “DHCP handshake” entirely, ensuring your server never loses its IP address due to a failed renewal.
Why Move Away from DHCP
When we provision a VPS, we often use DHCP to automatically assign your IP address. It’s great for automation, but for a production server hosting websites, it introduces a small point of failure.
- Plesk on AlmaLinux 10: We have seen reports where the combination of NetworkManager and DHCP can result in the IP address being “dropped” unexpectedly.
- cPanel History: Historically, cPanel has had conflicts with NetworkManager (often resulting in inaccessible servers after a reboot), leading them to recommend disabling it in older OS versions like AlmaLinux 8.
- Stability: A static IP is hard-coded. The server doesn’t need to ask a router “Can I keep this IP?” every few hours. It just knows it belongs to it.
DirectAdmin tends to handle DHCP fine, but for consistency and rock-solid reliability, manual assignment is the safest bet for any production environment.
How to Configure a Static IP Using nmcli
You don’t need to edit text files manually anymore. The nmcli (Network Manager Command Line Interface) tool is the cleanest way to make this change. It handles the syntax for you and ensures the configuration is saved correctly.
1. Identify Your Interface
First, log in to your server via SSH. Check your current connection name. In InterServer vps is this almost always eth0.
nmcli connection show
2. The Command
Here is the one-liner to switch from DHCP to Static. In this example, we are configuring the server to use:
- IP: 104.0.0.2/26
- Gateway: 104.0.0.1
- DNS: 66.45.251.218 and 69.10.54.252 (InterServer defaults)
Make sure to replace the IP and Gateway below with the actual details assigned to your VPS.
nmcli connection modify eth0 ipv4.addresses '104.0.0.2/26' \
ipv4.gateway '104.0.0.1' \
ipv4.dns '66.45.251.218 69.10.54.252' \
ipv4.method manual
3. Apply the Changes
Modifying the connection doesn’t apply it instantly. You need to bring the interface down and back up. We chain these commands together so you don’t lock yourself out of SSH.
nmcli connection down eth0 && nmcli connection up eth0
Verifying the Change
Once the command runs, verify that your IP is sticky and the configuration is correct.
Check the Status
Run nmcli without arguments. You should see “inet4” listing your IP, and the parameters should look like this:
eth0: connected to eth0
"Red Hat Virtio"
ethernet (virtio_net), 00:16:3E:31:54:64, hw, mtu 1500
ip4 default, ip6 default
inet4 104.0.0.2/26
route4 default via 104.0.0.1 metric 100
route4 104.0.0.0/26 metric 100
inet6 2604:a00:50:210:216:3eff:fe31:5464/64
DNS configuration:
servers: 66.45.251.218 69.10.54.252
interface: eth0
Check the Configuration File
If you are curious about what changed under the hood, you can look at the NetworkManager configuration file located in /etc/NetworkManager/system-connections/.
Before (DHCP):
[ipv4]
method=auto
After (Static):
[ipv4]
address1=104.0.0.2/26,104.0.0.1
dns=66.45.251.218;69.10.54.252;
method=manual
By making this change, you ensure that your control panel VPS remains accessible and stable, avoiding any hiccups that might come from DHCP renewal failures.
Recommendations: Make this change in VNC, or have a VNC connection open in my.interserver.net in case an error. You can also reach out to support and our staff can make this change.
Related guides
cPanel and Plesk notice: Awstats,. Webalizer and Analog stats are being removed
Important Update: cPanel and Plesk Phasing Out Legacy Statistics Tools If you regularly check your website traffic through your hosting control panel, we have an...
PleskUnderstanding the db_owner Role in Plesk Windows Hosting
If you have ever managed a database on a Windows-based hosting plan using Plesk, you might have noticed that your database user doesn’t always start with "full"...
PleskEmail Management in Plesk
In this article we are going to discuss about Email management in Plesk control panel.
PleskAdd a Website Domain to the Correct Plesk Subscription
Add a Plesk website domain with deliberate hosting and root settings, then verify DNS and certificate issuance separately from creation.
