IPv6 Compression Rules and SLAAC, Step by Step
An IPv6 address has eight groups of four hexadecimal digits. Compression shortens it without changing its value, and SLAAC lets a host build a global address from a router-advertised prefix and its own interface identifier.
The two compression rules
Rule 1: Drop leading zeros inside each group
Leading zeros do not change a group's value, so they can be omitted:
2001:0db8:becomes2001:db8:0042becomes420001becomes1
Only zeros at the start of a group may be removed — trailing zeros are meaningful. For example, ff00 cannot be shortened to ff, because that would mean 00ff, a different value.
A group of all zeros becomes a single 0 when :: is not used for it.
Rule 2: Replace the longest run of two or more zero groups with ::
A double colon replaces two or more consecutive 16-bit groups of zeros — RFC 5952 §4.2.2 forbids using :: to shorten just one 16-bit 0 field, so a single zero group is written as 0 (2001:db8:0:1:1:1:1:1 is correct, 2001:db8::1:1:1:1:1 is not). Choose the longest run. If two runs are equally long, compress the first one.
You may use :: only once — twice would make the address ambiguous, since a reader could not tell how many zero groups belong in each gap.
Worked example
Start with this address:
2001:0db8:0000:0000:0000:ff00:0042:8329
Step 1: Remove leading zeros.
2001:db8:0:0:0:ff00:42:8329
Step 2: Find the longest run of consecutive zero groups.
There are three zero groups in a row in the middle.
Step 3: Replace that run with ::.
2001:db8::ff00:42:8329
The :: accounts for the three missing zero groups.
Try another one:
FF01:0000:0000:0000:0000:0000:0000:0001
That compresses to:
ff01::1
IPv6 addresses are commonly written in lowercase, though hex letters are not case-sensitive.
What SLAAC does
Stateless Address Autoconfiguration (SLAAC) lets an IPv6 host create its own address without a server assigning a lease. A router periodically sends an ICMPv6 Router Advertisement (RA) and replies to a host's Router Solicitation (RS). When the advertisement carries a prefix marked for autonomous configuration, the host combines:
- The advertised network prefix, normally /64
- An interface identifier created by the host
The host then runs Duplicate Address Detection — if another device uses it, the address is unusable.
For example, if the router advertises 2001:db8:10:20::/64, the host keeps those first 64 bits as the prefix and supplies its own final 64 bits.
How the interface identifier is created
EUI-64
The traditional method modifies the 48-bit MAC address:
- Split the MAC address into two 24-bit halves.
- Insert FFFE between the halves, producing 64 bits.
- Flip the seventh bit—the universal/local, or U/L, bit—of the first byte.
For example, MAC address 00:1A:2B:3C:4D:5E becomes interface identifier 021a:2bff:fe3c:4d5e in EUI-64 form: the first byte changes from binary 00000000 to 00000010 when the U/L bit is inverted.
Random and stable privacy identifiers
Modern operating systems often avoid publishing a permanent MAC-derived identifier. They can generate a random or stable privacy interface identifier for each network, and use temporary addresses for outbound connections. The exam idea is that SLAAC does not always mean EUI-64: EUI-64 is the classic method, but privacy-based identifiers are common on current clients.
SLAAC, stateless DHCPv6, and stateful DHCPv6
SLAAC by itself covers the address. A host may also need DNS servers or a search domain — three models that are often confused:
| Method | Who creates or assigns the address? | What else can the host learn? | Server tracks leases? |
|---|---|---|---|
| SLAAC only | Host, using the RA prefix | DNS from RDNSS in the RA or manual configuration | No |
| SLAAC + stateless DHCPv6 | Host, using the RA prefix | DHCPv6 supplies “other” information (e.g. DNS) | No address lease state |
| Stateful DHCPv6 | DHCPv6 server assigns it | Address plus DNS and other options | Yes |
“Stateless DHCPv6” does not mean DHCPv6 assigned the address — SLAAC created it, while DHCPv6 supplied additional configuration without maintaining an address lease. With stateful DHCPv6, the server assigns and tracks the address, much more like traditional DHCP.
A host still needs a default gateway. In IPv6 that normally comes from the Router Advertisement — typically the router's link-local address — not from DHCPv6.
A SLAAC sequence in plain language
- The host forms a link-local address and checks for duplicates.
- It sends a Router Solicitation.
- The router replies with a Router Advertisement with one or more prefixes.
- A prefix with the autonomous flag set allows SLAAC.
- The host forms a global address from the prefix and an interface identifier.
- It runs Duplicate Address Detection.
- If needed, it requests more information through stateless DHCPv6 or uses RDNSS from the RA.
On the exam
For CCNA (200-301) and Network+ (N10-009), be ready to:
- Compress or expand an IPv6 address
- Identify an address with an illegal double
::used twice - Explain why /64 is normally required for SLAAC
- Describe the FFFE insertion and U/L bit flip in EUI-64
- Distinguish address creation in SLAAC from an assignment in stateful DHCPv6
- State that stateless DHCPv6 provides additional information, not the address
A common exam trick is to offer the longest-looking answer rather than the longest run of consecutive zero groups — count groups, not individual zero characters.
Practical takeaway
Compress in a fixed order: leading zeros first, then the longest run of two or more zero groups becomes :: (a lone zero group stays as 0). For SLAAC, remember prefix from the router, identifier from the host, gateway from the Router Advertisement.
FAQ
Can :: replace only one zero group?
No — not in standard (canonical) IPv6 notation. RFC 5952 §4.2.2 says :: must not shorten just one 16-bit 0 field: a single zero group is written as 0 (2001:db8:0:1:1:1:1:1 is correct, 2001:db8::1:1:1:1:1 is not). RFC 4291 lets parsers accept it, but the canonical form — and what the exams test — needs two or more zero groups in a row. :: still may appear only once in an address.
Does SLAAC require a DHCPv6 server? No. SLAAC works from router advertisements alone. A DHCPv6 server may be added for DNS and other settings, or used statefully to assign addresses, but it is not required.
Why does SLAAC normally need a /64 prefix? The standard interface identifier is 64 bits, so a /64 leaves exactly the other 64 bits for the host portion — which is why SLAAC deployments are designed around /64 subnets.
Ready to prove it?
Reading about IPv6 compression and SLAAC is a start. CertCrack practice exams for CCNA and Network+ test you the way the real exam does — with explanations for every answer.
Try a Free Sample Quiz