Understanding IPv6 Addresses: Structure, Notation, and Usage
IPv6 addresses are the next-generation internet protocol designed to replace IPv4, offering a vastly larger address space to accommodate the growing number of connected devices. This guide explains the structure, notation, and usage of IPv6 addresses, along with practical applications like URL formatting and global allocation.
Key Points
- 128-bit structure: IPv6 addresses consist of 8 hextets (16-bit blocks), totaling 128 bits.
- Hexadecimal notation: Uses digits
0–9and lettersA–F(e.g.,2001:0db8::1). - Abbreviations:
- Leading zeros in a hextet can be omitted (e.g.,
0db8→db8). - One or more consecutive zero hextets can be replaced with
::(e.g.,2001:db8::1).
- Leading zeros in a hextet can be omitted (e.g.,
- URL usage: IPv6 addresses must be enclosed in square brackets (e.g.,
http://[2001:db8::1]). - Global allocation: Prefixes like
2000::/3identify global unicast addresses, distributed by IANA and RIRs.
IPv6 Address Basics
Structure and Notation
An IPv6 address is divided into 8 hextets, each representing 16 bits. The full address is written as:
2001:0db8:0000:0000:0000:ff00:0042:8329
Key rules:
- Hexadecimal values: Each hextet ranges from
0000toFFFF. - Colon separators: Hextets are separated by colons (
:). - Case insensitivity:
Aandaare equivalent (though lowercase is preferred per RFC 5952).
Example: The hextet
7ABequals0x7ABin hexadecimal (decimal value: 1963).
IPv4 vs. IPv6 Comparison
| Feature | IPv4 | IPv6 |
|---|---|---|
| Length | 32 bits | 128 bits |
| Notation | Decimal (e.g., 192.168.1.1) | Hexadecimal (e.g., 2001:db8::1) |
| Blocks | 4 octets (8-bit) | 8 hextets (16-bit) |
| Abbreviations | None | Leading zeros, :: |
Abbreviating IPv6 Addresses
Omitting Leading Zeros
Leading zeros in a hextet can be removed to simplify the address:
Original: 2001:0db8:0000:0000:0000:ff00:0042:8329
Abbreviated: 2001:db8:0:0:0:ff00:42:8329
The Double Colon (::) Rule
The :: abbreviation replaces one or more consecutive zero hextets to shorten the address. It can only be used once per address to avoid ambiguity.
Example:
Original: 2001:db8:0:0:0:ff00:42:8329 Abbreviated: 2001:db8::ff00:42:8329
Expansion Example:
Abbreviated: F282::8C79:2:7AB:73:2:9943
Expanded: F282:0000:8C79:0002:07AB:0073:0002:9943
Calculation: 7 hextets are present; :: replaces 1 missing hextet (0000).
Practical Applications
Using IPv6 in URLs
IPv6 addresses in URLs must be enclosed in square brackets to distinguish colons from port numbers:
http://[2001:db8::1] // Standard
http://[2001:db8::1]:8080 // With port
Global Allocation Overview
Global unicast IPv6 addresses typically start with 2000::/3 and are allocated hierarchically:
- IANA → Regional Internet Registries (RIRs):
- ARIN (North America):
2600::/12 - APNIC (Asia-Pacific):
2001:0200::/23
- ARIN (North America):
- ISPs receive
/32or larger prefixes (e.g., OVH:2001:41d0::/32).
Common Mistakes to Avoid
- Using
::more than once in an address (e.g.,2001::db8::1). - Forgetting hexadecimal notation (e.g., writing
10instead ofAfor decimal 10). - Including unnecessary leading zeros (e.g.,
0db8instead ofdb8). - Confusing IPv6 colons with URL port separators (e.g.,
http://2001:db8::1:8080). - Assuming hextets are bytes (they are 16-bit blocks, not 8-bit).
Visual Breakdown
IPv6 Address Structure
| 16 bits | 16 | 16 | 16 | 16 | 16 | 16 | 16 |
|---------|----|----|----|----|----|----|----|
| H1 | H2 | H3 | H4 | H5 | H6 | H7 | H8 |
Total: 8 hextets × 16 bits = 128 bits.
Hexadecimal Values
| Hex | Decimal | Hex | Decimal |
|---|---|---|---|
0 | 0 | 8 | 8 |
1 | 1 | 9 | 9 |
A | 10 | B | 11 |
C | 12 | D | 13 |
E | 14 | F | 15 |
Quick Reference Guide
- Full address: 8 hextets, 128 bits (e.g.,
2001:0db8:0000:0000:0000:ff00:0042:8329). - Abbreviated: Remove leading zeros, use
::once (e.g.,2001:db8::ff00:42:8329). - URL format: Enclose in brackets (e.g.,
[2001:db8::1]). - Global prefix: Starts with
2000::/3(e.g.,2001:db8::/32for ISPs). - Tools: Use
ping6orip -6 addrto test IPv6 connectivity.
Learn More
- RFCs:
- Interactive Tools:
- Further Reading: