IPv6 Address Format: Complete Guide to IPv6 Notation
IPv6 addresses use a completely different format than IPv4, with 128 bits instead of 32 bits, written in hexadecimal instead of decimal. Understanding IPv6 address format is essential for working with modern networks. This comprehensive guide explains everything you need to know about IPv6 address notation and structure.
IPv6 Address Basics
Address Length
IPv6: 128 bits (16 bytes) IPv4: 32 bits (4 bytes)
Comparison:
IPv4: 32 bits = 4.3 billion addresses
IPv6: 128 bits = 340 undecillion addresses
Scale:
340,282,366,920,938,463,463,374,607,431,768,211,456 addresses
= 340 undecillion
= 340 trillion trillion trillion
= ~667 million trillion per square millimeter of Earth's surface
Hexadecimal Notation
Why hexadecimal? - 128 bits too long in binary - Decimal would be unwieldy - Hexadecimal compact and readable - Industry standard
Hexadecimal digits:
0 1 2 3 4 5 6 7 8 9 a b c d e f
(0-15 in decimal)
Full IPv6 Address Format
Standard Notation
Format: Eight groups of four hexadecimal digits, separated by colons
Structure: ``` xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
Each x is a hexadecimal digit (0-f) 8 groups of 4 digits = 32 hex digits 32 hex digits × 4 bits = 128 bits ```
Example: ``` 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Breaking it down: 2001 : 0db8 : 85a3 : 0000 : 0000 : 8a2e : 0370 : 7334 └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ 1 2 3 4 5 6 7 8 ```
Binary representation: ``` 2001:0db8:85a3:0000:0000:8a2e:0370:7334
2001 = 0010 0000 0000 0001 0db8 = 0000 1101 1011 1000 85a3 = 1000 0101 1010 0011 ... (continues for all 8 groups) ```
IPv6 Address Compression
Rule 1: Leading Zero Compression
Remove leading zeros from each group
Before:
2001:0db8:0000:0042:0000:8a2e:0370:7334
After:
2001:db8:0:42:0:8a2e:370:7334
Rules: - Remove leading zeros in each group - Keep at least one digit per group - Trailing zeros must remain
Examples:
0000 → 0
0001 → 1
0010 → 10
0100 → 100
1000 → 1000
Rule 2: Zero Compression (::)
Replace consecutive groups of zeros with ::
Before:
2001:0db8:0000:0000:0000:0000:0000:0001
After:
2001:db8::1
Rules: - Can only use :: once per address - Replaces one or more consecutive zero groups - Choose longest sequence of zeros - If equal length, compress leftmost
Examples:
Example 1:
Full: 2001:0db8:0000:0000:0000:0000:0000:0001
Step 1: 2001:db8:0:0:0:0:0:1 (remove leading zeros)
Step 2: 2001:db8::1 (compress zeros)
Example 2:
Full: fe80:0000:0000:0000:0000:0000:0000:0001
Compressed: fe80::1
Example 3:
Full: 0000:0000:0000:0000:0000:0000:0000:0001
Compressed: ::1 (loopback)
Example 4:
Full: 0000:0000:0000:0000:0000:0000:0000:0000
Compressed: :: (all zeros)
Common Mistake: Multiple ::
Wrong:
2001::25de::cade
(Two :: - ambiguous!)
Correct options: ``` 2001:0000:0000:0000:0000:25de:0000:cade Could be: 2001::25de:0:cade Or: 2001:0:0:0:0:25de::cade
Only one :: allowed! ```
IPv6 Address Components
Network Prefix
First 64 bits (typically)
Format:
2001:db8:1234:5678::/64
└─────────────────┘
Network prefix
Purpose: - Identifies network/subnet - Routing decision - Hierarchical structure - Assigned by ISP/RIR
Interface Identifier
Last 64 bits (typically)
Format:
2001:db8:1234:5678:abcd:ef01:2345:6789
└──────────────────┘
Interface identifier
Purpose: - Identifies specific interface - Unique within subnet - Can be random, EUI-64, or manual
Generation methods: - EUI-64 (from MAC address) - Privacy extensions (random) - DHCPv6 assigned - Manually configured - SLAAC (Stateless Address Autoconfiguration)
Special IPv6 Addresses
Loopback Address
Address: ::1
Full form: 0000:0000:0000:0000:0000:0000:0000:0001
Purpose: Local loopback (like 127.0.0.1 in IPv4)
Usage:
bash
ping6 ::1
curl http://[::1]:8080
Unspecified Address
Address: ::
Full form: 0000:0000:0000:0000:0000:0000:0000:0000
Purpose: - Indicates absence of address - Source address before configuration - "No address" placeholder
Usage:
Listening on all interfaces: [::]
Default route: ::/0
Link-Local Addresses
Prefix: fe80::/10
Range: fe80:: to febf::
Common: fe80::/64
Format: ``` fe80::interface-id
Example: fe80::1 Example: fe80::a00:27ff:fe4e:66a1 ```
Purpose: - Local network communication - No router forwarding - Automatic configuration - Neighbor discovery
Characteristics: - Automatically assigned - Not routable - Unique per interface - Required on all interfaces
Unique Local Addresses (ULA)
Prefix: fc00::/7
Range: fc00:: to fdff::
Commonly used: fd00::/8
Format:
fd00::/8 - Locally assigned
fc00::/8 - Centrally assigned (not implemented)
Purpose: - Private addressing (like RFC 1918) - Not routable on internet - Unique within organization
Example:
fd12:3456:789a::/48
Generation:
fd + 40 random bits + subnet + interface ID
fd00:1234:5678::/48
Global Unicast Addresses
Prefix: 2000::/3
Range: 2000:: to 3fff::
Current allocation: 2000::/3
Format:
2001:db8::/32 - Documentation
2001::/16 - Production allocations
2606::/16 - North America
2a00::/12 - Europe
Purpose: - Public internet addresses - Globally routable - Assigned by RIRs
Multicast Addresses
Prefix: ff00::/8
Format: ``` ff0X:: └─ Scope
Scopes: ff01:: - Interface-local ff02:: - Link-local ff05:: - Site-local ff08:: - Organization-local ff0e:: - Global ```
Common addresses:
ff02::1 - All nodes (link-local)
ff02::2 - All routers (link-local)
ff02::1:2 - All DHCP servers
ff02::1:ff00:0/104 - Solicited-node
Documentation Prefix
Prefix: 2001:db8::/32
Purpose: Documentation and examples
Usage:
Safe for documentation
Won't conflict with real addresses
Like 192.0.2.0/24 for IPv4
Examples:
2001:db8::1
2001:db8:1234:5678::1
2001:db8:abcd:ef01:2345:6789:abcd:ef01
IPv6 Prefix Notation
CIDR Notation
Format: address/prefix-length
Examples:
2001:db8::/32 - /32 network
2001:db8:1::/48 - /48 network
2001:db8:1:2::/64 - /64 network (standard subnet)
2001:db8:1:2:3:4:5:6/128 - Single host
Common Prefix Lengths
Assignments:
/128 - Single host (like /32 in IPv4)
/64 - Standard subnet
/56 - Home network allocation
/48 - Site allocation
/32 - ISP allocation
/3 - Global unicast space
Calculation:
/64 network:
2^(128-64) = 2^64 = 18,446,744,073,709,551,616 addresses
Mixed IPv4/IPv6 Notation
IPv4-Mapped IPv6 Addresses
Format: ::ffff:IPv4-address
Purpose: Represent IPv4 addresses in IPv6 format
Examples:
::ffff:192.0.2.1
::ffff:10.0.0.1
::ffff:c000:0201 (192.0.2.1 in hex)
Usage:
Dual-stack applications
IPv4 compatibility
Transition mechanisms
IPv4-Compatible IPv6 Addresses (Deprecated)
Format: ::IPv4-address
Examples:
::192.0.2.1
::10.0.0.1
Status: Deprecated, don't use
URL and Application Format
URLs
Format: [IPv6-address]:port
Examples:
http://[2001:db8::1]/
https://[2001:db8::1]:8080/
ftp://[2001:db8::1]:21/
Why brackets? ``` Without: http://2001:db8::1:8080 Ambiguous! Is :8080 part of address or port?
With: http://[2001:db8::1]:8080 Clear! Address in brackets, port after ```
Application Configuration
Web servers: ```nginx
Nginx
listen [::]:80; listen [2001:db8::1]:443 ssl; ```
Databases: ```
PostgreSQL
listen_addresses = '::'
MySQL
bind-address = :: ```
SSH:
ssh user@2001:db8::1
ssh -6 user@example.com
Ping:
bash
ping6 2001:db8::1
ping -6 example.com
Address Representation Best Practices
Canonical Form
RFC 5952 recommendations:
1. Use lowercase
Preferred: 2001:db8::1
Avoid: 2001:DB8::1
2. Compress longest zero sequence
Preferred: 2001:db8::1
Avoid: 2001:db8:0:0:0:0:0:1
3. If equal length, compress leftmost
Address: 2001:db8:0:0:1:0:0:1
Preferred: 2001:db8::1:0:0:1
Avoid: 2001:db8:0:0:1::1
4. Don't compress single zero group
Address: 2001:db8:0:1:1:1:1:1
Preferred: 2001:db8:0:1:1:1:1:1
Avoid: 2001:db8::1:1:1:1:1
Documentation
Always use: - 2001:db8::/32 for examples - Lowercase hexadecimal - Compressed form when possible - Brackets in URLs
Converting Between Formats
Expanding Compressed Addresses
Example: 2001:db8::1
Steps:
1. Count groups: 2001:db8::1 has 3 groups
2. Missing groups: 8 - 3 = 5 groups
3. Replace :: with 5 zero groups
4. Result: 2001:db8:0:0:0:0:0:1
5. Add leading zeros: 2001:0db8:0000:0000:0000:0000:0000:0001
Compressing Full Addresses
Example: 2001:0db8:0000:0000:0000:0000:0000:0001
Steps:
1. Remove leading zeros: 2001:db8:0:0:0:0:0:1
2. Find longest zero sequence: 0:0:0:0:0
3. Replace with ::: 2001:db8::1
Common IPv6 Addresses
Well-Known Addresses
::1 - Loopback
:: - Unspecified
fe80::1 - Link-local (common gateway)
ff02::1 - All nodes multicast
ff02::2 - All routers multicast
2001:db8::1 - Documentation example
Typical Assignments
ISP to customer: 2001:db8:1234::/48
Customer subnet: 2001:db8:1234:1::/64
Customer host: 2001:db8:1234:1::1
Troubleshooting Address Format
Common Errors
Error 1: Multiple ::
Wrong: 2001::db8::1
Right: 2001:0:0:0:0:db8:0:1 or 2001::db8:0:0:0:1
Error 2: Too many groups
Wrong: 2001:db8:1:2:3:4:5:6:7
Right: 2001:db8:1:2:3:4:5:6 (8 groups max)
Error 3: Invalid characters
Wrong: 2001:db8:xyz:1::1
Right: 2001:db8:abc:1::1 (hex only: 0-9, a-f)
Error 4: Missing brackets in URL
Wrong: http://2001:db8::1:80
Right: http://[2001:db8::1]:80
Conclusion
IPv6 address format uses 128-bit hexadecimal notation with specific rules for compression and representation. Understanding these formats is essential for configuring, troubleshooting, and working with IPv6 networks.
Related Articles
IPv6 Fundamentals
- What is an IPv6 Address? - IPv6 introduction and benefits
- IPv6 vs IPv4 - Protocol comparison
- IPv6 Subnetting - Network planning with IPv6
- IPv6 Benefits - Advantages over IPv4
IPv6 Address Types
- IPv6 Privacy Extensions - Temporary addresses
- Multicast Address - IPv6 multicast
- Loopback Address - ::1 in IPv6
IPv6 Implementation
- IPv6 Adoption - Current deployment status
- IPv6 Transition Mechanisms - Migration strategies
- Dual Stack Networking - Running both protocols
- IPv6 IoT - IPv6 for Internet of Things
Explore More
- IPv6 Guide - Complete IPv6 resource hub
- IPv4 Address Format - IPv4 notation
- Networking Basics - Essential concepts
Key takeaways: - 128 bits written as 8 groups of 4 hex digits - Separated by colons (:) - Leading zeros can be omitted - Consecutive zero groups compressed with :: - Only one :: per address - /64 is standard subnet size - Brackets required in URLs: [address]:port - 2001:db8::/32 for documentation - Lowercase preferred - Massive address space (340 undecillion)
Mastering IPv6 address format enables you to read, write, and work with IPv6 addresses confidently, essential for modern networking as the internet transitions from IPv4 to IPv6.