How to configure ifplugd?

Josef Wolf jw at raven.inka.de
Fri Jul 29 22:04:13 UTC 2011


Hello everybody,

I would like to configure my laptops (Ubuntu-10.10 and 11.04) to automatically
use eth0 when the cable is plugged and to fall back to wlan0 when the cable is
pulled. Ifplugd seems to be a tool just for that. So I tried to go this route.

This is what I have so far:


  root at meinekiste:/# cat /etc/network/interfaces
  auto lo
  iface lo inet loopback
  
  # ifplugd manpage says interfaces should not be brought up automatically
  iface eth0 inet dhcp

  auto wlan0
  iface wlan0 inet dhcp
  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


  root at meinekiste:/# cat /etc/wpa_supplicant/wpa_supplicant.conf
  network={
    ssid="my-ssid"
    proto=WPA2
    group=CCMP
    pairwise=CCMP
    key_mgmt=WPA-PSK
    psk="my-private-key"
  }


  root at meinekiste:/# cat /etc/default/ifplugd
  INTERFACES="eth0 wlan0"
  HOTPLUG_INTERFACES=""
  ARGS="-q -f -u0 -d10 -w -I"
  SUSPEND_ACTION="stop"
  ARGS_eth0="-q -f -u0 -d1 -w -I"
  root at meinekiste:/#


With this configuration, I can bring up/down eth0 and wlan0 manually with
ifup/ifdown and everything works fine.

Ifplugd brings up/down eth0 when the cable is plugged/pulled. But ifplugd
totally ignores the wlan0 interface, no matter whether I include wlan0
in the INTERFACES variable in /etc/default/ifplugd or not.

/etc/ifplugd/action.d/action_wpa seems to suggest that ifplugd should be able
to manage wireless connections. But here, ifplugd don't touch wlan0 at all.

When I remove "auto wlan0" from /etc/network/interfaces, no communication is
possible when the cable is pulled, since ifplugd fails to "ifup wlan0". When I
do "ifup wlan0" manually, everything works fine.

When I put "auto wlan0" into /etc/network/interfaces, I get double routes like

 Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
 192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
 192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
 169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
 0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
 0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 wlan0

and the traffic goes to nirvana somewhere. I need to manually "ifdown wlan0"
in order to get things working again.

Any ideas what am I missing?




More information about the ubuntu-users mailing list