SheepDev

IP and network calculations

Compare compressed IPv6 addresses and their ranges

Tools to use

Long IPv6 strings can make two representations look like different destinations. Leading-zero omission and zero compression can radically change the appearance of one address. Before inspecting character differences in logs or configuration, normalize the representation with the IPv6 tool.

Swap a long representation for its short form

Two inputs representing the same address
2001:0db8:0000:0000:0000:0000:0000:0001
2001:db8::1

Enter each separately: expanded form and numeric value match. IPv6 is written as eight 16-bit groups in hexadecimal. Removing the leading zero from 0db8 changes no value. The double colon represents omitted zero groups, rather than merely two separators.

Hexadecimal letter case does not change the address either. 2001:DB8::1 and 2001:db8::1 differ as text but not as addresses. For monitoring or review, distinguish the original string from its normalized value; there is no need to rewrite the source log.

Expand :: until there are eight groups

Inspect positions in expanded form
2001:db8:0:1::1
2001:0db8:0000:0001:0000:0000:0000:0001

Five explicit groups remain—2001, db8, 0, 1, and the final 1—so :: supplies three zero groups. Compression can obscure positions within 128 bits. Expand to eight groups before identifying a boundary such as /64.

Two occurrences of :: leave the omitted group counts ambiguous, so 2001::db8::1 is invalid. Compression must remain reversible, not be arbitrary punctuation editing. Non-hexadecimal groups or excessive digits should not be treated as values that the tool will conveniently repair.

Normalize when several zero runs could be shortened

2001:db8:0:0:1:0:0:1 has two equally long zero runs. The tool returns 2001:db8::1:0:0:1 in this example, using the longest run and the leftmost on a tie. Another valid compressed spelling need not mean a different numeric address.

For 'did the destination change?', compare expanded or integer values. For 'does output follow our formatting convention?', inspect the text too. Separating semantic identity from display consistency reduces noisy change reports without discarding useful formatting checks.

Address compression is separate from a /64 range

2001:db8:1::1234 is one address; adding /64 describes its prefix range. IPv6/CIDR yields network 2001:db8:1:: and endpoint 2001:db8:1:0:ffff:ffff:ffff:ffff. Shortening the text with :: does not reduce the bit width or range size.

A /64 contains 2⁶⁴ addresses, 18,446,744,073,709,551,616. Inspect it as a range rather than enumerating it. Use CIDR comparison for containment and differences, and do not import IPv4-style broadcast reservations by mechanically subtracting two.

An IPv4-looking suffix can still be an IPv6 representation

Representations of the same IPv4-mapped IPv6 value
::ffff:192.0.2.1
::ffff:c000:201
0000:0000:0000:0000:0000:ffff:c000:0201

Here 192.0.2.1 corresponds to hexadecimal c000:0201; the tool outputs ::ffff:c000:201. Extracting just the familiar dotted suffix can discard the IPv6 context. Check how an application's logs or API represent addresses before defining a matching rule.

Parsing the representation does not connect IPv4 and IPv6 networks. Text conversion configures no tunnel or translator and contacts no destination. Reading a value is separate from enabling network functionality.

A readable address is not necessarily usable

The examples use the documentation prefix 2001:db8::/32, not real destinations. Valid syntax does not establish existence, routing, or permission. SheepDev calculates supplied values without DNS queries or port probes.

For two logged values, compare expanded and integer forms first. Use CIDR calculation for ranges and CIDR comparison for membership. Ports, interface identifiers, and URL syntax are separate information. Identify what the input contains and give the appropriate component to the appropriate tool.

An IPv6 literal inside a URL needs context

In https://[2001:db8::1]:8443/path, IPv6 colons coexist with the port separator. Brackets belong to URL syntax, not the address itself. Pass 2001:db8::1 to address normalization, or use URL parsing for the whole string. Splitting on colons may work for simple IPv4 host-and-port strings but fails to understand IPv6 structure.

Expanding to eight groups helps check zero positions, but longer spelling does not create a different address. Normalize inventory and log values before comparing identity. A shared-looking prefix alone does not establish network membership without a prefix length. Address identity and subnet membership are different questions; use CIDR or containment tools for the latter.

The 2001:db8:: examples are documentation addresses. Successful parsing is not evidence of Internet reachability. Syntax, assignment, routing and access control remain separate checks. Use normalization to remove a representation ambiguity first. Reasoning with a 128-bit value and prefix, rather than enumerating hosts, is what makes large IPv6 ranges manageable.

Sources

Tools to use

Guides →