Problem with ifupdown script
Josef Wolf
jw at raven.inka.de
Sun May 30 19:55:28 UTC 2010
Hello,
I want to configure my laptop to automatically use eth0 or wlan0 depending
on whether the network cable is plugged or not.
I use traditional network configuration instead of NetworkManager because
I configure my systems automatically with a system similar to cfengine,
and networkmanager's interactive configuration doesn't play well with
automatic configuration.
So I have put this into /etc/network/interfaces
auto lo eth0 wlan0
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet dhcp
wpa-conf /var/cfsvn/conf/wpa_supplicant.conf
and installed ifplugd to configure/deconfigure eth0 when the cable is
plugged/unplugged. Then, to configure/deconfigure wlan0, I decided to
use the ifupdown mechanism:
#! /bin/sh
# this is /etc/network/if-up.d/myifup
[ x$IFACE = xeth0 ] && ifdown --force wlan0
exit 0
#! /bin/sh
# this is /etc/network/if-down.d/myifup
[ x$IFACE = xeth0 ] && ifup --force wlan0
exit 0
The problem is that this mechanism works only every other time. When I
unplug the cable and plug it again, it works. When I unplug/plug again,
it doesn't work (wlan0 don't come up). Then I unplug/plug again and it
works. Again unplug/plug and it don't work. and so forth.
Any ideas why wlan0 come up only every second time? Any hints?
More information about the ubuntu-users
mailing list