Are you trying to disable a network on Rocky Linux 9?
If you’re here, I assume you have tried understanding the network interface of Rocky Linux 9 and was left unsure about managing its network interfaces.
In this post, I will walk you through the confusing network interface and demonstrate different approaches to disabling a network on Rocky Linux 9, step-by-step.
Let’s jump in!
What You’ll Need
As we are about to deal with multiple approaches to disabling a network on Rocky Linux 9, ensure you have the below prerequisites:
- Ensure you have administrative privileges, mandatory to manage network interfaces (guide)
- Be familiar with accessing and using the terminal on Rocky Linux (guide)
- Ensure you have a stable internet connection
How to Disable a Network on Rocky Linux 9: 5 Ways
There are multiple ways to disable a network on Rocky Linux, and I have listed them below with detailed steps for each.
Method 1: Disabling Network using ifconfig Command
Ifconfig stands for “Interface Configurator,” and as the name suggests, it can configure interfaces, including initializing an interface, assigning the IP address, and turning an interface on or off.
Here are the steps below to disable a network using ifconfig:
- Open the terminal on Rocky Linux 9 using the below command to check the current status of the network interface:
ifconfig

- Usually, the output is generated, but if you see an output like in the above screenshot, the “net-tools” package isn’t installed on your PC. To install it, enter the below command:
sudo dnf install net-tools

- After the installation, enter the below command to disable the “enp0s3” network:
sudo ifconfig enp0s3 down
- While the command disables the network, it doesn’t display any output. To check if the network is disabled, enter the below command, and you will notice the “enp0s3” interface isn’t displayed as it is disabled:
ifconfig

Method 2: Disabling Network using Ip Command
IP stands for “Internet Protocol ” and performs several network administration tasks on Linux. Here are the steps below to disable a network using ip:
- Open the terminal on Rocky Linux 9 and disable any network interface of your choice using the below command. For demonstration, we have disabled the “lo” network interface:
sudo ip link set lo down
- Like the “ifconfig” command to block a network interface, the “ip” command doesn’t generate an output. To check if the network you have selected is disabled, enter the below command, and you will notice the “lo” interface isn’t displayed as it is disabled (as shown in the screenshot below):
ifconfig

Method 3: Disabling the Network using Ifdown Command
The ifdown
command disables a network interface by restricting it to transmit or receive data. Here are the steps below to disable a network using ifdown:
- For the functioning of the ifdown command, the “NetworkManager-initscripts-updown” package must be installed. If you already have it installed, skip this step or use the below command to install it:
sudo dnf install NetworkManager-initscripts-updown

- After installing it, choose any network interface you want to block using the below command. For demonstration, we have selected
eth0
:
ifdown eth0

As the command generates an output stating that the selected network interface is deactivated, it isn’t necessary to verify on “ifconfig.”
Method 4: Disabling Network using Nmcli Command
The Nmcli
command controls the network manager and offers the user the ability to view network device status, create, edit, activate/deactivate, and delete network connections.
Here are the steps below to disable a network using nmcli:
- As we have installed the “Network Manager” package before, you can use nmcli seamlessly. To block a network using nmcli, choose a network interface and enter the command below, replacing the ‘lo’ network with yours:
nmcli con down 'lo'

As the command generates an output stating that the selected network interface is deactivated, it isn’t necessary to verify on “ifconfig.”
Method 5: Disabling Network using Nmtui Command
While in the above approaches, the entire process is done on the terminal using multiple commands, this can be difficult for you if you’re not comfortable using the terminal.
For this purpose, I have included the Nmtui approach, which makes it easier.
The nmtui
is a graphical command-line utility tool part of the NetworkManager-tui package. It allows you to configure your network interfaces in Linux distributions easily.
Here are the steps below to disable a network using nmtui
:
- As we have installed the “Network Manager” package before, you can use
nmtui
seamlessly. On the terminal, enter the below command to open nmtui:
nmtui
- After nmtui is loaded, navigate to Activate a connection with arrow keys and hit enter:

- After you have activated a connection, you can find the deactivate option next to it. For demonstration, we have selected the enp0s3 network interface; refer to the screenshot below to disable the network of your choice:

- On clicking Deactivate you will find a message that the network will be clocked; hit the OK option with the enter button.
Also read: How to Disable NetworkManager in CentOS 8
Conclusion
Congratulations on learning how to block a network on Rocky Linux 9!
While I’ve gone through multiple methods on this, you may encounter problems, in which case try to use a different method if you can’t seem to fix the issues you’re having.
Make sure to be careful while blocking the network interface, as you can accidentally block an important network and prevent traffic from passing in and out of your device.
If you’re stuck with any step or having issues with the above approaches, you may also reach out to the Rocky Linux Forum for more assistance.