Ip – Calculate networking bits for IPv6

ipip addressipv4ipv6subnet

I can get the networking bits for IPv4 addresses like 17 for 255.255.128.0. Similarly, how should I calculate it for IPv6 addresses?

Say, if I have a subnet mask of ffff:ffff:ffff:ffff:0:0:0:0 or ffff:ffff:ffff:ffff::, how should I find the networking bits?

Also, I found that the networking bits for subnet mask is a maximum of /32 in case of IPv4. What is the maximum limit of IPv6 and what is the reason behind it?

Best Answer

With a very few exceptions, IPv6 will use /64 networks: 64 bits for the Network ID, and 64 bits for the Interface ID. You may see /128 for a host address, and /127 or /126 for a point-to-point link. When you see anything less than /64, e.g. /48, you are seeing a network block that is to be divided into /64 networks.

IPv6 notation only uses the CIDR notation, not a network mask. IPv4 addresses are 32 bits, so the maximum mask length is /32. IPv6 addresses are 128 bits, so the maximum mask length is /128.

You should investigate RFC 4291, IP Version 6 Addressing Architecture, and RFC 5952, A Recommendation for IPv6 Address Text Representation.