When I first looked at an IPv6 address I thought it was completely unreadable. Something like 2001:0db8:0000:0000:0000:ff00:0042:8329 doesn't exactly roll off the tongue. But once you understand the rules for simplifying them and why IPv6 exists in the first place, it starts to make a lot more sense.
Why IPv6 Exists - The Expansion Problem
IPv4 uses 32-bit addresses, which gives you a maximum of about 4.3 billion unique addresses. That sounds like a lot until you realize how many devices are connected to the internet today - phones, laptops, smart TVs, IoT sensors, servers, routers. We ran out of IPv4 addresses.
IPv6 uses 128-bit addresses. The number of possible addresses is:
340,282,366,920,938,463,463,374,607,431,768,211,456
That's 340 undecillion addresses. To put it in perspective - there are enough IPv6 addresses to assign billions of addresses to every grain of sand on Earth. We are not running out of these anytime soon.
IPv6 also has other benefits built in - simplified header structure, no need for NAT (every device can have a real public address), and better support for modern networking features. But the address space expansion was the primary driver.
What an IPv6 Address Looks Like
An IPv6 address is 128 bits written as eight groups of four hexadecimal digits, separated by colons:
2001:0db8:0000:0000:0000:ff00:0042:8329
Each group is called a hextet (or sometimes a group or block). Hexadecimal means the digits go from 0-9 and then A-F, so each digit represents 4 bits and each hextet represents 16 bits.
Simplifying IPv6 Addresses - The Two Rules
Full IPv6 addresses are long and hard to read, so there are two rules for shortening them.
Rule 1 - Drop leading zeros in each hextet
Within each hextet you can remove any leading zeros. The hextet still represents the same value.
0db8 becomes db8
0000 becomes 0
0042 becomes 42
ff00 stays ff00 (no leading zeros)
Applying this to our example:
2001:0db8:0000:0000:0000:ff00:0042:8329
becomes
2001:db8:0:0:0:ff00:42:8329
0042 becomes 42, not 4200 becomes 42.Rule 2 - Replace consecutive all-zero hextets with ::
If you have one or more consecutive hextets that are all zeros, you can replace the entire run with a double colon ::.
2001:db8:0:0:0:ff00:42:8329
becomes
2001:db8::ff00:42:8329
The :: replaced the three consecutive zero hextets in the middle.
:: once in an address. If you have two separate runs of zeros you pick the longer one to compress. If they are the same length you compress the first one. Using :: twice would make the address ambiguous - you wouldn't know how many zeros each :: represents.Expanding a Compressed Address
Going the other direction - expanding a compressed address back to full form - is a key exam skill. The process is straightforward:
- Count how many hextets are present in the compressed address
- Subtract from 8 to find how many hextets the
::represents - Replace
::with that many0000hextets - Add back leading zeros to any hextets that need them
Example - expand 2001:db8::ff00:42:8329
Hextets present: 2001, db8, ff00, 42, 8329 = 5 hextets
8 - 5 = 3 hextets missing
:: represents 0000:0000:0000
Full address: 2001:0db8:0000:0000:0000:ff00:0042:8329
Special IPv6 Addresses Worth Knowing
A few addresses come up on the Network+ exam regularly:
::1- Loopback address. Same as 127.0.0.1 in IPv4. Expands to 0000:0000:0000:0000:0000:0000:0000:0001::- Unspecified address. All zeros. Used when a device doesn't have an address yet.fe80::/10- Link-local addresses. Automatically assigned, not routable. Similar to 169.254.x.x in IPv4.ff00::/8- Multicast addresses. Start with FF.2001::/32- Teredo tunneling. Used to carry IPv6 traffic over IPv4 networks.
Quick Reference
Full: 2001:0db8:0000:0000:0000:ff00:0042:8329
Step 1: 2001:db8:0:0:0:ff00:42:8329 (drop leading zeros)
Step 2: 2001:db8::ff00:42:8329 (compress consecutive zeros)
Rules:
- Drop leading zeros per hextet
- Use :: once for longest run of zero hextets
- :: can only appear once per address
Exam Tips
- Practice expanding compressed addresses - the exam will test this
- Remember :: can only be used once
- Know your special addresses - loopback, link-local, multicast
- IPv6 does not use broadcast - it uses multicast instead
- IPv6 header is simpler than IPv4 - fixed length of 40 bytes