The cart is empty

AlmaLinux, as an open-source operating system that has become a popular alternative to CentOS, offers users various methods for configuring network settings, including IP address, gateway, and network configurations. This article assumes that you have a basic understanding of Linux and the appropriate permissions to make changes to the system.

Preparation

Before you start changing settings, it's good practice to verify the current network configuration. You can do this with the ip addr or ifconfig command (if installed). This will give you an overview of all network interfaces and their current settings.

Changing IP Address and Network Settings

In AlmaLinux, you can configure network settings both graphically through the user interface and via the command line. Here, we'll focus on the command line, which is the preferred method for servers and users who prefer quick and efficient setup.

  1. Identifying the Network Interface

    First, you need to identify the name of the network interface you want to configure. You can do this with the nmcli d command, which will list all available network interfaces.

  2. Changing the IP Address

    To change the IP address of an interface, use NetworkManager via the nmcli tool. Assuming you want to set a static IP address, the command might look like this:

    nmcli con mod <Interface_Name> ipv4.addresses <New_IP_Address>/24 ipv4.gateway <Gateway_IP_Address> ipv4.method manual
    

    Replace <Interface_Name>, <New_IP_Address>, and <Gateway_IP_Address> with your specific values. Change the /24 mask according to your network configuration.

  3. Setting DNS Servers

    You can set DNS servers by adding ipv4.dns <DNS_Servers> to the previous command. Separate multiple DNS servers with a comma.

  4. Applying Changes

    After making changes, it's necessary to restart the network interface to apply the new settings. This can be done with the commands:

 nmcli con down <Interface_Name>
nmcli con up <Interface_Name>

Alternative Method: Configuration Files

If you prefer manually editing configuration files, you can edit the file in /etc/sysconfig/network-scripts/ corresponding to your network interface (e.g., ifcfg-eth0 for the eth0 Ethernet interface). Here, you can set the IP address, gateway, DNS servers, and other parameters by adding or changing lines, such as BOOTPROTO=none, IPADDR=<New_IP_Address>, GATEWAY=<Gateway_IP_Address>, etc. After modifying the configuration file, restart the network services or the entire system to apply the changes.

 

Changing the IP address, gateway, and network settings on AlmaLinux requires a basic understanding of network concepts and the ability to work with the command line or edit configuration files. Always make sure to have a backup of the original configurations to easily restore the original state if necessary.