Understanding the Relationship and Conflicts Between NetworkManager and network.service in RHEL-based Systems


12 views

In traditional RHEL/CentOS/Fedora systems, the network.service (managed via /etc/sysconfig/network-scripts/) was the primary network configuration method. With the evolution of Linux networking, NetworkManager emerged as the dynamic alternative, especially crucial for laptops and mobile devices.

The two services can technically run simultaneously, but this creates potential conflicts:

# Check running status
systemctl status NetworkManager
systemctl status network

NetworkManager has backwards compatibility through its ifcfg-rh plugin, which reads traditional network scripts. However, manual edits to ifcfg files while NetworkManager is running may cause undefined behavior.

Common symptoms when both services attempt to manage interfaces:

  • Interface flaps (up/down transitions)
  • IP address conflicts
  • Routing table inconsistencies

For modern systems (RHEL 8+), the clear recommendation is:

# Disable legacy network service
sudo systemctl disable --now network.service

# Ensure NetworkManager is running
sudo systemctl enable --now NetworkManager

For legacy applications requiring network.service:

# Create explicit configuration drop-in
echo "NM_CONTROLLED=no" | sudo tee -a /etc/sysconfig/network-scripts/ifcfg-eth0

# Then restart both services
sudo systemctl restart NetworkManager
sudo systemctl restart network

Converting traditional ifcfg to NetworkManager's native format:

# Original ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0

# Convert to NetworkManager connection
nmcli connection add con-name eth0-static \
   type ethernet ifname eth0 \
   ipv4.method manual \
   ipv4.addresses 192.168.1.100/24

Diagnostic toolkit for network management conflicts:

# View NetworkManager connections
nmcli connection show

# Check device states
nmcli device status

# See which service manages an interface
nmcli device show eth0 | grep GENERAL.DRIVER

# Compare with legacy scripts
cat /etc/sysconfig/network-scripts/ifcfg-eth0

When working with RHEL, CentOS, or Fedora systems, network configuration can be managed through two primary methods: the traditional network service and the more modern NetworkManager. Understanding their relationship is crucial for system administrators and developers who need reliable network setups.

NetworkManager is a dynamic network control system designed for desktop and mobile environments, providing automatic network detection and configuration. It's particularly useful for systems with changing network conditions (e.g., laptops).

Network service (managed via /etc/sysconfig/network-scripts/) is the traditional, static approach to network configuration, typically preferred for servers with fixed network settings.

While both can technically run simultaneously, this often leads to conflicts. Here's what typically happens:

# Checking service status
systemctl status NetworkManager
systemctl status network

Common conflict scenarios include:

  • Both services attempting to manage the same interface
  • DNS settings being overwritten by one service
  • Route tables being modified unexpectedly

For most modern systems, NetworkManager is recommended. To disable the traditional network service:

# Disable and stop network service
sudo systemctl stop network
sudo systemctl disable network

# Enable NetworkManager
sudo systemctl enable NetworkManager
sudo systemctl start NetworkManager

For server environments where you prefer the traditional approach:

# Disable NetworkManager
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager

# Enable network service
sudo systemctl enable network
sudo systemctl start network

In rare cases where both are needed, configure them to manage different interfaces:

# In /etc/NetworkManager/NetworkManager.conf
[keyfile]
unmanaged-devices=interface-name:eth1

# Then configure eth1 in /etc/sysconfig/network-scripts/

If you encounter problems after switching services:

  1. Clear existing configurations:
    sudo rm /etc/sysconfig/network-scripts/ifcfg-eth0
    sudo nmcli connection delete eth0
  2. Create fresh configuration using your preferred tool
  3. Restart the networking stack

NetworkManager adds about 2-5% overhead compared to the network service, but provides:

  • Better handling of VPN connections
  • Automatic failover between network connections
  • Improved WiFi management