How to enable IPv6 on vzLinux (Linux Virtuozzo/OpenVZ)

Assuming that the VPS networks are in host-routed mode the following steps are necessary.

At the time of this writing almost all VPS are in host-routed mode.

The following steps have to be done on Virtuozzo server.

  1. Configure IPv6 on main VPS network interface that is used for IPv4 Internet connection.For example:# vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=”eth0″BOOTPROTO=static

    IPADDR=199.xx.xx.xx

    NETMASK=255.255.252.0

    GATEWAY=199.xx.xx.xx

    ONBOOT=”yes”

    IPV6INIT=”yes”

    IPV6ADDR=26xx:xxxx:0:1::62:xxxx/64

    IPV6_DEFAULTGW=26xx:xxxx:0:1::1 In order for the change to take effect:

    # service network restart

     

  2. Add the directive “IPV6FORWARDING=yes” to the config file  /etc/sysconfig/network# vi /etc/sysconfig/networkNETWORKING=yes

    HOSTNAME=vzlinux27

    NETWORKING_IPV6=yes

    IPV6FORWARDING=yes

    Sometime it is better to define the gateway (for both IPv4 and IPv6) in this file.

  3. Make sure that IPv6 support is enabled in /etc/vz/vz.conf# vi /etc/vz/vz.conf## IPV6 supportIPV6=”yes”

    If this value is changed from “no” to “yes” the vz server has to be rebooted in order to take effect.

  4. Assuming that the proper IPv6 has been configured on the network and added to PBAS then VPS can get IPv6 from PBAS similar to IPv4. If VZ server is not in PBAS IPv6 has to be added using CLI.
  5. If an interface is member of a bridge and multicast snooping is enabled on that bridge, IPv6 will not work, because NDP relies on multicast.

    # cat   /sys/class/net/br1/bridge/multicast_snooping
    1

    In order to disable multicast snooping on bridge we use the following command. Bridge name is br1 in this example.

    # echo 0 > /sys/class/net/br1/bridge/multicast_snooping

    In order to make this persistent so it survives a reboot we can add it to /etc/rc.local