In the structure
struct sockaddr_in6, the field
sin6_scope_id is declared.
What is the use of this member? How can we know from the IPv6 address and the prefix length the scope that it should use?
Network Engineering Stack Exchange is a question and answer site for network engineers. It only takes a minute to sign up.Sign up to join this community
Given the IPv6 Link-Local addressing, where every interface has the same network (
fe80::/10), there must be some way to distinguish which specific network is meant when referring to a link-local address. That is what the Scope ID, also called a Zone ID so as not to be confused with the multicast scope flags, is for.
Basically, the scope or zone is the interface in the host for link-local addresses. There are some RFCs around this, e.g. RFC 6874, Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers, which explains how to use this for URIs, including web browsers. The
% character is used to denote the zone at the end of the text address representation:
Unfortunately, not all web browsers support using link-local addressing. There are also some security restrictions, and this should only be used for link-local addressing at this time:
To limit this risk, implementations MUST NOT allow use of this format except for well-defined usages, such as sending to link-local addresses under prefix fe80::/10. At the time of writing, this is the only well-defined usage known.
The scope or zone ID is only locally significant:
An HTTP client, proxy, or other intermediary MUST remove any ZoneID attached to an outgoing URI, as it has only local significance at the sending host.
How a scope or zone ID is represented is specific to a particular operating system.