How can I make NetworkManager ignore my wireless card?

I do not want NetworkManager to list or manipulate my wireless card. Can I hide its interface from NetworkManager somehow?

I have tried adding this in /etc/network/interfaces,

iface wlan0 inet static
    address 192.168.1.101
    netmask 255.255.255.0
    gateway 192.168.1.1
    wireless-essid Synaptotagmin
    pre-up wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
    post-down killall -q wpa_supplicant

and this in /etc/NetworkManager/nm-system-settings.conf,

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=/org/freedesktop/Hal/devices/net_00_19_e0_57_86_af

but NetworkManager Applet still lists and allows me to connect to wireless networks.


Solution 1:

According to Gnome Wiki, the syntax in /etc/NetworkManager/NetworkManager.conf (in older versions it was /etc/NetworkManager/nm-system-settings.conf) is different than what I'd read Arch Linux Wiki. It should be:

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=mac:00:19:e0:57:86:af

This configuration makes NetworkManager oblivious to the existence of my wireless card, but still allows me to control it using other methods.

Solution 2:

I think the wrong line may be:

unmanaged-devices=/org/freedesktop/Hal/devices/net_00_19_e0_57_86_af

as I didn't found that format specified in the official documentation.

Valid formats are unmanaged-devices=mac:<hwaddr> or, in recent Network Manager versions, unmanaged-devices=interface-name:<ifname>. Both are accepted together separated by semicolons, for example:

unmanaged-devices=mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4;interface-name:eth2

This is an extract from NetworkManager.conf manual:

unmanaged-devices

Set devices that should be ignored by NetworkManager when using the keyfile plugin. Devices are specified in the following format:

mac: or interface-name:. Here hwaddr is the MAC address of the device to be ignored, in hex-digits-and-colons notation. ifname is the interface name of the ignored device.

Multiple entries are separated with semicolons. No spaces are allowed in the value.

Example:

unmanaged-devices=interface-name:em4

unmanaged-devices=mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4;interface-name:eth2

Solution 3:

Use the following /etc/NetworkManager/nm-system-settings.conf:

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

This way your interfaces from /etc/network/interfaces will be unmanaged by Network Manager, i.e. it will not try to do anything with them.

Solution 4:

Alternate KEYFILE method

Regardless of which linux distribution is running, an alternate method can be used to tell Network Manager to stop controlling an interface. This is done by adding the following lines to the Network Manager configuration file /etc/NetworkManager/NetworkManager.conf:

[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 (If there already is a section [main] with plugins=..., add the plugin keyfile to that list there)

To get the mac address of your device wlan0 use

LANG=c ifconfig wlan0|grep HWaddr

This will show the mac of the device, something like

wlan0     Link encap:Ethernet  HWaddr ac:51:4f:70:13:72

Restart NetworkManager with

sudo /etc/init.d/network-manager restart