What command to use inside /etc/network/interfaces to take an interface down

Scott J. Henson scotth at csee.wvu.edu
Wed Jul 13 13:16:17 UTC 2005

Jaime wrote:

>Hi all.
>I'd like to use a command inside my /etc/network/interfaces to
>automatically take down the eth0 interface before I "ifup" another
>interface called rausb0. I realize the place to put it is inside the
>"iface rausb0" stanza, and it should listed after the "pre-up" command
>If I use "pre-up ifdown eth0", then ifuping rausb0 just hangs (I think
>this is related to
>http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=231197 but I'm not
>If I use "pre-up ip link set dev eth0 down", then the eth0 is indeed
>taken down ("ip link" shows me it is down), but the file
>"/etc/network/ifstate" is not updated - this file thinks that eth0 is
>still up.
>Does anyone know the correct command to use?
/etc/network/if-pre-up.d contains commands that are run before 
interfaces are brought up.  You could drop in a script to do that, but I 
think it would suffer from the same defficiencies as the way your doing 
now.  I would say to use ifplugd and just unplug your ethernet cord 
before bringing up your second interface.

Another solution would be to create a script to do both for you and call 
it instead of ifup. 

More information about the ubuntu-users mailing list