Friday, November 30, 2012

How to get IPv6

There's 4 ways to get IPv6:

  • Native (duh)
    • Your ISP hands out native IPv6 addresses using dhcp6 or RA (router advertisement, some sort of auto-configure)
  • Using a tunnel broker
  • Using a 6to4 tunnel (see earlier post)
  • Using 6rd (if your ISP implemented this)

6rd

This looks and works a lot like 6to4. A router on your local network establishes a tunnel to a v4 router that has IPv6 and encapsulates the IPv6 traffic in v4 packets to this router. With 6to4, the prefix (2002::) and tunnel endpoint IP (192.88.99.1) are always the same. With 6rd, these are owned (and thus maintained) by your ISP. You can't setup 6rd unless your ISP tells you the IPv6 prefix and the v4 endpoint address they use. A way to do this automatically is using the dhcp "option-212" response. To test this using isc-dhcp, add this to your dhclient.conf:
option option_6rd code 212 = { integer 8, integer 8, integer 16, integer 16, integer 16, integer 16, integer 16, integer 16, integer 16, integer 16, array of ip-address };
request option_6rd; # add the option_6rd to the list of other request options
If the ISP has a limited set of IPv4 addresses, with the same prefix, they can choose to use a longer (base) IPv6 prefix. In the first picture, the full IPv4 address is used to build the full IPv6 address:
Here the IPv6 ISP prefix is 2011:1001::, the IPv4 address from the customer is 129.10.11.12 and to complete the IPv6 address, the MAC address of the customer (interface ID) is converted and added to this.
In the next picture, only part of the IPv4 address is used, so the ISPs IPv6 network used can be smaller:
Here the IPv6 ISP prefix is 2011:1001:01, the IPv4 address part used is 10.11.12 and the rest is the interface ID as in the previous example.

Images taken from: http://meetings.apnic.net/__data/assets/pdf_file/0017/31148/APRICOT-6rd-final.pdf

 

Getting access to IPv6 for everyone using 6to4

Using 6to4 seems deprecated, but it still works as tunnel servers are still available. 

If you get your Internetz from a 19-century ISP who hasn't implemented IPv6 yet (read: almost all). You have a couple of choices to get access to IPv6.

  • Using a tunnel broker (recommended)
    • www.sixxs.net is a good one
  • Using 6to4 tunneling
To configure 6to4 tunneling, first see if you can reach a tunnel server by doing a ping or traceroute to  192.88.99.1. This IP exists on multiple networks, so you should be able to reach one.
Now to setup the tunnel, you first need to calculate your 6to4 IPv6 address:
printf "2002:%02x%02x:%02x%02x::1\n" `echo YOURv4ADDRESShere | tr . ' '`
Now build the tunnel:
ip tunnel add tun6to4 mode sit remote any local 188.142.102.38
ip link set dev tun6to4 mtu 1472 up
ip -6 add add YOURv6ADDRESShere/16 dev tun6to4
ip -6 route add ::/96 dev tun6to4 metric 1 
ip -6 route add 2000::/3 via ::192.88.99.1 dev tun6to4 metric 1
Now test this:
ping6 google.com

To break down the tunnel:
/sbin/ip -6 route flush dev tun6to4
/sbin/ip link set dev tun6to4 down
/sbin/ip tunnel del tun6to4

Info taken from http://www.wlug.org.nz/6to4

If you like, you can setup reverse DNS and register it at https://6to4.nro.net/ (visit this page using your new 6to4 address to make this work).