How to restart network in Almalinux and RHEL 8/9?

Helposoft Staff

Administrator
Staff member
Points
178
In AlmaLinux 8/9 and RHEL 8/9, network management is typically handled by NetworkManager, a service that manages network interfaces. Here’s how to restart the network and NetworkManager service on these systems:

Restarting NetworkManager

  1. Restart the NetworkManager Service:
    You can restart NetworkManager to apply changes to network configurations:

    Code:
    sudo systemctl restart NetworkManager

  2. Verify the Status:
    To ensure NetworkManager is running correctly:

    Code:
    sudo systemctl status NetworkManager

Reload Network Configuration

If you have made changes to network configuration files and want to reload these changes without restarting the entire service, you can use nmcli:
  1. Reload Network Configuration:

    Code:
    sudo nmcli connection reload

    This command reloads the network connections but does not restart the NetworkManager service itself.
  2. Restart Individual Connections:
    To restart a specific network connection (e.g., eth0):

    Code:
    sudo nmcli connection down eth0
    sudo nmcli connection up eth0

Manage Network Interfaces Directly

For specific cases where you might need to bring network interfaces up or down directly, you can use ip commands or ifup/ifdown commands.
  1. Bring Interface Down:

    Code:
    sudo ip link set dev eth0 down

  2. Bring Interface Up:

    Code:
    sudo ip link set dev eth0 up

    Replace eth0 with the actual name of your network interface.

Apply Configuration Changes

If you modify configuration files directly (e.g., in /etc/sysconfig/network-scripts/), restarting the NetworkManager service or reloading connections will apply these changes.

Example: Applying Network Configuration Changes

Suppose you have edited the configuration file for a network interface located at /etc/sysconfig/network-scripts/ifcfg-eth0. To apply these changes:
  1. Restart NetworkManager:

    Code:
    sudo systemctl restart NetworkManager

  2. Verify Configuration:
    Check the status of your network interfaces to ensure changes are applied:

    Code:
    ip a
By following these steps, you should be able to effectively manage and restart network configurations on AlmaLinux 8/9 and RHEL 8/9.
 
Top