Skip to content
// LINUX | July 7, 2026 | 3 min read

Configure Static IP on AlmaLinux

Stop losing your connection after a reboot by setting a static IP that never changes.

Configure Static IP on AlmaLinux
deploy@server:~
deploy@server ~ $ sudo ufw status
Status: active
 
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
deploy@server ~ $

Here is how to configure static IP on AlmaLinux. By default, your server gets its IP address from DHCP. That works, until a reboot or a network change hands it a different address, and anything that depended on the old IP (firewall rules, DNS records, SSH scripts) breaks. A static IP fixes that once and for all.

Why a static IP matters

AlmaLinux is built for the kind of workload that runs for years without much attention: databases, internal tools, anything where “boring and stable” is the goal. DHCP works against that goal. It is designed to hand out addresses that can change, which is fine for a desktop but risky for a server that other machines, scripts, and firewall rules are configured to reach at a fixed address.

A static IP takes that risk off the table. Configure it once, and the address holds through every reboot, exactly as a long-running server should behave.

What you need

  • A Hostner dedicated server running AlmaLinux
  • Root or sudo access via SSH
  • Your server’s IP address, netmask, and gateway (find these in your Hostner dashboard)

Step 1: Find your network connection

Log in via SSH, then run:

~ $ nmcli con show

AlmaLinux uses NetworkManager, so your connections show up by name here, usually something like “System ens18”. Note the exact name, in quotes, you need it in the next step.

Step 2: Configure static IP on AlmaLinux

Set the static IP with nmcli:

~ $ sudo nmcli con mod “System ens18” ipv4.addresses YOUR_IP/24 ~ $ sudo nmcli con mod “System ens18” ipv4.gateway YOUR_GATEWAY ~ $ sudo nmcli con mod “System ens18” ipv4.dns “8.8.8.8 1.1.1.1” ~ $ sudo nmcli con mod “System ens18” ipv4.method manual

Replace "System ens18" with your actual connection name from Step 1, and YOUR_IP / YOUR_GATEWAY with the values from your Hostner dashboard. The official NetworkManager documentation covers more advanced configurations if nmcli needs to do more than a single static address for you.

Step 3: Apply the configuration

Bring the connection back up with the new settings:

~ $ sudo nmcli con up “System ens18”

If this command hangs or the connection drops and does not come back, do not panic. Reconnect through your Hostner KVM/IPMI console instead of SSH, and double-check the values you entered.

Step 4: Confirm it worked

Run ip a. Your interface should now show the static IP you set, not the old DHCP one. Test the connection with:

~ $ ping google.com

If it does not work

A typo in the connection name or gateway is the most common cause of a dropped connection. If SSH stops responding after applying the config, use the console access in your Hostner dashboard to fix it directly, since a wrong static IP can lock you out over the network entirely.

If the connection comes back but routing seems off (you can ping local addresses but not the internet), check that the gateway you entered actually matches your network. Run ip route to see the current routing table and compare it against the gateway from your Hostner dashboard. A mismatched gateway is easy to miss and one of the most common reasons a static config looks correct but still does not route traffic properly.

No ticket needed. Once you configure static IP on AlmaLinux correctly, it stays that way through every reboot, every power cycle, and every network hiccup, so you can stop worrying about it and move on to the next thing.

Also available for: Ubuntu, Debian. See all guides in Docs.

H

Hanna Taoufik

The Hostner team writes about servers, Linux, security, and everything that comes with running your own infrastructure, so you can skip the support ticket.