I've got a Ubuntu 13.10 VPS server with 1 IPv4 (111.111.111.111) (and 1 IPv6 address).
I recently requested an extra IP address (222.222.222.222) but I can't seem to figure out how to add the new IP address to my network configuration.
My current (default?) network configuration:
/etc/network/interfaces
:
# 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
iface eth0 inet dhcp
From what I came up with after searching is that I need to add the new IP address like so:
iface eth0:1 inet static
address 222.222.222.222
netmask 255.255.255.0
But unfortunately this doesn't work and I've got the feeling it has something to do with the dhcp
setting in auto eth0
-> iface eth0 inet dhcp
but I have no clue how to fix this.
Also worth noting is that the gateway for IP 1 is different from the gateway for IP 2, could this lead to any issues?
My feeling says I need to remove the current network configuration for eth0
and replace it with:
iface eth0 inet static
address 111.111.111.111
netmask 255.255.255.0
gateway xxx.xxx.xxx.xxx
So the end result would look something like:
# 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
iface eth0 inet static
address 111.111.111.111
netmask 255.255.255.0
gateway xxx.xxx.xxx.xxx
iface eth0:1 inet static
address 222.222.222.222
netmask 255.255.255.0
Because there are some small sites currently active on this server I don't want to risk any downtime by changing these network configurations
My Goal
My goal is (please let me know if this is possible or not) to use IP address 1 (111.11...) for all apache2 requests on port 80. And to use IP address 2 (222.22...) for all requests through something other than apache2 (NodeJs for instance) but also on port 80.