Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 473
Souvik Avatar asked Mar 16 '11 05:03

Souvik


People also ask

How do you disable a Linux network interface?

if you want to disable for example the eth0 (ethernet port), you can sudo ifconfig eth0 down which will disable (down) the port. changing down to up will re-enable it.

Which shell command will temporarily disable the second network interface?

To disable it, we will use the “ifconfig” command in the shell followed by the interface name and state to be applied. Hence, we have mentioned the state as “down” in the below command. Now when you check the state of interfaces, the state of an interface “enp0s3” has been changed to “down”.


2 Answers

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     --    
like image 74
Derek Gorczynski Avatar answered Sep 21 '22 08:09

Derek Gorczynski


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.

like image 22
bjesus Avatar answered Sep 25 '22 08:09

bjesus