Easy Steps To Disable NetworkManager on AlmaLinux 8
In this tutorial on the Orcacore website, we want to teach you How To Disable NetworkManager on AlmaLinux 8. The NetworkManager daemon attempts to make networking configuration and operation as painless and automatic as possible by managing the primary network connection and other network interfaces, like Ethernet, WiFi, and Mobile Broadband devices.
NetworkManager will connect any network device when a connection for that device becomes available unless that behavior is disabled. Information about networking is exported via a D-Bus interface to any interested application, providing a rich API with which to inspect and control network settings and operation.
If you plan to disable your NetworkManager service on your AlmaLinux server, follow the guide steps below.
To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with AlmaLinux 8.
Disabling NetworkManager on AlmaLinux 8
First, you need to update your local package index with the following command:
sudo dnf update -y
Then, you need to install the Epel repository on your AlmaLinux server:
sudo dnf install epel-release -y
Next, you need to install network scripts on AlmaLinux.
Install Network Scripts on AlmaLinux 8
The configuration files for network interfaces and the scripts to activate and deactivate them are located in the /etc/sysconfig/network-scripts/
directory. While the existence of interface files can differ from system to system, the three different types of files that exist in this directory, interface configuration files, interface control scripts, and network function files, work together to enable Red Hat Linux to use various network devices.
To install it on your server, run the command below:
sudo dnf install network-scripts -y
Stop NetworkManager Service
When you are done, you can use the command below to disable the NetworkManager:
sudo systemctl stop NetworkManager
You can verify your NetworkManager status by using the command below:
sudo systemctl status NetworkManager

Disable NetworkManager Control
At this point, you need to edit the /etc/sysconfig/network-scripts/ifcfg
file and add the NM_CONTROLLED=no
to the interface config file.
Open the file with your favorite text editor and change the interface name from ifconfig -a
:
sudo vi /etc/sysconfig/network-scripts/ifcfg-<mark>ens2</mark>
Add the following line to the file:
NM_CONTROLLED="no"
When you are done, save and close the file.
To apply the changes, restart the Network:
# sudo systemctl restart network
# sudo systemctl enable network
For more information, you can visit the NetworkManager Documentation page.
Conclusion
At this point, you have learned to Disable NetworkManager on AlmaLinux 8. Stopping and Disabling NetworkManager on AlmaLinux 8 will prevent conflicts with manual network configurations or other network management tools.
Hope you enjoy it. You may also like these articles:
Monitor Linux Network Bandwidth Usage with nload Command
How To Configure Networking on AlmaLinux
How To Configure Networking on Rocky Linux
FAQs
Why disable NetworkManager on AlmaLinux 8?
To avoid conflicts with manual network configurations or other network management tools like network-scripts.
What replaces NetworkManager after disabling it?
You can use network.service (legacy network-scripts) or configure networking manually with nmcli and ip commands.
Will disabling NetworkManager affect my internet connection?
Yes, unless you configure networking manually or use another network management tool.
Can I re-enable NetworkManager if needed?
Yes, you can use the following commands:systemctl unmask NetworkManager
systemctl enable --now NetworkManager
Alternative Methods to Disable NetworkManager on AlmaLinux 8
While the above method provides a way to completely disable NetworkManager and rely on traditional network scripts, there are alternative approaches that allow for more granular control or avoid a complete shutdown of the service. This can be useful in scenarios where you want to manage specific interfaces outside of NetworkManager’s control while still allowing it to handle others. Below are two alternative methods to achieve a similar outcome, focusing on managing interfaces rather than disabling the entire service.
Method 1: Unmanaging Specific Interfaces with nmcli
Instead of disabling NetworkManager entirely, you can tell it to ignore specific interfaces. This allows you to manage those interfaces manually (e.g., using ip
commands) while still benefiting from NetworkManager’s automatic configuration for other interfaces, such as WiFi. This is especially useful in server environments with static IP addresses on certain interfaces but where you still want the flexibility of NetworkManager for wireless connections.
Explanation:
The nmcli
(NetworkManager Command Line Interface) tool provides a way to control NetworkManager’s behavior. Using nmcli device set <interface> managed no
, you instruct NetworkManager to stop managing the specified interface. This means NetworkManager will no longer attempt to configure or control the interface, leaving it free for manual configuration.
Steps:
-
Identify the Interface: Determine the name of the interface you want to unmanage. You can use
ip addr
ornmcli device status
to list available interfaces. -
Unmanage the Interface: Use the following command, replacing
<interface>
with the actual interface name (e.g.,ens2
):sudo nmcli device set <interface> managed no
For example:
sudo nmcli device set ens2 managed no
-
Restart NetworkManager or the Interface: To apply the changes, you can either restart the NetworkManager service or just bring the interface down and up. Restarting the service might affect other network connections, so bringing the interface down and up is usually preferred.
sudo ip link set <interface> down sudo ip link set <interface> up
Or restart NetworkManager service:
sudo systemctl restart NetworkManager
-
Configure the Interface Manually: Now that NetworkManager is no longer managing the interface, you can configure it manually using tools like
ip addr
,ip route
, andnmcli
.For example, to assign a static IP address:
sudo ip addr add 192.168.1.10/24 dev <interface> sudo ip link set <interface> up sudo ip route add default via 192.168.1.1
Note: These changes are not persistent across reboots. You’ll need to create a systemd service or a script in
/etc/rc.local
(if enabled) to apply these settings on boot. A better and safer alternative is to create an ifcfg file to handle the configuration persistently.Create the ifcfg file:
sudo vi /etc/sysconfig/network-scripts/ifcfg-<interface>
Add the following content, adjusting the values as necessary:
TYPE=Ethernet DEVICE=<interface> ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=static IPADDR=192.168.1.10 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=8.8.8.8
Then, restart the network service:
sudo systemctl restart network
Method 2: Using NetworkManager.conf
to Exclude Interfaces
Another way to control NetworkManager is by editing its configuration file, NetworkManager.conf
. You can specify interfaces that NetworkManager should ignore using the [keyfile]
section and the unmanaged-devices
key. This method is useful when you have a predictable naming scheme for the interfaces you want to exclude.
Explanation:
By adding the unmanaged-devices
key to the [keyfile]
section of NetworkManager.conf
, you can specify a list of interface names or patterns that NetworkManager should ignore. The pattern matching is based on shell-style wildcards.
Steps:
-
Edit
NetworkManager.conf
: Open the configuration file using a text editor:sudo vi /etc/NetworkManager/NetworkManager.conf
-
Add the
unmanaged-devices
key: Locate or create the[keyfile]
section. Add theunmanaged-devices
key with the list of interfaces to exclude. You can use wildcards to match multiple interfaces.[keyfile] unmanaged-devices=mac:AA:BB:CC:DD:EE:FF;interface-name:eth*;match-device:wlan0
In this example:
mac:AA:BB:CC:DD:EE:FF
excludes an interface based on its MAC address. ReplaceAA:BB:CC:DD:EE:FF
with the actual MAC address.interface-name:eth*
excludes any interface whose name starts with "eth".match-device:wlan0
excludes thewlan0
interface.
Multiple exclusion rules can be separated by semicolons (;).
-
Restart NetworkManager: Apply the changes by restarting the NetworkManager service:
sudo systemctl restart NetworkManager
-
Configure the Unmanaged Interfaces: As with Method 1, you can now configure the unmanaged interfaces manually, either through the
ip
command or by creating configuration files in/etc/sysconfig/network-scripts/
. Remember to configure the interface persistently, ensuring your settings are applied after a reboot. The process is the same as detailed in Method 1, step 4.
These alternative methods offer more flexibility than completely disabling NetworkManager, allowing you to tailor your network configuration to your specific needs. The choice of method depends on your particular requirements and the complexity of your network setup. Consider using nmcli
for dynamic control and NetworkManager.conf
for static, persistent exclusions. Remember that Disabling NetworkManager on AlmaLinux 8 requires you to manage your network configuration manually or through other tools.