How to Set Up IPv4 Static IP Address on AlmaLinux 9
Setting up a static IP address on AlmaLinux 9 is essential for servers or systems that require a consistent network configuration. Unlike dynamic IP addresses assigned by DHCP, a static IP ensures your system always has the same address, which is crucial for hosting services, remote access, or network management.
In this guide, we’ll walk you through the steps to configure a static IPv4 address on AlmaLinux 9 using both the command line and the Graphical User Interface (GUI).
Prerequisites
- AlmaLinux 9 installed and running.
- Root or sudo privileges.
- Knowledge of your network configuration (IP address, gateway, subnet mask, and DNS servers).
Method 1: Using the Command Line (NetworkManager)
Step 1: Identify Your Network Interface
First, identify the network interface you want to configure. Run the following command:
nmcli device status
This will display a list of network interfaces. Look for the one connected to your network (e.g., ens33
or eth0
).
Step 2: Create a New Connection Profile
To set a static IP, you’ll need to create a new connection profile. Run the following command:
sudo nmcli connection add type ethernet con-name "Static-IP" ifname ens33
Replace ens33
with your network interface name.
Step 3: Configure the Static IP Address
Now, configure the static IP address, gateway, and DNS servers. Use the following commands:
sudo nmcli connection modify "Static-IP" ipv4.addresses 192.168.1.100/24
sudo nmcli connection modify "Static-IP" ipv4.gateway 192.168.1.1
sudo nmcli connection modify "Static-IP" ipv4.dns "8.8.8.8,8.8.4.4"
sudo nmcli connection modify "Static-IP" ipv4.method manual
Replace the values with your desired IP address, subnet mask, gateway, and DNS servers.
Step 4: Activate the Connection
Activate the new connection profile:
sudo nmcli connection up "Static-IP"
Step 5: Verify the Configuration
Check if the static IP has been applied:
ip addr show ens33
You should see the static IP address assigned to your network interface.
Method 2: Using the Graphical User Interface (GUI)
Step 1: Open Network Settings
- Click on the Applications menu and search for Settings.
- Go to Network and select your network interface.
Step 2: Configure the Static IP
- Click the gear icon next to your network interface.
- Under the IPv4 tab, select Manual.
- Enter your static IP address, subnet mask, gateway, and DNS servers.
- Click Apply to save the changes.
Step 3: Restart the Network
Restart the network service to apply the changes:
sudo systemctl restart NetworkManager
Troubleshooting Tips
- If you lose connectivity, double-check your IP address, gateway, and subnet mask.
- Ensure no other device on the network is using the same IP address.
- Use
ping
to test connectivity to your gateway or external servers.
Conclusion
Setting up a static IPv4 address on AlmaLinux 9 is straightforward, whether you prefer the command line or the GUI. A static IP is ideal for servers, network devices, or systems that require consistent network access. By following this guide, you’ve successfully configured a static IP on AlmaLinux 9.
Let us know in the comments if you have any questions or run into issues!