I have added a secondary IP to my virtual server, Ubuntu 12.04 running in OpenVZ virtual host. I used
ip addr add xx.xxx.168.95/32 label venet0:1 dev venet0.
When I do ifconfig the IP shows up below lo, venet0 and venet0:0:
venet0:1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:xx.xxx.168.95 P-t-P:xx.xxx.168.95 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
There are issues reaching the secondary IP externally. Local access works fine and I'm using a tomcat instance with ipbased virtual hosting. Locally the 2 sites are served correctly. Externally I can only reach the one on the main IP. Google DNS resolves the domain name pointing to the secondary IP in question and on the Ubuntu machine I've added them to hosts as well.
I can't reach the secondary IP externally, however, not even with ping. It would seem I need to add something to make the secondary IP available to the internet.
What am I missing here?
So, I found the concept of IP Alias interesting. Here's my "interfaces" file:
auto lo iface lo inet loopback
auto venet0 iface venet0 inet manual up ifconfig venet0 up up ifconfig venet0 0 up route add default dev venet0 down route del default dev venet0 down ifconfig venet0 down iface venet0 inet6 manual up ifconfig venet0 add yyyy:yyy:5::4db/0 down ifconfig venet0 del yyyy:yyy:5::4db/0 up /sbin/ip -6 route add 2000::/3 dev venet0 auto venet0:0 iface venet0:0 inet static address xx.xxx.168.175 netmask 255.255.255.255
This file also states not to edit that file, but rather to create an "interfaces.tail" file with additional rules:
auto venet0:1 iface venet0:1 inet static address xx.xxx.168.95 netmask 255.255.255.255
Making this file isn't enough however. I need to restart the networking and I tried with
/etc/init.d/networking restart but that "Failed to bring up venet0". So I rebooted. The interfaces.tail isn't read.