Setting up a static IP address is essential for servers that require consistent network connectivity, such as web servers, databases, or internal applications. In AlmaLinux 9, systemd-networkd provides a modern and efficient way to manage network configurations.
In this guide, we’ll walk you through configuring a static IP address using networkctl and systemd-networkd on AlmaLinux 9.
What You'll Learn
Why Use systemd-networkd for Static IP Configuration?
Step by Step Guide to Setting a Static IP on AlmaLinux 9
Additional Useful Commands
Why Use systemd-networkd for Static IP Configuration?
systemd-networkd is a lightweight, built-in network management service that offers several advantages
-
Faster boot times- Minimal overhead compared to traditional network managers.
-
Simplified configuration- Uses clean, structured configuration files.
-
Better systemd integration- Works seamlessly with other systemd services.
-
Reliable for servers- Ideal for headless and production environments.
If you're managing a server, systemd-networkd ensures stability and control over your network settings.
Step-by-Step Guide to Setting a Static IP on AlmaLinux 9
Step 1: Check systemd-networkd Status
Before configuring a static IP, ensure systemd-networkd and systemd-resolved are running
systemctl status systemd-networkd
systemctl status systemd-resolved
If they’re inactive, start and enable them
sudo systemctl start systemd-networkd
sudo systemctl start systemd-resolved
sudo systemctl enable systemd-networkd
sudo systemctl enable systemd-resolved
Step 2: Identify Your Network Interface
Find your active network interface name using
ip link
Look for interfaces like eth0, enp0s3, or similar.
Step 3: Create a Static IP Configuration File
Navigate to the network configuration directory
cd /etc/systemd/network/
Create a new .network file (replace enp0s3 with your interface name)
sudo nano 20-static-ip.network
Add the following configuration (adjust IP, gateway, and DNS as needed)
[Match]
Name=enp0s3
[Network]
Address=192.168.1.100/24
Gateway=192.168.1.1
DNS=8.8.8.8
DNS=8.8.8.4
📌 Key Notes
-
Address=192.168.1.100/24→ Replace with your desired static IP and subnet. -
Gateway=192.168.1.1→ Use your router’s gateway IP. -
DNS→ You can use Cloudflare (1.1.1.1) or your preferred DNS servers.
Save and exit (Ctrl+O, Enter, Ctrl+X).
Step 4: Apply the Network Configuration
Restart systemd-networkd to apply changes
sudo systemctl restart systemd-networkd
Step 5: Verify the Static IP Configuration
Check if the static IP is assigned correctly
networkctl status enp0s3
Or use
ip a
Step 6: Test Network Connectivity
Ensure your server can reach the internet
ping google.com
If DNS resolution fails, restart systemd-resolved
sudo systemctl restart systemd-resolved
Additional Useful Commands
Bring an interface up/down
sudo networkctl up enp0s3
sudo networkctl down enp0s3
Check routing table
ip route
Flush DNS cache (if needed)
Navigate to the network configuration directory
sudo resolvectl flush-caches
Conclusion
Configuring a static IP on AlmaLinux 9 using networkctl is a clean and efficient method, especially for server environments. By leveraging systemd-networkd, you ensure faster boot times and better system integration.
At BytesRack, we specialize in Linux server management, optimizations, and 24/7 support. If you need expert assistance with server configurations, security, or performance tuning, contact us today!
Discover BytesRack Dedicated Server Locations
BytesRack servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.

Media Stream Solutions
Gaming Solutions
E-Commerce Solutions
VPN Server Solutions
GPU Server Solutions
Financial Solutions
Security Solutions