Debians /etc/network/interfaces is a powerful way to setup multiple profiles; NetworkManager is a pretty UI for managing your network. However they don’t play well together: NetworkManager will ignore devices managed via network/interfaces.

However, NetworkManager lacks a couple of important options, including static IPs and several wireless options; I can’t connect to my universities WAP2 network using NetworkManager because of some missing options.

This is why I wrote this small script:

#!/bin/sh
# disable network manager:
dbus-send --system \
  --dest=org.freedesktop.NetworkManager \
  /org/freedesktop/NetworkManager \
  org.freedesktop.NetworkManager.sleep
sudo ifup eth1=eth1-lrz

My /etc/network/interfaces contains a working setup for my wireless named “eth1-lrz”; since this differs from the real device name, this works fine.

Running this script will tell NetworkManager to disconnect and instead setup the wireless for my university network. When connecting to a different network, I only have to do “ifdown eth1” and then click on the NetworkManager applet to enable it again. (would be “org.freedesktop.NetworkManager.wake”)