In Rocky Linux, the network interface allows the system to connect with the network and communicate with no breach. A network interface works as the bridge between the physical network hardware and the network protocol. Therefore, the network interface plays an important role in any operating system. The network interface also enables communication between Linux and other systems on the same network.
Although you can disable the network interface for security, resource management, and troubleshooting, it can create some issues in the system. However, many Rocky Linux beginners must learn to disable a network interface. That’s why we have written this tutorial to explain the complete information on disabling the network interface on Rocky Linux 9.
How to Disable a Network Interface on Rocky Linux 9
First, let’s check the current status of the network interface in the system through any of the following commands:
You can see from the previous output that the “enp0s3” and “lo” network interfaces are enabled in our system. You can disable these interfaces through several CLI methods. Let us discuss some of these methods to disable the network interfaces on Rocky Linux 9.
The Ifconfig Command
To disable a network interface through the ifconfig command, install the “net-tools” package:
sudo dnf install net-tools
Here, we use the following ifconfig command to disable the “enp0s3” network:
sudo ifconfig enp0s3 down
When you run the previous command, it will not display any output. So, use the following command to check if the network interface is disabled:
You can see that the “enp0s3” interface is not showing here which means that it is disabled.
The Ip Command
It is the simplest method to disable the network interface because all you need to do is run the following command:
This command also does not display any result after executing it. So, you need to verify whether the network interface is disabled or not:
You might notice from the given result that the “lo” interface is successfully disabled.
The Ifdown Command
First, install the ifdown package using the following command:
sudo dnf install NetworkManager-initscripts-updown
Now, you can easily disable the network interface by running the simple command:
The Nmcli Command
To disable the network interface through the “nmcli” command, you just run the following command:
The Nmtui Command
The “nmtui” is a command-line graphical tool under Linux. With this command, you can configure the network settings and enable/disable these networks.
To disable the network through the nmtui command, open the graphical interface using the following command:
You can see the previous interface on running the previous command. Next, use the “Enter” key to “Activate a connection”.
Select the network interface to disable/deactivate and select the “deactivate” option.
Disabling the network interface on Rocky Linux 9 is a fairly simple process, and we explained all of them. We don’t recommend disabling the network interface without knowledge as it can seriously impact your system. Moreover, if your system relies on connectivity and you try to disable the network interface, your system may lose the network connection immediately. Hence, perform the network interface disable process carefully.