CentOS 8 usually comes with a pre-installed Network Manager that helps you configure available connections and keep them awake. It provides tools based on both built-in commands and graphical user interface to seamlessly configure and manage networks. The API manages the network configuration via D-Bus and makes requests. Some of the important features of Network Manager in CentOS 8 include:
- Network Manager, which is automatically activated at boot, is required on CentOS 8.
- Network Manager includes command-based tools like nmcli and NMTUI and GUI-based tools like NMConnection Editor, Network Connection Icon, and Control Center.
- In addition to the traditional ifcfg files, the base install also provides the latest ifup and ifdown scripts based on the nmcli tools.
Before learning how to check the status of a network interface in CentOS 8, you need to make sure that:
Your server is configured with root password. The Network Manager package is installed and running on the server. The following commands can be used to check the active and enabled state of Network Manager and to print the progress.
# systemctl is-active NetworkManager # systemctl is-enabled NetworkManager # systemctl status NetworkManager
The nmcli command to check is given below.
nmcli -t -f RUNNING general
Another command that does the same is nmcli general, which alone shows the general properties along with the state of the Network Manager.
How to check the status of a network interface in CentOS8
There are several different ways to check if a server is online or not. The most common methods are listed below.
The iproute2 package offers utilities for traffic management and regulates the TCP / IP network. The following command will show if a specific interface is enabled. For example, if the server has an ethernet port eth0, entering the following command will show their status.
ip link show dev eth0
The ip command allows for much more complex network settings, which makes it preferable. But sometimes it is not included, especially in older versions. In such a case, it would be helpful to use the ifconfig command. The above command is used to check if the Ethernet link is available, i.e. if the port is disabled. A link was found and a LOWER_UP was found on the first line.
ip link is dev eth0
However, there is likely to be a software problem and communication does not work even though the port is connected. In this case, the following commands are used. They will look for port status and network operation status. The first line of output will show DOWN if the cable is disconnected.
ip link is dev eth0 ifconfig eth0
Of all the ways to check the status of a network interface, the easiest is to use nmcli. Entering the following code will display a list of all available devices.
nmcli dev status
To specifically check the active status of a connection, the following command is used.
nmcli con show
So this was a short introduction and process for checking the status of a network interface in CentOS8. CentOS is a great operating system, but nowadays a lot of people are migrating from CentOS to other operating systems. If you would like to do this too, please visit our official website to find out how to switch from one operating system to another.