Having a strange issue while trying to convert an ipv4 list file to ipv6:
ipv6calc -q --action conv6to4 --in ipv4 1.1.23.1 --out ipv6
2002:101:1701::
Trying to validate that result is correct, I used some online converters and it seems that 1.1.23.1 is 2002:0:0:0:0:0:101:1701 (or else 2002::101:1701). So the last "::" should be removed & 2002 should have extra ":".
I really don't want to use sed/awk commands in order to manipulate this result, so the questions are:
- is there alternative cmd/linux SW?
- is this somehow fixed inside ipv6 calc, am I doing something wrong?
Thanks
This is the correct 6to4 address. A 6to4 subnet is on the format
2002:IP4_HI:IP4_LO::/48
.IP4_HI
is the top 16 bits of the IPv4 address, whileIP4_LO
is the low 16 bits of the address.For example, the IPv4 address
1.2.3.4
gives you the 6to4 subnet2002:0102:0304::/48
.See 6to4 address block allocation for more details.
A different question is whether this is actually the address you want? There are other ways to map IPv4 addresses to IPv6 addresses. For example, there are IPv4-mapped IPv6 addresses, which are typically written as
::ffff:1.2.3.4
.The address format you need depends on what you are going to use it for.