Problem with ifupdown script

Jay Ridgley jridgley2 at austin.rr.com
Mon May 31 12:45:53 UTC 2010


Josef Wolf <jw at raven.inka.de> wrote:


> Date: Sun, 30 May 2010 21:55:28 +0200
> From: Josef Wolf <jw at raven.inka.de>
> Subject: Problem with ifupdown script
> To: ubuntu-users at lists.ubuntu.com
> Message-ID: <20100530195528.GA15925 at raven.wolf.lan>
> Content-Type: text/plain; charset=us-ascii
> 
> 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?
> 
> 
> 

Josef,

I am by no means an expert, however, could it be that the interface remains UP 
when the eth0 cable is unplugged?

Just a thought...

Cheers,
Jay

-- 


Jay Ridgley
jridgley2 at austin.rr.com
Registered Linux User ID - 9115
Registered Ubuntu User ID - 23320




More information about the ubuntu-users mailing list