Skip to content

Convert IPv4 into IPv6

I was going through 6to4 tunnel configs and thought I’d post some info on converting IPv4 address into IPv6 Address. This is pretty straight forward and its obviously involves HEX conversion.

Method 1 (Please also see Method 2 below as I think it is much more easier)

Here, I will convert the address 192.168.25.234

First we divide each octet by 16 and write down the remainder, primary school maths! 🙂

192 ÷ 16 = 12 remainder 0
168 ÷ 16 = 10 remainder 8
25 ÷ 16 = 1 remainder 9
234 ÷ 16 = 14 remainder 10

We also know that HEX has the following Values

A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

So we can write 192.168.25.234 into HEX like so… C0A8:19EA

Now we will change the HEX Address C0A8:19EA into regular IPv4

C0 = (12 x 16) + 0 = 192
A8 = (10 x 16) + 8 = 168
19 = (1 x 16) + 9 = 25
EA = (14 x 16) + 10 = 234

QED 🙂

Method 2

Another easier way to convert is to convert the octets into Binary, in this case we will still use the IP address 192.168.25.234

Split those above 32Bit into equal 16 Bits as HEX is based on Base of 16, then Add them up.

C0
A8
19
EA

IPv6 Link Local Address

Since we have converted the 192.168.25.234 IPv4 address into hexadecimal, this can be written into the following 128-Bit IPv6 link-local address FE80:0000:0000:0000:0000:0000:C0A8:19EA which can be zero compressed into FE80::C0A8:19EA

And finally…

Hope I have explained it thoroughly so you could follow… If you have any doubts, feel free to add your comments.

comments powered by Disqus