Intro #
We have previously covered briefly how an IPv4 network can communicate with an IPv6 network. One of the methods is via an IPv6 tunnel. In this article, we’ll delve deeper into 6to4 which is an IPv6 tunneling mechanism. By using 6to4, IPv6 packets can be transmitted over an IPv4 network.
Also see Teredo tunneling.
How does 6to4 work? #
For the 6to4 tunneling mechanism to work, there are a few key components required.
- The global IPv4 address for the tunnel interface.
- The dual-stack relay server to route IPv4 packets to the IPv6 interface and vice-versa.
- The 6to4 IPv6 address.
Calculating the 6to4 IPv6 address #
First of all, we’ll take a look at how to derive the 6to4 IPv6 address from the IPv4 address. You can easily notice a 6to4 IPv6 address because the first 16 bits is always 2002 in hexadecimal (as specified in RFC 3056). Following the RFC specification, the next 32 bits will be the IPv4 address. After that, the next 16 bits will specify the particular IPv6 subnet.
For example, you have 2002:0C9B:A665:0001:0000:0000:0C9B:A665 as your 6to4 IPv6 address. Your IPv4 address will be 0C9B:A665 which you can view as 0C.9B.A6.65 then you can convert it to decimal to get 12.155.166.101 for your dotted-decimal IPv4 address notation.

Role of the Relay Server in IPv6 Transition (6to4 Mechanism) #
In IPv6 transition mechanisms such as 6to4 tunneling, a relay server plays a critical role in enabling communication between IPv6 and IPv4 networks. It acts as an intermediary routing system that forwards traffic between the two protocol environments.
A relay server is typically dual-stacked, meaning it has both an IPv4 interface and an IPv6 interface. This allows it to receive traffic from either protocol and correctly forward it to the appropriate destination network.
When a 6to4-encapsulated packet arrives via the IPv4 interface, the relay server extracts the IPv6 payload and routes it into the IPv6 network. In the reverse direction, IPv6 packets destined for 6to4 addresses (identified by the prefix 2002::/16) are encapsulated into IPv4 packets and forwarded across the IPv4 infrastructure.
Packet Encapsulation Process #
Encapsulation is the core mechanism that makes 6to4 tunneling possible. When an IPv6 packet needs to traverse an IPv4-only network, it is wrapped inside an IPv4 packet. This encapsulation uses IPv4 protocol number 41, which indicates that the payload contains an IPv6 packet.
At the receiving end, the relay server removes the IPv4 header and restores the original IPv6 packet before forwarding it to its destination. This process allows IPv6 traffic to “ride over” existing IPv4 networks without requiring changes to the intermediate infrastructure.
Conclusion #
Although native IPv6 deployment is now widely available in modern networks, IPv4 remains present in many systems worldwide. As a result, transition mechanisms such as 6to4 tunneling were historically important for enabling early IPv6 adoption.
However, it is worth noting that 6to4 is now considered largely deprecated in modern networking practice, due to issues such as reliability, performance variability, and lack of widespread relay support. Today, it has largely been replaced by more stable approaches such as dual-stack networking, NAT64/DNS64, and native IPv6 deployment.
Despite this, understanding 6to4 remains valuable for learning how IPv6 transition technologies evolved and how IPv4 and IPv6 interoperability was achieved in earlier stages of Internet modernization.
