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