2

I have a Debian 7 box that will host multiple domains. I'm trying to add a second IP, but every time I try /etc/init.d/network stop && /etc/init.d/network start, I get this error:

RTNETLINK answers: File exists
Failed to bring up eth0:0

However, the new IP still works - I can access the server in my browser just fine.

This is my interfaces file:

allow-hotplug eth0
iface eth0 inet static
        address 111.222.26.38
        netmask 255.255.255.0
        network 111.222.26.0
        broadcast 111.222.26.255
        gateway 111.222.26.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 1.2.3.4 1.2.3.5 1.2.3.6
        dns-search my.tld

auto eth0:0
iface eth0:0 inet static
        address 111.222.26.165
        netmask 255.255.255.0

My routing table route -n:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         111.222.26.1    0.0.0.0         UG    0      0        0 eth0
111.222.26.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

In about 100% of similar problems posted on Google, the problem fixes itself by either removing the gateway declaration from the second stanza (which I've done), or by simply calling ifdown and ifup (which doesn't behave any differently).

How do I stop that error from happening? It's not stopping anything from working, but still...

Edit

Posting my new config after making changes as suggested by @bodhi.zazen:

# 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
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 111.222.26.38
        netmask 255.255.255.0
        network 111.222.26.0
        broadcast 111.222.26.255
        gateway 111.222.26.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 111.222.3.119 111.222.3.117 111.222.5.233
        dns-search my.tld

iface eth0 inet static
        address 111.222.26.165
        netmask 255.255.255.0

After rebooting the box, the error I get is now: ifup: interface eth0 already configured

Quasipickle
  • 177
  • 1
  • 8

1 Answers1

4

You are using older (legacy) syntax.

The new syntax is much simpler:

auto eth0

allow-hotplug eth0

iface eth0 inet static
    address 111.222.26.38
    netmask 255.255.255.0
    network 111.222.26.0
    broadcast 111.222.26.255
    gateway 111.222.26.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 1.2.3.4 1.2.3.5 1.2.3.6
    dns-search my.tld

iface eth0 inet static
    address 111.222.26.165
    netmask 255.255.255.0

See - https://wiki.debian.org/NetworkConfiguration#iproute2_method

Also, the error "RTNETLINK answers: File exists ..." error is non-specific.

Other solutions :

Edit /etc/udev/rules.d/70-persistent-net.rules and delete the entry referring to eth0

See https://superuser.com/questions/618390/rtnetlink-answers-file-exists-maybe-because-assigned-a-new-mac-adress for details.

See also http://www.linuxquestions.org/questions/linux-networking-3/rtnetlink-answers-file-exists-error-when-doing-ifup-on-alias-eth1-1-on-rhel5-710766/

Panther
  • 156
  • 6
  • The only difference is changing the second name from `eth0:0` to `eth0`? I've done that and I'm still getting the same result. – Quasipickle Jun 20 '14 at 16:09
  • Post your updated config file and the exact error message. It should no longer read 0:0 ... – Panther Jun 20 '14 at 17:02
  • See also http://superuser.com/questions/618390/rtnetlink-answers-file-exists-maybe-because-assigned-a-new-mac-adress – Panther Jun 20 '14 at 17:05
  • post updated with new config file. I saw that linked post, but I don't have a 70-persisten-net.rules file. – Quasipickle Jun 20 '14 at 18:34