6

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.

Marco Alka
  • 181
  • 1
  • 1
  • 7
  • nope, that did not solve my problem. `networking restart` works incorrectly without giving an error an is also DEPRECATED. – Marco Alka Oct 30 '13 at 09:42
  • If you simply added the part of your edit about deprecated methods and that even that method did not work may have made this a candidate for a re-open. It also can take more than a few days to get an answer. – Dave M Nov 01 '13 at 20:35
  • 1
    I agree with @MarcoAlka, the problem is not solved and I also can't find a solution for this problem. I have a feeling that `ifup`, `ifdown` and `/etc/init.d/networking restart` are all deprecated but no one wants to tell us the new way. – Ethan Leroy Mar 28 '14 at 16:34
  • @EthanLeroy: unfortunately, I cannot test a solution any more. I switched over to FreeBSD as this question took too long and no one was able to find a solution. Imho, FreeBSD is a lot easier to configure. Took me way to long to find this out, though. – Marco Alka Apr 01 '14 at 15:03
  • 1
    You can try `sudo ip link set eth0 down` and `sudo ip link set eth0 up`. – appas May 13 '15 at 18:24

1 Answers1

9

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.