CDRouter Support

How do I prevent Network Manager from controlling an interface?

knowledge-base version 10.7

NOTE: The officially supported OS for CDRouter is CentOS 7 with a minimum kernel version of 3.10. If you are a legacy customer still running Ubuntu, you can find alternate instructions for controlling Network Manager in this Knowledge Base article. For more information on CDRouter’s officially support OS, consult this Supported OS Knowledge Base article.

Network Manager is a service for Linux which manages various networking interfaces, including physical such as Ethernet and wireless, and virtual such as VPN and other tunnels. Network Manager can be configured to control some or all of a system’s interfaces.

While Network Manager is an excellent service for managing the daily requirements of a user’s computer, its effects are typically non-optimal for a testing environment. Because of the extra variables it introduces into the state of a test machine’s networking configuration, it can be especially difficult to integrate with CDRouter, which also controls network interfaces. Due to this conflict, the start procedure will generate an error if Network Manager is controlling any interfaces used for testing. In this case you have three options:

  • Configure Network Manager to ignore test interfaces
  • Manually stop Network Manager
  • Remove Network Manager from the system

Manual interface configuration

Before you begin, please be aware that your LAN interface may require manual configuration should you decide to remove Network Manager from your system. If you do not have Internet access from another system, you may wish to learn how this process works before completing the removal process.

Please see this Knowledge Base article for manual interface configuration instructions:

Configure Network Manager to ignore test interfaces

Network Manager has a command line tool that can be used to see which interfaces it is controlling. Pull up a terminal window and type the following command:

nmcli dev status

This displays a table that lists all network interfaces along with their STATE. If Network Manager is not controlling an interface, its STATE will be listed as unmanaged. Any other value indicates the interface is under Network Manager control.

#Network Manager settings are controlled by a configuration file: #/etc/NetworkManager/NetworkManager.conf. We will use this #file to tell Network Manager to stop controlling a particular interface.

ifcfg method

With CentOS, one way to tell Network Manager to stop controlling an interface is by editing the individual ifcfg-* files. First, make sure the /etc/NetworkManager/NetworkManager.conf file has the following lines.

[main]
plugins=ifcfg-rh

This plugin tells Network Manager to look at the CentOS ifcfg-* files. Now for each interface you’d like Network Manager to ignore, edit the individual /etc/sysconfig/network-scripts/ifcfg-* interface files, adding the following lines:

NM_CONTROLLED=no
HWADDR=00:11:22:33:44:55

If present, set the HWADDR value to be the actual MAC address of this interface.

keyfile method

Another way to tell Network Manager to stop controlling an interface is by adding the following lines to the /etc/NetworkManager/NetworkManager.conf file:

[main]
plugins=keyfile

[keyfile]
unmanaged-devices=mac:00:11:22:33:44:55;mac:66:77:88:99:00:aa

List the MAC address of each interface you want Network Manager to ignore, separated with a semicolon. Make sure that MAC addresses listed here are LOWER CASE.

Newer versions of NetworkManager can also use a more generic alternate KEYFILE method that does not involve actual MAC addresses and instead uses interface names. This syntax replaces the [keyfile] section above with the following:

[keyfile]
unmanaged-devices=interface-name:eth*,except:interface-name:eth0;interface-name:wlan*

udev rules method

A third way to tell Network Manager to stop controlling an interface is to add a udev rule. Create the file /etc/udev/rules.d/00-nta1000-net.rules and add the following content:

#
# Interfaces that shouldn't be managed by NetworkManager
#
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth1", ENV{NM_UNMANAGED}="1"
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth2", ENV{NM_UNMANAGED}="1"
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth3", ENV{NM_UNMANAGED}="1"

You can list the interfaces (by name) that you want Network Manager to avoid.

You should reboot for these changes to take effect.

Manually stop Network Manager

If Network Manager is not needed during testing, it can be shut off completely.

systemctl stop NetworkManager
systemctl start NetworkManager

The above commands will stop/start NetworkManager, but will not affect whether it is automatically started when the machine boots. To disable/enable NetworkManager automatically when the system boots, again use the systemctl command (as root):

systemctl disable NetworkManager
systemctl enable NetworkManager

Remove Network Manager from the system

If Network Manager will not be needed at all, it can be removed from the system completely.

yum remove NetworkManager

Restart Networking

You may need to restart networking to make changes take effect.

systemctl restart network

Contents

×

About CDRouter

CDRouter is made by QA Cafe, a technology company based in Portsmouth, NH.

Get in touch via our Contact page or by following us on your favorite service: