Deployment of IPv6 is not complete. Therefore, to reach the cloud from an IPv6 network, a transition between IPv4 and IPv6 networks is required. The most common methods for this transition are tunneling (for example, 6to4, 6in4, ISATAP, or Teredo), dual stacking, and IPv6 to IPv4 translation.
- Note
- If required, the examples that are provided with this SDK can be run within an IPv6 network without tunneling to IPv4, so this setup is optional.
Tunneling 6to4
One of the possibilities to transition from IPv6 to IPv4 is 6to4. This technique connects to IPv6 networks using an IPv4 backbone. 6to4 uses the IPv4 protocol number 41 (IPv6 encapsulation) and the well-known address 192.88.99.1 to communicate with IPv4/IPv6 relays. It also allows for connections with other 6to4 nodes. See http://tools.ietf.org/html/rfc3056 for more information.
A major advantage of this method is the simple configuration, as presented below.
# Getting the public IPv4 address
ipv4_cur=$(dig @ns1.google.com -t txt o-o.myaddr.l.google.com +short | tr -d "\"")
# Local IPv4. Remember to set this so it matches your local address
ipv4_int="148.122.44.161"
# Converting to IPv6 addresses with the 2002 prefix
ipv6=$(printf "2002:%02x%02x:%02x%02x::1" $(echo $ipv4_cur | tr "." " "))
# Display status
echo My PUBLIC IPv4 address is $ipv4_cur
echo My GLOBAL IPv6 address is $ipv6
# Set up a tunnel interface with time-to-live 200. The remote endpoint
# is any, as we do not specify an endpoint to connect to. The local IP is
# set to our local address.
ip tunnel add tun6to4 mode sit ttl 200 remote any local $ipv4_int
# Start the interface
ip link set dev tun6to4 up
# Assign the IPv6 address to the tunnel interface
ip -6 addr add $ipv6/48 dev tun6to4
# Assign the public IPv4 address to the tunnel interface
ip -4 addr add $ipv4_cur dev tun6to4
# Route all IPv6 traffic via 192.88.99.1 (anycast address for 6to4 relays)
ip -6 route add default via ::192.88.99.1 dev tun6to4
To check if the above setup works, try to ping some IPv6 servers, for example ipv6.google.com.
# Send ICMP Echo Request to ipv6.google.com.
ping6 ipv6.google.com
Figure 1. Output of ifconfig command for 6to4 tunnel.
- Note
- If the described setup does not work, check your router settings for protocol 41 (IPv6 encapsulation).
The next step is to share the obtained prefix with the btX interface. For example, if your global IPv6 address is 2002:1234:5678::1, the obtained prefix with an added subprefix (bits 49-63) is 2002:1234:5678:ABCD::/64.
To share the obtained prefix with the btX interface, configure RADVD and ensure that the IPv6 global address is added to your btX interface. See RADVD for Linux for more information.
Teredo Tunnel
Another method of transitioning between IPv4 and IPv6 is Teredo Tunneling defined by IETF. Teredo packs IPv6 packets inside of IPv4 UDP payload and sends them to the Teredo relay, which is situated inside the IPv6 infrastructure. See http://tools.ietf.org/html/rfc4380 for more information.
The implementation of Teredo on Linux systems is called miredo. The series of commands below shows how to set up a Teredo tunnel.
# Install miredo module
sudo apt-get install miredo
# Run miredo
sudo miredo
# Check if teredo interface is up. This might take a few seconds.
ifconfig
Figure 2. Output of ifconfig command for Teredo tunnel.
- Note
- A Teredo tunnel does not allow to share an IPv6 prefix. Therefore, only a unicast IPv6 address is assigned to the Teredo interface.
Troubleshooting guide
- If you are using a virtual machine on Windows, echo response messages might be received multiple times, resulting in duplicate messages. One solution for this error is to stop the Windows service Routing and Remote Access (Ctrl + Shift + Esc -> Services tab -> Services button).
- For both methods, an IPv4 connection is required. Setting up the router behind the NAT (network address translation) or a firewall might cause incorrect behavior.