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:  Mask:

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

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

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.

  • If you say its fine withing your network, it maybe the firewall thats blocking it for some reason. You can try to temporarily Disable it by using this command 'sudo iptables -F' --- as per documentation here --- help.ubuntu.com/community/IptablesHowTo
    – Tasos
    Mar 26 '14 at 0:23
  • Thanks for your response, Tasos. I tried iptables -L and get Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination which to me looks like I have no IPtables active? I also tried the -F option and I can't ping the secondary IP.
    – MiB
    Mar 26 '14 at 0:30
  • It would seem my approach doesn't work and I need to investigate IP aliasing with the ip command.
    – MiB
    Mar 26 '14 at 0:56
  • I don't know much about OpeVVZ but after reading some Documentation the veth Net device sounds a bit more friendly as it has more features --- openvz.org/Differences_between_venet_and_veth --- But dont quote me on any ofthis. I checked the links by "Feature veth venet"
    – Tasos
    Mar 26 '14 at 1:01
  • See the update for details. I don't seem to control interfaces so I seem stuck with venet.
    – MiB
    Mar 26 '14 at 2:48

I don't know much about OpenVZ, but after reading some documentation, the veth Net device sounds a bit more friendly as it has more features:

But don't quote me on any of this.

I checked the links by "Feature veth venet"

Original answer by Tasos

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.