How to configure IPv6 on OpenVZ

I have been use OpenVZ since 2 years ago, and there was no critical issue. As we know, this blog had IPv6 address record in DNS and it was running for few months. The problems was come after I changed the distribution router to OpenBSD and I need to change routing table on core router. This article will show how to setup IPv6 in OpenVZ container and make the VPS IPv6 ready.

Configure IPv6 on OpenVZ is so simple, and we only need two steps to make it works. Before that, please to ensure that your network are IPv6 ready.

First step, check your IPv6 connectivity from VM Manager:

$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 6C:F0:49:AA:65:50
inet addr:10.13.177.2 Bcast:10.13.177.6  Mask:255.255.255.248
inet6 addr: 2406:2400:dc7a::2/112 Scope:Global
inet6 addr: fe80::6ef0:49fc:fb3a:2150/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:245271433 errors:0 dropped:0 overruns:0 frame:0
TX packets:342316684 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:58738029183 (54.7 GiB)  TX bytes:408724287413 (380.6 GiB)

$ ping6 ipv6.google.com
PING ipv6.google.com(2404:6800:800b::6a) 56 data bytes
64 bytes from 2404:6800:800b::6a: icmp_seq=0 ttl=53 time=85.1 ms
64 bytes from 2404:6800:800b::6a: icmp_seq=1 ttl=53 time=85.2 ms
64 bytes from 2404:6800:800b::6a: icmp_seq=2 ttl=53 time=85.3 ms
64 bytes from 2404:6800:800b::6a: icmp_seq=3 ttl=53 time=85.4 ms
64 bytes from 2404:6800:800b::6a: icmp_seq=4 ttl=53 time=85.3 ms
64 bytes from 2404:6800:800b::6a: icmp_seq=5 ttl=53 time=85.4 ms
64 bytes from 2404:6800:800b::6a: icmp_seq=6 ttl=53 time=85.2 ms
64 bytes from 2404:6800:800b::6a: icmp_seq=7 ttl=53 time=85.3 ms
64 bytes from 2404:6800:800b::6a: icmp_seq=8 ttl=53 time=85.4 ms

— ipv6.google.com ping statistics —
9 packets transmitted, 9 received, 0% packet loss, time 8005ms
rtt min/avg/max/mdev = 85.195/85.328/85.453/0.095 ms, pipe 2

Here we go…, add your IPv6 into OpenVZ container using the following command:

# vzctl set 130 –ipadd 2406:2400:dc7a::a –save

vzctl set : command to manage openvz container (guest) from VM manager (VM host)
130: id number container
ipadd: command to add IP address from VM manager into container
ipdel: command to remove IP address from VM manager into container
save: command to completely save the configuration on container

And then restart network service the container using the following command:

# vzctl exec 130 /etc/init.d/network restart

If the command in above doesn’t work, try to restart the container:

# vzctl stop 130
# vzctl start 130

And then try use ping6 to check your IPv6 in container:

# ping6 2406:2400:dc7a::a
PING 2406:2400:dc7a::a(2406:2400:dc7a::a) 56 data bytes
64 bytes from 2406:2400:dc7a::a: icmp_seq=0 ttl=64 time=0.044 ms
64 bytes from 2406:2400:dc7a::a: icmp_seq=1 ttl=64 time=0.046 ms
64 bytes from 2406:2400:dc7a::a: icmp_seq=2 ttl=64 time=0.037 ms
64 bytes from 2406:2400:dc7a::a: icmp_seq=3 ttl=64 time=0.035 ms
64 bytes from 2406:2400:dc7a::a: icmp_seq=4 ttl=64 time=0.044 ms
64 bytes from 2406:2400:dc7a::a: icmp_seq=5 ttl=64 time=0.037 ms
64 bytes from 2406:2400:dc7a::a: icmp_seq=6 ttl=64 time=0.042 ms

— 2406:2400:dc7a::a ping statistics —
7 packets transmitted, 7 received, 0% packet loss, time 5999ms
rtt min/avg/max/mdev = 0.035/0.040/0.046/0.008 ms, pipe 2

Voila…, IPv6 has been works.

reference: http://wiki.openvz.org

About David

Just nobody :-)
This entry was posted in Networking and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>