skip to content

Why is /64 the standard IPv6 subnet size, and how many /64 subnets does a /48 or a /56 site prefix contain?

level: middleimportance: should knowfreq 38%

answer

  1. the interface ID is fixed
  2. prefix plus ID equals 128
  3. two to the difference
  4. count on nibble boundaries
  5. router links may use /127

basics

~20 s

RFC 4291 fixes a 64-bit interface ID for most unicast addresses, so a LAN subnet is /64. A site prefix holds 2 to the power (64 minus its length) of them: 65,536 in a /48, 256 in a /56.

solid answer

~40 s

RFC 4291 requires 64-bit interface IDs for all unicast addresses except those starting with binary `000`, and RFC 2464 fixes 64 bits for Ethernet, so a LAN's prefix is /64; stateless autoconfiguration (RFC 4862) does not use a prefix whose length plus the interface ID is not 128. A /64 is not about host count; it is the shape every host and router expects. Counting subnets is powers of two: a /48 has 64 − 48 = 16 subnet bits, so 65,536 /64s; a /56 has 8, so 256; a /60 has 4, so 16. Prefix lengths on multiples of 4 line up with hex digits, which keeps plans readable. Exceptions exist: RFC 6164 allows /127 on point-to-point links between routers, and a single host route is /128.

go deeper

for a junior

Remember that an IPv6 LAN is a /64 and that the subnet count of a site prefix is two to the power of (64 minus its length).

for a middle

Explain where /64 comes from: RFC 4291's 64-bit interface ID, the Ethernet link specification and autoconfiguration's prefix-plus-ID rule. Read subnet ranges on nibble boundaries.

for a senior

Know the deliberate exceptions, /127 between routers per RFC 6164 and /128 host routes, and why a non-64 LAN prefix quietly breaks autoconfiguration.

for a principal

Plan a site prefix on 4-bit boundaries by region, building and function so aggregation stays clean, and design for /64 per link rather than host counts.

## Prefix length in IPv6 An IPv6 prefix is written `address/prefix-length` (RFC 4291 section 2.3): the decimal number says how many leftmost bits are the network part. For a **global unicast** address RFC 4291 splits the 128 bits into three fields: | Field | Width | Who sets it | |---|---|---| | Global routing prefix | n bits | Assigned to the site | | Subnet ID | m bits | The site's own plan, one value per link | | Interface ID | 128 − n − m bits | The host or the operator | RFC 4291 states that all global unicast addresses other than those starting with binary `000` have a **64-bit interface ID**, so n + m = 64. That single rule is where /64 comes from. ## Why /64 and not "as many hosts as needed" - **The architecture says so.** RFC 4291 requires 64-bit interface IDs for every unicast address outside the `000` space. - **The link specifications say so.** RFC 2464 (IPv6 over Ethernet) defines a 64-bit interface identifier and says a prefix used for stateless autoconfiguration of an Ethernet interface must have a length of 64 bits. - **Stateless autoconfiguration depends on it.** RFC 4862 says that if the sum of the advertised prefix length and the interface identifier length is not 128 bits, the prefix is ignored for address formation. Number a LAN with a /80 or a /56 and its hosts will not autoconfigure from that prefix. The consequence is that IPv6 subnets are not sized by host count. A /64 holds 2^64 addresses whether the link has two hosts or two thousand; the number is a fixed shape, not a capacity plan. That is the biggest mental shift from IPv4, where a /26 versus /27 decision was about how many hosts fit. ## Counting subnets in a site prefix A site that receives a prefix shorter than /64 has `64 − length` bits of **subnet ID**, so it can number 2^(64 − length) separate /64 links: | Site prefix | Subnet ID bits | /64 subnets | |---|---|---| | /48 | 16 | 65,536 | | /52 | 12 | 4,096 | | /56 | 8 | 256 | | /60 | 4 | 16 | | /64 | 0 | 1 | Which length a site receives is an operator's allocation choice, not a protocol rule; /48 and /56 are common. ## Reading prefixes on nibble boundaries Each hex digit is a **nibble** of 4 bits, and each group is 16 bits. Prefix lengths that are multiples of 4 therefore end exactly at a hex digit, and you can read subnets by eye: 1. `2001:db8:abcd::/48` fixes the first three groups. Its /64s run from `2001:db8:abcd:0::/64` to `2001:db8:abcd:ffff::/64`, the fourth group taking all 65,536 values. 2. `2001:db8:abcd:1200::/56` fixes the first two hex digits of the fourth group. Its /64s run from `2001:db8:abcd:1200::/64` to `2001:db8:abcd:12ff::/64`: 256 subnets. 3. `2001:db8:0:cd30::/60` (RFC 4291's own example) fixes three digits of the fourth group. Its /64s run from `2001:db8:0:cd30::/64` to `2001:db8:0:cd3f::/64`: 16 subnets. A length that is not a multiple of 4 is legal but splits a digit; `/50` leaves two bits of one hex digit fixed, which is why address plans usually stay on 4-bit steps. ## Writing a prefix correctly The address part of a prefix may use any legal text form, but compression still has to expand to the right bits. RFC 4291 gives the trap directly: - Legal: `2001:db8:0:cd30::/60` and `2001:db8::cd30:0:0:0:0/60`. - Not legal: `2001:db8::cd30/60`, because the left side expands to put `cd30` in the **last** group. - Not legal: `2001:db8:0:cd3/60`, because leading zeros may be dropped but trailing zeros may not. ## Where /64 is not used - **Point-to-point links between routers.** RFC 6164 says routers MUST support /127 on such links. A /64 there lets an attacker send to the 2^64 − 3 unused addresses and make a router create neighbour-cache entries and send solicitations that are never answered; a /127 eliminates that. - **A single address**, such as a loopback or a host route, is a /128. - **Addresses starting with binary `000`**, which include the IPv4-embedded forms, are exempt from the 64-bit interface ID rule.

  • A team numbers a LAN with a /80 to save address space. What breaks?
    Stateless autoconfiguration. RFC 4862 ignores a prefix for address formation when its length plus the interface ID length is not 128, and on Ethernet the interface ID is 64 bits (RFC 2464), so hosts form no addresses from the /80. Nothing is saved either: a /48 already holds 65,536 /64s.
  • Why does RFC 6164 allow /127 on links between two routers?
    A /64 on a router-to-router link leaves 2^64 − 3 unused addresses; packets to them make the forwarding router create incomplete neighbour-cache entries and send solicitations nobody answers, which an attacker can use to exhaust memory and CPU. A /127 holds exactly the two router addresses, so the problem disappears; RFC 6164 says routers MUST support it.

saying these in an interview costs you the question

  • A small office LAN should use a /120 because it has few hosts.
  • A /56 gives you 56 subnets.
  • IPv6 subnets are sized by counting hosts, like IPv4 subnets.
  • Prefix lengths must be multiples of 16 to be legal.
  • 2001:db8::cd30/60 is a valid way to write the prefix 2001:db8:0:cd30::/60.