Setting up Debian 7 static IP address range

gts asked:

I have a Debian 7 server and a usable IP address range from xx.xx.xx.90 to 93. While working on setting up the usable addresses via /etc/network/interfaces I have the following:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address xx.xx.xx.90
        netmask 255.255.255.248
        network xx.xx.xx.88
        broadcast xx.xx.xx.95
        gateway xx.xx.xx.89
        # Example extra IP comment 
        up   ip addr add xx.xx.xx.91/24 dev eth0 label eth0:0
        down ip addr del xx.xx.xx.91/24 dev eth0 label eth0:0
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers xx.xx.xx.xx xx.xx.xx.xx
        dns-search host.xx.xx

where the 2 lines below the ‘Example extra IP comment’ corresponds to the new IP I want to add(will be similar for the rest of the range).

When saving the above and restarting networking via sudo ifdown eth0 && sudo ifup eth0 I get the following message:

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

I don’t understand why it reports that eth0 is not configured and why it is not brought up.

Any help would be greatly appreciated.

UPDATE
I used sudo ifdown --force eth0 && sudo ifup --force eth0 instead as suggested in comments by Zoredache and problem is resolved.

My answer:


You were assigned a /29 netblock, not a /24. But you specified /24 in your up and down scripts. Try fixing that first.

Better yet, use the new way (well, new in the last several releases) of specifying your addresses.

allow-hotplug eth0
iface eth0 inet static
        address xx.xx.xx.90
        netmask 255.255.255.248
        network xx.xx.xx.88
        broadcast xx.xx.xx.95
        gateway xx.xx.xx.89

iface eth0 inet static
        address xx.xx.xx.91
        netmask 255.255.255.248

iface eth0 inet static
        address xx.xx.xx.92
        netmask 255.255.255.248

iface eth0 inet static
        address xx.xx.xx.93
        netmask 255.255.255.248

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.