ifdown interface not configured (Debian 6) [duplicate]

My server is dedicated (non-virtual). I want to have 3+1 static IPs. I used aliases (eth0:0, eth0:1) previously, but read that this method is deprecated. So I added another IP and reconfigured my interface with ifup/ifdown while I'm at i;, but ifdown tells me that the interface is not configured.

/etc/network/interfaces looks like this:

auto lo eth0
iface lo inet loopback

# Main IPs (IPv4 + IPv6)
allow-hotplug eth0
iface eth0 inet static
        address 81.x.x.x
        netmask 255.255.255.0
        broadcast 81.x.x.255
        gateway 81.x.x.1

iface eth0 inet6 static
        address 2a02:x:x:x::x:x
        netmask 64
        gateway 2a02:x:x:x::1

# 2nd IP
up ip addr add 81.x.x.x/32 dev eth0

# 3rd IP
up ip addr add 81.x.x.x/32 dev eth0

Note that the 2nd and 3rd IP adresses are from different net ranges (don't know if it matters)

I reload the network configuration with

nohup sh -c "ifdown eth0 && ifup eth0"


The exact output (nohup) is

ifdown: interface eth0 not configured
SIOCADDRT: File exists
Failed to bring up eth0.

What am I doing wrong?

Edit: This questuion has been asked before. But the old question uses deprecated methods. Also the solution does not work for me. Since people here at serverfault seem not to be able to help me but rather just close this as duplicate (I doubt you have actually read what I wrote...) I have asked people at official forums. They are stuck with this problem and cannot find a solution at all - but at least try.
I am getting more and more problems, so I will reinstall the server. You can leave this question closed and unanswered.


Solution 1:

ifdown thinks the interface is already down. If that's not true, because it was brought up using some command other than ifup (ifconfig for example) then you need to shut it down the same way (ifconfig eth0 down).

If the ip addr add commands have also been done manually, you may have to undo them with ip addr del.

ifup and ifdown are fragile. They don't operate smoothly if they aren't the only configuration tools being used. They could get current interface status from the kernel instead of remembering what they last changed it to, but they don't.

Once you've made the current state of the interface match what ifupdown thinks it is, they will start behaving better.