How to Disable NetworkManager in CentOS 8

How to Disable NetworkManager in CentOS 8

If you’re out to find the easiest solution on how to disable NetworkManager in CentOS 8, this is the guide to follow. 

CentOS 8 is one of the popular Linux distributions that is forked from Red Hat Enterprise Linux. To control the configuration and management of network connections, CentOS offers their users NetworkManager, a user-friendly interface for controlling various aspects of networking.  

However, NetworkManager doesn’t always come in handy as it isn’t reliable in all network-related scenarios. Through this article, we will provide you with a detailed guide on how to disable NetworkManager in CentOS 8.

Why Disable NetworkManager in CentOS 8?

Even though NetworkManager is a powerful and convenient tool for managing network connections, disabling provides additional flexibility in accessing and managing critical network settings.

Before we proceed with the steps, let us discuss a few scenarios where disabling NetworkManager would come in handy:

  • Ability to access Advanced Network Configurations.
  • Flexibility to use custom Network Management Tools.
  • Helps with enhancing and optimizing Network Performance.
  • Smoother integration with Legacy Network Services.
  • Ideal for Virtualization or Container Environment.

Steps on How to Disable NetworkManager in CentOS 8

To start with disabling NetworkManager on CentOS 8, ensure it is booted.

Once done, open the terminal by pressing “Ctrl + Alt + T” or searching it from the search by pressing the “super” key.

Now follow the detailed walkthrough and understand and complete each step before proceeding with the next: 

Step 1:  Stopping the NetworkManager Service

Dealing with NetworkManager requires the “systemctl” command in CentOS. For beginners, the “systemctl” command is used to manage “systemd” services, which includes the NetworkManager service.

To stop the Network Manager Service using “systemctl,” enter the below command:

sudo systemctl stop NetworkManager.service
NetworkManager.service

After entering the command, there won’t be any output, and the NetworkManager is successfully stopped. However, this command doesn’t disable NetworkManager and will start again automatically on the next system reboot.

Step 2: Disabling NetworkManager Auto-Start 

To prevent NetworkManager from auto-starting, it needs to be disabled. For beginners, disabling any service prevents it from starting manually or automatically. 

To learn how to disable NetworkManager in CentOS 8 using “systemctl“, enter the below command:

sudo systemctl disable NetworkManager.service

On running the command, it displays a message indicating that the service is disabled. However, if you see any error, repeat the step.

service is disabled

Even preventing NetworkManager from auto-starting doesn’t completely disable it and, for this purpose, requires masking.

Step 3: Mask the Network Manager Service 

To prevent other services from starting NetworkManager, it needs to be masked. By masking the NetworkManager, it will be disabled. Irrespective of the service or event, it will be completely disabled and can no longer be accessed.

To mask the Network Manager Service using “systemctl,” enter the below command:

sudo systemctl mask NetworkManager.service

Upon running the command, if you find any errors, you might have made some mistakes while entering. However, if you see a message indicating that the symlink has been created, you have successfully masked NetworkManager:

NetworkManager

Once done with all three steps, reboot your CentOS 8 device to reflect the changes.

Step 4: Reboot CentOS 8 

Rebooting the CentOS 8 device results in activating the updated configurations, synchronizing the dependencies, and clearing the cache. Here is the command to reboot the CentOS 8 device:

sudo reboot

Even after the reboot, there are minimal chances that these changes won’t be applied and requires performing all the steps again.

Hence, verify whether the NetworkManager service is masked properly.

Step 5: Verify if Network Manager is completely disabled 

There are multiple ways to verify whether a service is disabled on CentOS 8. To confirm whether the Network Manager is completely disabled, use the below “systemctl” command:

systemctl is-enabled NetworkManager.service
Network Manager

If the output is displayed as “enabled”, you must redo all the above steps. However, if the output is shown as “disabled”, you have successfully disabled Network Manager in CentOS 8.

What are Alternative Network Configuration Solutions?

Considering NetworkManager is the default network management tool in CentOS 8, it is responsible for the configuration and management of network connections. Hence, disabling it would result in losing access to many network-related settings.

This issue can be tackled using alternative network configuration solutions to manage the network connections. Here are some of the reliable options:

1. Static Network Configuration

This approach involves manually editing the config files using command-line or graphical text editors.

Most network settings, such as network interfaces, IP addresses, gateway, DNS servers, etc., can be managed through the “ifcfg” files in the “/etc/sysconfig/network-scripts/” directory.

With the NetworkManager disabled, all the network settings must be manually managed by maintaining these network configurations.

2. Third-Party Network Management Tools    

CentOS 8 allows its users to install third-party network management tools. Hence, the right tools might offer additional features or different configuration methods to enhance flexibility.

Some of the best examples of third-party network management tools offered by CentOS are “ifupdown2” and “netplan.” 

Here are the commands to install ifupdown2 and netplan on CentOS 8 using the terminal:

  • ifupdown2 
git clone git://github.com/CumulusNetworks/ifupdown2
  • netplan 
sudo yum install epel-release
sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
$ sudo snap install test-snapd-netplan-apply –beta

Conclusion

In this article, we have covered step-by-step on how to disable NetworkManager in CentOS 8.

Additionally, we have suggested alternative network configuration methods to configure and manage network connections. We recommend learning about them before disabling NetworkManager. 

Also, make sure to enter the commands with root privileges and take a backup of the “ifcfg” config files before editing them to mitigate potential network-related risks.

If this guide helped you, please share it

Related Posts