Search code examples
ipv6

Mapping IPv4 IP range in CIDR notation to IPv6


I want to convert an IPv4 range in CIDR notation to IPv6. Apart from prefixing them with "::ffff:", is it just a matter of adding 96 to the number of network bits? E.g.

1.2.3.4/32 -> ::ffff:1.2.3.4/128
1.2.3.0/24 -> ::ffff:1.2.3.0/120

Is there more to it than this? I haven't found a library method or a web tool that does this that I can check against.


Solution

  • Yep, that's pretty much it. This is how IPv4 addresses and prefixes are represented in an IPv6 application.