Informational Website publish

Blog

News about our company, tutorials about IT and much more you will find in this page.

Configuring a Static IPv4 Address in AlmaLinux 9

Janeiro 9th, 2025

Configuring a Static IPv4 Address in AlmaLinux

Configuring a static IPv4 address in AlmaLinux 9 can be achieved by using nmtui and nmcmcli. This guide covers each method step-by-step.


Method 1: Configuring a Static IPv4 Address Using nmtui (Text User Interface)

The nmtui tool provides a simple interface to configure network settings.

Step 1: Launch nmtui

Open a terminal and type:

sudo nmtui

Step 2: Edit a Connection

  • Select Edit a connection and press Enter.
  • Choose the connection you want to configure (e.g., Wired connection 1).
  • Press Enter.

Step 3: Static IPv4 Settings

  • Set IPv4 Configuration to Manual.
  • Enter your desired IP address, gateway, and DNS servers in the corresponding fields.
    Example values:
  • IP: 192.168.1.100
  • Gateway: 192.168.1.1
  • DNS: 8.8.8.8, 8.8.4.4

Step 4: Save and Apply

  • Save the configuration and exit nmtui.
  • Restart the connection:
  sudo nmcli connection down <connection_name> && sudo nmcli connection up <connection_name>

Verify the configuration:

ip a
ping google.com


Method 2: Configuring a Static IPv4 Address Using nmcmcli (Command Line Interface)

The nmcli tool allows for direct configuration of network settings.

Step 1: Identify the Connection Name

List all connections:

nmcli connection show

Note the connection name (e.g., Wired connection 1).

Step 2: Set Static IPv4 Configuration

Replace <connection_name>, <static_IP>, <gateway>, and <DNS> with your network details:

sudo nmcli connection modify <connection_name> ipv4.addresses <static_IP>/24
sudo nmcli connection modify <connection_name> ipv4.gateway <gateway>
sudo nmcli connection modify <connection_name> ipv4.dns "<DNS>"
sudo nmcli connection modify <connection_name> ipv4.method manual

Example:

sudo nmcli connection modify "Wired connection 1" ipv4.addresses 192.168.1.100/24
sudo nmcli connection modify "Wired connection 1" ipv4.gateway 192.168.1.1
sudo nmcli connection modify "Wired connection 1" ipv4.dns "8.8.8.8,8.8.4.4"
sudo nmcli connection modify "Wired connection 1" ipv4.method manual

Step 3: Apply the Changes

Bring the connection down and back up:

sudo nmcli connection down <connection_name>
sudo nmcli connection up <connection_name>

Step 4: Verify Configuration

Check the IP settings:

ip a

Test connectivity:

ping google.com

Conclusion

AlmaLinux 9 provides multiple ways to configure a static IPv4 address, nmtui is beginner-friendly and nmcli is powerful for scripting and command-line usage. Choose the method that fits your comfort level and use case.

If you encounter any issues or have questions, feel free to ask for help using our method of contact.

If you are interested in https://blog.evoluso.com/how-to-set-up-a-static-ipv4-address-in-ubuntu-24/