Can’t remember the IPv6 6to4 conversion?

What is IPv6 6to4 tunnel address? 2022::/16 or 2002::/16? How do you convert the IPv4 address into IPv6 6to4 tunnel address? Well there is the long way, which you should understand and then there is the easy way in case you need to configure it really quickly. I found this nice method where you can use the IPv6 General Prefix feature to automatically calculate the conversion. Originally this feature was used to create a variable for IPv6 network, the “general-prefix”, to easily change all IPv6 addresses in case reassignment of IP subnets.


Configuration is pretty simple. First make sure to have the 6to4 Tunnel’s source interface configured, in my example that’s Loopback0

Rack1R1#sh ip int brief loop0
Interface                  IP-Address      OK? Method Status                Protocol
Loopback0               YES manual up                    up

Then configure the IPv6 general-prefix for 6to4 type using loop0.

Rack1R1(config)#ipv6 general-prefix MY-GEN-PRE 6to4 loopback0

Rack1R1#sh ipv6 general-prefix
IPv6 Prefix MY-GEN-PRE, acquired via 6to4
2002:9601:101::/48 Valid lifetime infinite, preferred lifetime infinite

The way you apply it on the tunnel is using regular ipv6 address command:

R1(config)#int tun1
R1(config-if)#ipv6 address ?
  WORD                General prefix name
  X:X:X:X::X          IPv6 link-local address
  X:X:X:X::X/  IPv6 prefix
  autoconfig          Obtain address using autoconfiguration

R1(config-if)#ipv6 address MY-GEN-PRE ::1/64

…and finally a quick verification, shows the correct IPv6 address 2002:9601:101::1.

R1#sh ipv6 int brief tunnel 1
Tunnel1                    [up/up]

So what is the hard way of doing this? First you have to remember that IPv6 6to4 tunnels always start with 2002::/8 addresses. Then you have to convert the IPv4 source of the tunnel into the hex notation to be inserted into the tunnel’s IPv6 address. In This example I will use as the IPv4 tunnel source. The network address will be 2002:c000:0204::/48 and that address would be assigned manually.

R1(config)#int tun1
R1(config-if)#ipv6 address 2002:c000:0204::1/64