Learn how to change the IP address in AlmaLinux. Our Server Management Support team is here to help you with your questions and concerns.
Changing the IP address in AlmaLinux is a common administrative task when configuring servers, migrating systems, or adjusting network settings. Modern AlmaLinux systems rely on NetworkManager for network management, which allows administrators to change IP addresses using tools like nmcli, nmtui, or configuration files.
Today, we will walk through several methods to change the IP address in AlmaLinux, including command-line tools and configuration file edits.
- How to Check the Current IP Address
- Method 1. Change IP Address Using nmcli
- Method 2. Change IP Address Using nmtui
- Method 3. Change IP Address via Network Configuration File
- Temporarily Change IP Address
- Common Reasons to Change IP Address in AlmaLinux
- Troubleshooting After Changing IP Address
- Best Practices for Managing IP Addresses
- FAQs
How to Check the Current IP Address
Before modifying the network configuration, verify the current IP address assigned to the server.
Run the following command:
ip addr or
ip a This command displays all network interfaces and their assigned IP addresses.
Another way to check the network configuration is with:
nmcli device show This shows detailed network information, including the IP address, gateway, and DNS configuration.
Method 1. Change IP Address Using nmcli
Modern AlmaLinux installations use NetworkManager, making nmcli the recommended method to manage networking.
Step 1. List Available Network Connections
Run the following command:
nmcli con show This lists all available network connections and their interface names.
Example output:
NAME UUID TYPE DEVICE
ens160 6f1cbb8c-8d7f-4d7a-9e3b-b0b5d8c7a7e0 ethernet ens160
Step 2. Modify the IP Address
Set a new static IP address using:
nmcli con mod ens160 ipv4.addresses 192.168.1.212/24 Set the gateway:
nmcli con mod ens160 ipv4.gateway 192.168.1.1 Configure the connection to use a manual IP:
nmcli con mod ens160 ipv4.method manual Step 3. Apply the Changes
Activate the updated connection:
nmcli con up ens160 Step 4. Verify the New IP Address
Confirm the change by running:
ip addr or
nmcli device show Method 2. Change IP Address Using nmtui
AlmaLinux also provides nmtui, an interactive text interface for managing NetworkManager.
- First, launch the tool nmtui.
- Then, select “Edit a connection”.
- Choose the network interface (for example ens160).
- Next, change IPv4 configuration to Manual and enter the new IP Address, Netmask, Gateway, and DNS server.
- Save the changes and activate the connection.
Method 3. Change IP Address via Network Configuration File
Some administrators prefer modifying configuration files directly.
Network interface configuration files are typically located at:
/etc/sysconfig/network-scripts/ Example:
/etc/sysconfig/network-scripts/ifcfg-ens160 Edit the file using a text editor:
vi /etc/sysconfig/network-scripts/ifcfg-ens160 Modify the following lines:
BOOTPROTO=none
IPADDR=192.168.1.212
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
Save the file and exit the editor.
Then, restart NetworkManager:
systemctl restart NetworkManager Finally, verify the updated configuration.
Note: Some AlmaLinux 9 installations may not include network-scripts by default since it is deprecated.
Temporarily Change IP Address
If you only need a temporary IP change for testing, you can use the ip command.
Add a temporary IP:
ip addr add 192.168.1.212/24 dev ens160 Remove the old IP address:
ip addr del 192.168.1.100/24 dev ens160 This change will be lost after a reboot.
Common Reasons to Change IP Address in AlmaLinux
System administrators may need to update IP configurations for several reasons:
- Server migration to a new network
- Switching from DHCP to a static IP
- Infrastructure reconfiguration
- Updating gateway or DNS settings
- Resolving network conflicts
Proper IP configuration ensures stable communication between servers, services, and external networks.
Troubleshooting After Changing IP Address
If the new IP address does not apply correctly, try the following checks.
- Verify NetworkManager status
systemctl status NetworkManager - Restart NetworkManager
systemctl restart NetworkManager - Check network interface status
nmcli device status - Test connectivity
ping 8.8.8.8
If connectivity fails, verify the gateway and DNS settings.
Best Practices for Managing IP Addresses
When configuring IP addresses on Linux servers, follow these best practices:
- Always document IP changes before applying them
- Use nmcli or NetworkManager instead of deprecated scripts
- Verify the configuration before restarting services
- Maintain consistent network interface naming
- Ensure correct gateway and DNS settings
These practices help prevent connectivity issues and downtime.
FAQs
How do I change the IP address in AlmaLinux?
You can change the IP address using nmcli, nmtui, or network configuration files. The recommended method is using nmcli because AlmaLinux uses NetworkManager to manage networking.
How do I check my IP address in AlmaLinux?
Run:
ip addr or
nmcli device showto view the current IP address assigned to network interfaces.
Does AlmaLinux use NetworkManager?
Yes. AlmaLinux 8 and AlmaLinux 9 use NetworkManager by default to manage network connections and configurations.
Can I change the IP address without restarting the server?
Yes. You can apply IP changes using nmcli or the ip command without rebooting the server.
Conclusion
Changing the IP address in AlmaLinux can be done using several methods, including nmcli, nmtui, and editing configuration files. Since AlmaLinux relies on NetworkManager, using nmcli is the recommended approach for most server environments.
After applying changes, always verify the network configuration to ensure the server maintains connectivity.
If you need help managing or troubleshooting AlmaLinux networking issues, our Server Management Support team is available 24/7 to assist.