Last article about 6to4 explained how your 6to4, ie 2002::16 network is reached from the IPv6 internet. Good news is that it was the hardest part to explain and understand.
Still, the question remains : when you decide to send packets to the IPv6 Internet through the IPv4 Internet with 6to4, how does your gateway do?
Well, let’s imagine what’s in the mind of the router when he receives to packet from your network, with a Global Unicast IPv6 destination address :
« Hey I’ve just received an IPv6 packet to 2404:6800:4006:802::1011!
Uh oh, but I’ve got no IPv6 next-hop to send it to, because my Internet interface is IPv4 only!
I guess I’ll have to establish a tunnel to some 6to4 gateway router to send it that IPv6 packet, so it can forward it to the IPv6 Internet ».
Precisely, the router looks at the IPv6 routing table, sees that it has to use a Tunnel0 point-to-point interface to route packet, and then checks the Tunnel0 interface configuration. There, it sees that it has to use the 6to4 protocol to encapsulate the IPv6 packets into IPv4 packets, thus creating a tunnel.
Now the question is : what is the IPv4 address of the endpoint of that tunnel?
In the previous article, we discovered that for the 6to4 gateway on the other side, the tunnel endpoint’s IPv4 address was extracted from the IPv6 2002::/16 address, so the 6to4 gateway would know to whom to send the IPv4 packets containing the IPv6 packets.
But when you send a packet to the native IPv6 Internet, there’s no 6to4 IPv4 address included in the destination IPv6 address. These addresses are just « raw » IPv6 addresses, not constructed from anything.
The answer lies in the IETF RFC3068 :
Default route in the 6to4 routers
The 6to4 routers are configured with the default IPv6 route (::/0) pointing to the 6to4 IPv6 anycast address.
This means that your router automatically knows what is the endpoint of the tunnel it’s establishing : it is the 6to4 anycast address. Still according to the RFC this address is 18.104.22.168.
So when your router seeks to send a packet to the native IPv6 Internet, it encapsulates your packet in the IPv4 packet with IP destination address 22.214.171.124. Then, the IPv4 network will route this packet to that gateway. The 6to4 gateway will take the packet and since it’s for itself, will examine its content and realize there’s an IPv6 packet to route.
The magic is in the fact that there’s not only one 6to4 gateway, but many. Indeed, if all the traffic destined to the IPv6 Internet went through only one gateway, it would quickly become overloaded and would go down.
To solve the problem, ISP could create many 6to4 gateways and give different IPv4 addresses to them, but that would make it complicated to configure in the customer router.
It’s easier to give the same address to all the 6to4 gateway, and let the network decide to which of these gateways the trafic is sent. It’s the principle of anycast addresses.
It means that on the IPv4 Internet, there are many 126.96.36.199 routers.