Skip to Content

Restarting a Network Interface in RHEL 9

Table of Contents

NetworkManager Tools

NetworkManager is a system service in Linux distributions that manages network devices and connections. Here are some tools you can use to control NetworkManager and refresh the network interface configuration:

  • nmcli: This is a command-line tool for interacting with NetworkManager. You can use it to control connections, devices, and other networking aspects. To restart a connection, use the nmcli connection down <connection_name> command to take the connection down, and then the nmcli connection up <connection_name> command to bring it back up. This method temporarily interrupts all active connections using the network interface during the restart.
  • GNOME control-center: If you are using the GNOME desktop environment, you can use the graphical control center to manage network connections. You can disconnect and reconnect to a network through the control center to refresh the configuration. Keep in mind that this method also temporarily interrupts active connections.
  • nmstatectl: This utility provides a declarative way to configure NetworkManager. It focuses on defining the desired state of the network and lets NetworkManager handle the transition. You can use nmstatectl apply <configuration_file> to apply a new configuration file. Importantly, nmstatectl ensures that the resulting state matches the configuration file and automatically rolls back changes if any errors occur. This feature prevents leaving the system in an inconsistent state.

Using Ansible

For automated and remote configuration, you can leverage Ansible and the network RHEL system role.

  • Ansible is a powerful automation tool that allows you to manage and configure systems remotely. The network RHEL system role is specifically designed to work with NetworkManager and enables you to define connection profiles in a declarative manner using YAML files.
  • This method is particularly useful when managing multiple systems, as you can define the desired configuration in a playbook and apply it to a group of hosts. However, note that the network RHEL system role cannot update individual settings within an existing connection profile. Instead, it enforces the configuration defined in the playbook and resets any other settings to their default values.

By understanding these various methods, you can choose the approach that best suits your needs and effectively refresh the network interface configuration in RHEL 9.