Sunday, October 13, 2013

Adding IPV6 to machine

Your IPv6 address
There are two ways of obtaining your IPv6 address: hard and easy.

Hard way: calculate it yourself. You can do this here.

Easy way: check it in your OVH panel. After logging in to OVH Manager, go to Dedicated Servers -> Summary. On right side of screen you should see something similar to picture below.

OVH IPv6
OVH IPv6

Don’t look at me like that. I can’t make it easier. If you want to complicate things a little, just go ahead and read more about IP version 6. :P

Paste two commands
This is the main magic. Don’t try it when you’re sober. Ever.

$ sudo ip -6 addr add 2001:41d0:XXXX:XXXX::1/56 dev eth0
$ sudo ip -6 addr delete 2001:41d0:XXXX:XXXX::1/56 dev eth0
Ok. So what the hell is up with these?

First, you’ll need iproute2 package (for the ip command). So just apt-get your way through this complicated issue…

apt-get update && apt-get install iproute
Now, you can add v6 address to your network interface:

$ ip -6 addr add 2001:41d0:XXXX:XXXX::1/56 dev eth0
And check if your gateway is available:

$ ping6 -c 3 2001:41d0:XX:XXff:ff:ff:ff:ff
PING 2001:41d0:1:afff:ff:ff:ff:ff(2001:41d0:XX:XXff:ff:ff:ff:ff) 56 data bytes
64 bytes from 2001:41d0:XX:XXff:ff:ff:ff:ff: icmp_seq=1 ttl=64 time=57.8 ms
64 bytes from 2001:41d0:XX:XXff:ff:ff:ff:ff: icmp_seq=2 ttl=64 time=70.4 ms
64 bytes from 2001:41d0:XX:XXff:ff:ff:ff:ff: icmp_seq=3 ttl=64 time=8.99 ms

--- 2001:41d0:XX:XXff:ff:ff:ff:ff ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 8.992/45.762/70.463/26.508 ms
Fine. Let’s configure routing:

$ sudo ip -6 r a via 2001:41d0:XX:XXff:ff:ff:ff:ff dev eth0
Check if you can see Internets:

$ ping6 -c 3 ipv6.google.com
PING ipv6.google.com(muc03s02-in-x14.1e100.net) 56 data bytes
64 bytes from muc03s02-in-x14.1e100.net: icmp_seq=1 ttl=55 time=21.4 ms
64 bytes from muc03s02-in-x14.1e100.net: icmp_seq=2 ttl=55 time=18.5 ms
64 bytes from muc03s02-in-x14.1e100.net: icmp_seq=3 ttl=55 time=18.6 ms

--- ipv6.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 18.590/19.563/21.469/1.357 ms
Congrats!

Let’s now update our /etc/network/interfaces file. Whole file should look similar to this:

auto eth0
iface eth0 inet static
address YOUR.IP.AD.DRESS
netmask 255.255.255.0
network YOUR.NETWORK.AD.DRESS
broadcast YOUR.BROADCAST.AD.DRESS
gateway YOUR.GATEWAY.AD.DRESS

iface eth0 inet6 static
address 2001:41d0:1:XXXX::1
netmask 56
gateway 2001:41d0:1:XXFF:FF:FF:FF:FF
If you want to have more than one IPv6 address add to second (inet6) definition of eth0 interface following lines.

up /sbin/ip -6 addr add 2001:41d0:1:af20::deaf:bed/56 dev eth0
down /sbin/ip -6 addr delete 2001:41d0:1:af20::deaf:bed/56 dev eth0
Easy? Easy! As hell.

Great. Let’s just disable automatic configuration – it’s breaking things at OVH.

$ sudo sysctl net.ipv6.conf.default.autoconf=0
$ sudo sysctl net.ipv6.conf.all.autoconf=0
Before you proceed – double check your configuration. Reboot your system. Triple check. And then…

- See more at: http://gstlt.info/2012/06/ovh-and-ipv6-problems/#sthash.xntLLa8J.dpuf

No comments:

Post a Comment