Souvik
Souvik

Reputation: 611

Disable network manager for a particular interface

I would like to disable network manager service for particular interface(s). "/etc/init.d/NetworkManager stop" is not going to serve my purpose since will stop the service. Please let me know how to achieve this. Please suggest commands/code only - I am not interested in graphical configuration. If there is some rpm/patch available already please refer it to me. Can we configure network manager in such a way so that it will not detect any new network card plugged into the system?

Thanks in advance,

Souvik

Upvotes: 16

Views: 44419

Answers (4)

Derek Gorczynski
Derek Gorczynski

Reputation: 149

NetworkManager will not attempt to control a given interface if you set the interface to unmanaged using the nmcli command.

nmcli dev set wlp2s0 managed no

You can verify the interface is no longer managed with the following:

nmcli dev status

Output example:

DEVICE             TYPE      STATE         CONNECTION      
wlp2s0             wifi      unmanaged     --    

Upvotes: 14

Oliver Hernandez
Oliver Hernandez

Reputation: 197

On my RHEL 6.5 system, I had to edit the configuration file for the particular adapter (/etc/sysconfig/network-scripts/ifcfg-eth0) and add the following line:

NM_CONTROLLED=no

The 2nd part of your question, "Can we configure network manager in such a way so that it will not detect any new network card plugged into the system?", I think is handled in the /etc/NetworkManager/NetworkManager.conf file with the line:

no-auto-default=00:80:A4:0A:3C:20,

Set this property of course to the value of the MAC address for your adapter. More info on this option can be read here.

Upvotes: 2

bjesus
bjesus

Reputation: 488

Put this in your NetworkManager.conf (usually at /etc/NetworkManager/):

[main]
plugins=keyfile

[keyfile]
unmanaged-devices=mac:xx:xx:xx:xx:xx:xx

of course, adjust the mac address to the device your want to ignore.

Upvotes: 29

user221137
user221137

Reputation:

I realise this question is a bit old, but it came up when I was trying to Google the answer to this myself. What eventually worked for me was:

  1. Add the interface to /etc/network/interfaces. For mine:
    iface eth1 inet static
        address 192.168.168.1
        netmask 255.255.255.0
        gateway 192.168.168.1
  1. Restart networking: sudo /etc/init.d/networking restart
  2. Restart Network Manager: sudo service network-manager restart

Network Manager should ignore any interfaces it finds in /etc/network/interfaces. At this point obviously you're on your own for managing this interface with ifconfig or something similar.

Upvotes: 10

Related Questions