In many tutorials I see examples to add an IPv6 address on Linux like
ip -6 addr add 2001:0db8:0:f101::1/64 dev eth0
Since an IPv6 address has 128 bits and this is only supposed to add a single IP, why is it done /64 and not /128 ?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
The IPv6 addressing architecture (RFC4291) requires all unicast addresses always have a prefix length of 64 bits. Using something other than a /64 will break a number of IPv6 features such as neighbor discovery, secure neighbor discovery (SEND), privacy extensions, mobile IPv6, embedded-RP (multicast), etc.
The current IPv6 address assignment guidelines call for allocating a /64 only when it is known that one and only one subnet is needed, otherwise a /56 should be allocated to small sites that are "expected to need only a few subnets over the next 5 years", or a /48 for larger sites. (ARIN policy 126.96.36.199)
A number of free tunnel brokers currently offer /48s. You could easily set up 65,536 globally routed /64s at home right now if you wanted to. (e.g. Hurricane Electric will give anyone a /48)
If that seems wasteful, consider that there are over 16 million times as many /48s possible as IPv4 /24s. And twice as many /48s as there are square centimeters of landmass on the earth. (2.8✕1014 versus 1.4✕1014 cm2).
Most tunnel brokers (or native ipv6 delegations) give you a /64 and then route the whole /64 to your endpoint. Since the two endpoints (the one on the broker/ISP side and the one on your side) are part of this /64, you need to configure the /64 prefix.
It's basically the same as getting an ipv4 range from an ISP. If you get a /24, you add the netmask 255.255.255.0 (or /24) to your IP address. Otherwise, your host doesn't know how big the subnet is.