Jump to content

How to Disable a Network on Rocky Linux 9


Linux Hint

Recommended Posts

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:

ip a

 
Or

ifconfig

 
1-4.png
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

 
2-4.png
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:

ifconfig

 
3-4.png
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:

sudo ip link set lo down

 
This command also does not display any result after executing it. So, you need to verify whether the network interface is disabled or not:

ifconfig

 
4-3.png
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

 
5-2.png
Now, you can easily disable the network interface by running the simple command:

ifdown lo

 
6-2.png

The Nmcli Command

To disable the network interface through the “nmcli” command, you just run the following command:

nmcli con down 'lo'

 
7-2.png

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:

nmtui

 
8-2.png
You can see the previous interface on running the previous command. Next, use the “Enter” key to “Activate a connection”.

9-1.png
Select the network interface to disable/deactivate and select the “deactivate” option.

Conclusion

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.

View the full article

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...