keepcalculator

06 Numbers and Powers

Disable NetworkManager in CentOS Safely

Card No. 06·37104 · Updated · Standard formula, shown below

To disable NetworkManager in CentOS, stop its service now and disable it at startup with sudo systemctl stop NetworkManager and sudo systemctl disable NetworkManager. Do this only after confirming another network configuration method is ready: stopping the service can immediately disconnect SSH and interrupt network access.

What NetworkManager Does

NetworkManager manages network connections, including wired and wireless interfaces, addresses, routes, DNS settings, and connection profiles. On many CentOS installations it is the standard networking service, and disabling it does not automatically provide a replacement. An interface may lose connectivity or fail to come up after a reboot if no other service or configuration is set to manage it.

CentOS versions differ significantly. CentOS 7 and newer use systemd and support the commands below. CentOS Linux 8 reached end of life in 2021, and CentOS Linux 7 reached end of life in 2024; CentOS Stream has a different release model. Older CentOS releases may use legacy service-management tools. Check your version before following instructions: cat /etc/centos-release.

Check the Current Network Setup

Before changing services, identify the active interface and how its connection is managed. Run:

  • systemctl status NetworkManager to see whether NetworkManager is active and enabled.
  • nmcli device status to list interfaces and their connection state, if the nmcli tool is installed.
  • ip address and ip route to inspect assigned addresses and the routing table.
  • systemctl status network to check whether the legacy network service exists and is running.

These checks show current state, but they do not prove a replacement will work after NetworkManager stops. If connected over SSH, arrange console access or another recovery path first. A remote service change can lock you out even when the commands themselves succeed.

Stop and Disable the Service

On a systemd-based CentOS release, stopping and disabling are separate actions. Stop the service for the current boot, then disable its automatic startup:

  1. Open a local terminal or a session with a reliable recovery option.
  2. Run sudo systemctl stop NetworkManager. This requests that NetworkManager stop now.
  3. Run sudo systemctl disable NetworkManager. This removes the service’s ordinary automatic startup links.
  4. Check the result with systemctl is-active NetworkManager and systemctl is-enabled NetworkManager.
  5. Verify that the interface, address, route, DNS resolution, and needed network services still work.

Disabling alone does not stop a service that is already running; stopping alone does not prevent it starting at a later boot. That is why both commands are included. These commands may require administrator privileges, provided with sudo here.

Choose a Replacement Beforehand

Some systems use the older network service and interface configuration files, while others use another network manager or a custom setup. Do not assume that installing or enabling the legacy service is necessary or appropriate: availability and behavior depend on the CentOS release and installed packages.

On a system that is deliberately configured for the legacy service, its configuration commonly resides under /etc/sysconfig/network-scripts/, with interface-specific files such as ifcfg-ens192. Names and supported settings vary. Review the actual files and documentation for the installed release rather than copying a generic example; an incorrect interface name, address, gateway, or DNS entry can prevent connectivity.

In particular, check how the network interface is brought up at boot and whether the configuration provides all required settings. A static address needs appropriate address and routing information; a DHCP connection needs a client or service that requests a lease. DNS configuration also needs to remain available. If the host is managed by a cloud platform, virtualization system, or provisioning tool, its expected network configuration may depend on NetworkManager.

Disable, Mask, or Uninstall?

Disabling is usually the reversible choice when the goal is to prevent normal automatic startup. It leaves the package installed and lets an administrator start the service manually. To restore ordinary operation, use sudo systemctl enable --now NetworkManager; this enables startup and starts the service immediately.

Masking is stronger: sudo systemctl mask NetworkManager links the service to a target that prevents it from being started through systemd, including as a dependency. Use it only when that stronger restriction is intended. Reverse it with sudo systemctl unmask NetworkManager. A mask is not a substitute for a working network configuration.

Uninstalling the package is a more disruptive change and may remove dependencies or tools other software expects. It is generally unnecessary merely to stop the service. Avoid removing it unless you understand the package consequences for that specific system.

Common Problems and Recovery

If the network disappears immediately after stopping NetworkManager, the replacement configuration may not be active, or the interface may have been managed exclusively by NetworkManager. If local access is available, restore service with sudo systemctl enable --now NetworkManager, then inspect logs using journalctl -u NetworkManager.

If the service is disabled but returns after reboot, check whether another administrator, package, or management tool re-enabled it. Also distinguish “disabled” from “masked”: systemd dependencies or manual commands can start a disabled service, while masking blocks normal systemd starts.

If the service is inactive but the host still has an address, that does not necessarily mean the setup is durable. The address may remain temporarily, while DNS, DHCP renewal, routes, or reconnection after a link interruption fail later. Test the system after a controlled reboot only when recovery access is available.

Frequently Asked Questions

Does disabling NetworkManager turn off the internet?
It can. If no other service or configuration manages the interface, connectivity may stop immediately or fail after reboot. Prepare and test a replacement first.

What is the command to disable NetworkManager at boot?
On a systemd-based CentOS system, run sudo systemctl disable NetworkManager. To stop it in the current session too, run sudo systemctl stop NetworkManager.

How can I check whether NetworkManager is disabled?
Use systemctl is-enabled NetworkManager to check its startup setting and systemctl is-active NetworkManager to check whether it is currently running.

Can I use the network service instead?
Only if the service and its configuration are available and appropriate for your CentOS release. Confirm that it can configure the interface, routes, and DNS before stopping NetworkManager.

How do I enable NetworkManager again?
Run sudo systemctl enable --now NetworkManager. If the service was masked, first run sudo systemctl unmask NetworkManager.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →