1

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?

2
  • It's done exactly the same way... count the bits. 255 (hex FF) is 8 bits. IPv6 will never be written as a netmask; it will be a /## CIDR notation.
    – Ricky
    Commented May 31, 2016 at 20:18
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Commented Aug 14, 2017 at 4:22

1 Answer 1

2

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.

7
  • Thanks for the answer. So, is there a way to calculate CIDR bits for IPv6, like by converting hex to binary and counting number of ones?? Commented May 31, 2016 at 9:09
  • There really is much less of a need for this since IPv6 networks are all the same size: /64. You can certainly convert the hex to binary, which is much easier than decimal to binary, and count the number of bits in the CIDR notation from the left. Just don't get too hung up on this since you don't have varying network sizes.
    – Ron Maupin
    Commented May 31, 2016 at 9:12
  • Don't pollute his understands with this /64 BS. IPv6 address are 128 bits. If nothing tells you the size of the network, you cannot make any assumptions. SLAAC demands the prefix-length === 64, however, your network can be any size you desire. Too many idiots think they don't have to care about anything beyond 64bits because of this bull. (some of those idiots have designed broken hardware.)
    – Ricky
    Commented May 31, 2016 at 20:22
  • (translation: if you don't want to use SLAAC, or want to keep android devices off your network, then don't use a /64 LAN.)
    – Ricky
    Commented May 31, 2016 at 20:23
  • 1
    @RickyBeam, some addresses, by definition, are /64 (e.g. Link-local, ULA, etc). Using a subnet prefix length other than a /64 will break many features of IPv6 other than SLAAC, including ND, SEND, Privacy Extensions, Mobile IPv6, PIM-SM w/Embedded-RP, SHIM6, parts of DHCPv6 and DAD, etc. RFC 7421Analysis of the 64-bit Boundary in IPv6 Addressing give a pretty fair and balanced discussion of the pros and cons for using /64.
    – Ron Maupin
    Commented May 31, 2016 at 21:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.