Search code examples
syntaxipv6

What is the syntax for IPv6 with both a zone and a range/prefix length


I see an IPv6 address can have a range or prefix length specifier, e.g. /64.

I also see it can have a zone index, e.g. %1.

So what is the syntax when you want both? Is it {addr}%1/64 or {addr}/64%1 or does it not matter (or can you not have both)? Did not find any examples or explanation in wikipedia - they only discuss them separately.


Solution

  • The prefix/mask length is just like for an IPv4 prefix/mask length, but IPv6 does not use explicit masks the way IPv4 can. For example, an IPv4 address of 10.11.12.13/24 is usually used as 10.11.12.13 255.255.255.0, but the IPv6 address of 2001:db8::1/64 does not have a representation with an explicit mask (the mask is implied from the mask length).

    A Zone ID is only used for IPv6 Link-Local addressing, which will always be in the fe80::/64 range on each interface, and that is why you need a Zone ID to tell which interface is meant since they all use the same Link-Local network.

    There would not really be a case where you combine those the way you have.