0

I had many ip-s routed to my dedicated server. Interfaces file look like this

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address xx.xx.xx.xx
netmask 255.255.255.xx
gateway xx.xx.xx.xx

auto eth0:0
iface eth0:0 inet static
address xx.xx.xx.xx
netmask 255.255.255.xx

auto eth0:1
iface eth0:1 inet static
address xx.xx.xx.xx
netmask 255.255.255.xx

auto eth0:2
iface eth0:2 inet static
address xx.xx.xx.xx
netmask 255.255.255.xx

When I type in terminal /etc/init.d/networking restart I get this error many many times (I think this error is for every ip I try to assign)

RTNETLINK answers: No such process
SIOCSIFFLAGS: Cannot assign requested address

I have to wait some seconds and after that every thing works as I config, but how to free this error ?

Andrew

1 Answer 1

1

You can try to assign multiple addresses to a single interface instead of using pseudo-interfaces. Like this:

auto eth0
iface eth0 inet static
address <ip1>
netmask <netmask1>
gateway <some_gateway>
up ip addr add <ip2>/<netmask2> dev eth0
up ip addr add <ip3>/<netmask3> dev eth0

etc.

Here <netmask2> and <netmask3> are in "number of 1s in binary" form. So for example the address 192.168.0.5/24 corresponds to 192.168.0.5 with netmask 255.255.255.0 because there are 24 1s in this network mask in binary format. Use http://jodies.de/ipcalc if in trouble.

2
  • is there a shortcut to assign a range of IPs ?
    – Andrew
    Aug 1, 2010 at 22:24
  • ip(8) manual page mentions the following syntax for specifying IP addresses: IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ] [ label STRING ] [ scope SCOPE-ID ] So you cannot specify an IP range. You can always write a shell script to generate /etc/network/interfaces file given a range of IP addresses if you really have that many.
    – MasterM
    Aug 2, 2010 at 8:07

You must log in to answer this question.