11

Once upon a time, I used ifdown eth0 to down a network adaptor. It has been years since I've been able to get this to work, basically since I've been on Ubuntu/Debian.

I get this:

$ sudo ifdown eth0
ifdown: interface eth0 not configured

If I run ifconfig, I get:

eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet addr:192.168.20.50  Bcast:192.168.21.255  Mask:255.255.254.0
          inet6 addr: fe80::6e3b:e5ff:fe36:2ee/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1205280 errors:0 dropped:502 overruns:0 frame:0
          TX packets:34930 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:165685286 (165.6 MB)  TX bytes:5754120 (5.7 MB)
          Interrupt:20 Memory:f7f00000-f7f20000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:9146 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9146 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:734342 (734.3 KB)  TX bytes:734342 (734.3 KB)

I've googled to find out how to do this and everything I can find says run ifdown eth0. How do I stop the network adaptor on Debian/Ubuntu boxes?

4 Answers 4

14

I am facing the same issue on Debian. I don't know the exact cause, however, it is working with sudo ifconfig eth0 down for me.

Edit: Thanks to @kostix for his annotations. I haven't concerned myself with the problem in much detail since I use it to temporarily bring down the interface. If you want to permanently bring it down, ifdown is the way to go. For this to work, you will need to add the line eth0=eth0 to /run/network/ifstate and the lines auto eth0 and iface eth0 inet dhcp to /etc/network/interfaces.

8
  • This just brings the adapter down on the physical layer (i.e. as far as the kernel network stack is concerned), and this has nothing to do with the userland layer supposed to manage the adapter. Please see my answer -- may be you'll be able to join efforts with the OP to figure out which subsystem manages your network.
    – kostix
    Dec 31, 2013 at 12:19
  • OK, this did it. I didn't try this before because, on Redhat, ifdown ran ifconfig so I assumed the same for Debian. Silly me. Thanks for this. WTF?
    – Thom
    Dec 31, 2013 at 12:20
  • @Thom, the problem is that the next time you boot eth0 will most likely be up again.
    – kostix
    Dec 31, 2013 at 12:21
  • @Thom, as to WTF... ;-) The kernel is (almost) the same across the distros but the userland tools are not. Well, nm and wicd are the same across the distros, but the "traditional" low-level stuff is not.
    – kostix
    Dec 31, 2013 at 12:23
  • @kostix That's fine. Just wanted to disable a bit for testing. Since it's a VirtualBox it's hard to unplug the network cable. :) Also, I understand about the tools, but the Debian docs say to use ifdown. That's why WTF?
    – Thom
    Dec 31, 2013 at 12:52
16

if ifconfig isn't available on your distro, it means it is replaced by the ip command. In this case, the solution would be ip link set eth0 down

1
  • This is the way to go... At least the up to date way to go...
    – 71GA
    Dec 6, 2021 at 9:52
2

There's no definitive answer as there might be several ways to manage networking in Debian. I'm aware of at least three:

  • The "traditional" approach, using /sbin/ifup, /sbin/ifdown and /etc/init.d/networking, all using the /etc/network/interfaces configuration file. These are provided by the ifupdown package.

    Since ifdown knows nothing about the adapter, I reckon another way is used to manage the network.

    I'm also aware about a package which is beleived to be a drop-in replacement for ifupdown, netscript, but since it uses the same means to manage adapters this is supposedly also not your case.

  • NetworkManager
  • Wicd

Supposedly you have to work out which one is instanned and work from there. Both nm and wicd usually are configured using GUI tools (and usually via applets starting along with your DE). nm has a command line tool, called nm-cli. Not sure about wicd.

If you did a simple installation and selected the "Desktop" task then I beleive (though not sure) you've got NetworkManager installed.

1

interface eth0 not configured

litteraly means

not configured in the /run/network/ifstate file

ifupdown commands have an hysteresis: once you activate an interface with ifup, it is stored in /run/network/ifstate that you've activated it.

ifup eth0
cat /run/network/ifstate
eth0=eth0
(+other interfaces)

ifdown eth0
cat /run/network/ifstate
(+other interfaces)

The state will be saved even if the operation failed (mainly because /etc/network/interfaces is not writen correctly). My main solution till now is to manually edit /run/network/ifstate to act as is eth0 were up and then to turn it down:

nano /run/network/ifstate
eth0=eth0

ifdown eth0

Then you can start again with clean setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.