On 2023-04-18 13:07, Andrei Borzenkov
wrote:
On
18.04.2023 18:10, James Knott wrote:
Second, while my router has a single IPv6
address, it's
prefix is a /128. This means it can't communicate directly with
anything. All traffic for that address has to be routed via the
link
local address.
Bullshit. On-link connectivity in IPv6 has absolutely nothing to
do with "network mask".
Maybe you need to review how IP works. When a device has a packet
to transmit, it compares the destination with it's own address and
subnet mask. If it's within the same subnet, the packet is sent
directly, using the MAC address. If it's in a different subnet,
it's sent to the router for forwarding. With a /24 mask, as
commonly used on IPv4, there are 254 usable addresses, as determined
by the mask size. The same holds with IPv6, where a /64 means 18.4
billion, billion addresses. The same holds for longer prefixes, up
to /127, which supports 2 addresses. This would typically be used
on a point to point link. Now, with a /128 on IPv6 or /32 on IPv4,
how many addresses are there within the subnet? Only 1, which means
there can be no other addresses within the subnet and that means you
have to go through a router to reach any other address.
Even with link local addresses, the number of reachable addresses is
limited by the subnet size and is usually a /64. Here's an example,
taken from the computer I'm using right now.
fe80::76d4:35ff:fe5b:f5fa/64 scope link
In this case the "prefix" is fe80.
Now here's my WAN address.
inet6 2607:f879:804:90:3899:8d05:91dc:56e3
prefixlen 128 (I've changed the address to protect the guilty)
Notice the 128 prefix length? How many bits does that leave for
addresses within the subnet?