How To Disable NetworkManager on CentOS Stream 10
In this tutorial, we will show you how to install Disable NetworkManager on CentOS Stream 10. NetworkManager is a powerful tool for managing network connections on Linux systems, including CentOS Stream 10. However, there are scenarios where disabling NetworkManager might be necessary, such as when you need more control over your network settings or when it interferes with specific configurations. In this article, we will guide you through the process of disabling NetworkManager on CentOS Stream 10, along with troubleshooting tips and alternative methods for managing your network.
Understanding NetworkManager
NetworkManager is a dynamic network control and configuration system that automatically detects and configures network connections. It supports various types of connections, including Ethernet, wireless, mobile broadband, and VPNs. NetworkManager is particularly useful for managing multiple network interfaces and provides a user-friendly interface for configuring network settings.
However, NetworkManager can consume system resources and may not be ideal for all environments, especially those requiring precise control over network configurations. In such cases, disabling NetworkManager and using alternative methods to manage network settings can be beneficial.
Preparing Your System
Before disabling NetworkManager, ensure your system is up-to-date. This step is crucial for ensuring that all packages are current and compatible with the changes you will make.
- Update CentOS Stream 10:
sudo dnf update -y
- Check NetworkManager Status:
To verify if NetworkManager is running, use the following command:systemctl status NetworkManager
Disabling NetworkManager
Disabling NetworkManager involves stopping the service and preventing it from starting automatically on boot.
Step-by-Step Instructions
- Stop NetworkManager:
Use the following command to immediately stop the NetworkManager service:sudo systemctl stop NetworkManager
- Disable NetworkManager at Boot:
To prevent NetworkManager from starting automatically on reboot, run:sudo systemctl disable NetworkManager
- Verify NetworkManager Status:
Confirm that NetworkManager is disabled by checking its status and whether it is enabled to start at boot:systemctl status NetworkManager
systemctl is-enabled NetworkManager
Alternative Methods for Disabling NetworkManager
Besides using systemctl
, you can also disable NetworkManager using other tools.
Using nmcli
The nmcli
command allows you to manage networks directly from the terminal. To disable NetworkManager using nmcli
, run:
sudo nmcli networking off
Configuring Devices as Unmanaged
To prevent NetworkManager from managing specific devices, you can modify the device configuration files.
- Edit the Interface Configuration File:
Open the configuration file for your network interface, typically located in/etc/sysconfig/network-scripts/
. For example, foreth0
, edit/etc/sysconfig/network-scripts/ifcfg-eth0
. - Set NM_CONTROLLED to “no”:
Add or modify the lineNM_CONTROLLED=no
to prevent NetworkManager from managing this interface.
NAME="eth0"
HWADDR=...
ONBOOT=yes
BOOTPROTO=none
IPADDR=...
NETMASK=...
GATEWAY=...
TYPE=Ethernet
NM_CONTROLLED=no
Removing NetworkManager (Optional)
If you no longer need NetworkManager, you can remove it completely.
- Remove NetworkManager Package:
Use the following command to remove NetworkManager:sudo dnf remove -y NetworkManager*
Configuring Network Settings Manually
After disabling NetworkManager, you will need to configure your network settings manually. This can be done using traditional network scripts.
Using ifupdown or Network Scripts
- Install Network Scripts Package (if necessary):
In CentOS Stream 10, network scripts are not deprecated like in CentOS 8, but if you’re using a version where they are, you might need to install them:sudo dnf install -y network-scripts
- Configure Network Interface:
Edit the configuration file for your network interface (e.g.,/etc/sysconfig/network-scripts/ifcfg-eth0
) and set the IP address, netmask, gateway, and other necessary settings.NAME="eth0"
HWADDR=...
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
TYPE=Ethernet
NM_CONTROLLED=no
- Set DNS Servers:
Configure your DNS servers by editing/etc/resolv.conf
:nameserver 8.8.8.8
nameserver 8.8.4.4
- Enable and Restart Network Service:
To apply your manual network settings, enable and restart the network service:sudo systemctl enable network
sudo systemctl restart network
Benefits and Drawbacks of Disabling NetworkManager
Benefits
- Improved Performance: Disabling NetworkManager can reduce system resource usage, which might improve overall system performance.
- Increased Control: Manual network configuration provides more control over network settings, which is beneficial for specific network environments.
Drawbacks
- Loss of Automatic Configuration: Without NetworkManager, you will lose the ability to automatically detect and configure network connections.
- Potential Issues: Manual configuration can lead to errors if not done correctly, potentially causing network connectivity issues.
Troubleshooting Common Issues
If you encounter network connectivity issues after disabling NetworkManager, here are some troubleshooting steps:
- Check Network Interface Status:
Useip addr
to verify that your network interfaces are up and configured correctly. - Restart Network Service:
Try restarting the network service to apply any changes:sudo systemctl restart network
- Verify DNS Configuration:
Ensure that your DNS servers are correctly configured in/etc/resolv.conf
. - Test Internet Connectivity:
Useping
to test connectivity to external hosts:ping -c 4 8.8.8.8
Congratulations! You have successfully disabled NetworkManager. Thanks for using this tutorial for Disable NetworkManager on your CentOS Stream 10 system. For additional or useful information, we recommend you check the official CentOS website.