Can’t ifdown eth0 (Main Interface) – Troubleshooting Guide

debiannetworking

I can't ifdown an interface on Debian 6.0.5:

user@box:/etc/network$ sudo ifdown eth0 && sudo ifup eth0
ifdown: interface eth0 not configured
SIOCADDRT: File exists
Failed to bring up eth0.

user@box:/etc/network$ cat interfaces 
auto lo
iface lo inet loopback

allow-hotplug eth0 
allow-hotplug eth1 

auto eth0
iface eth0 inet static
address 10.0.0.1
netmask 255.255.255.0
gateway 10.0.0.254

auto eth1
iface eth1 inet manual

As requested by marco:

user@box:/etc/network/$ cat /run/network/ifstate 
lo=lo
eth1=eth1

Best Answer

Check the contents of the file /run/network/ifstate. ifup and ifdown use this file to note which network interfaces can be brought up and down. Thus, ifup can be easily confused when other networking tools are used to bring up an interface (e.g. ifconfig).

From man ifup

The program keeps records of whether network interfaces are up or down. Under exceptional circumstances these records can become inconsistent with the real states of the interfaces. For example, an interface that was brought up using ifup and later deconfigured using ifconfig will still be recorded as up. To fix this you can use the --force option to force ifup or ifdown to run configuration or deconfiguration commands despite what it considers the current state of the interface to be.

Related Question