Course contents

Unit 5: IP Addressing BasicsLesson 5.5 (5 of 6 in this unit)45 of 104 in the Network Fundamentals course

IPv6 Addressing Basics

IPv4 has run out of addresses, so the internet is moving to IPv6. This lesson shows what an IPv6 address looks like, how to read and shorten it without mistakes, what the /64 and /48 prefixes mean, and how IPv6 runs side by side with IPv4.

Beginner · 15 min read · Before this: What is an IP address?, Subnet mask basics

Covers Why IPv6 exists, 128 bits and hextets, Hex refresher, Shortening rules, Prefixes /48 /56 /64, Interface ID and Dual stack.

Technical definition

IPv6 (Internet Protocol version 6) is the successor to IPv4. It uses 128-bit addresses written as eight groups of four hexadecimal digits separated by colons, divided into a network prefix (normally /64 on a LAN) and an interface ID.

What is IPv6?

Why does one laptop show an address such as 192.168.10.25 and another such as 2001:db8:10::25? They belong to different versions of IP. Let's read the longer address in small pieces before trying to configure it. The 2001:db8::/32 range used here is reserved for documentation, so these examples do not identify real internet hosts.

IPv6 (Internet Protocol version 6) is the newer version of the Internet Protocol. It does the same job as IPv4: it gives every device an address and carries packets from one network to another. The big change is the size of the address. An IPv4 address is 32 bits long. An IPv6 address is 128 bits long. If you have not met IP addresses before, start with What is an IP address?.

IPv4 is a bit like a phone system with short numbers that has run out of numbers. IPv6 is the same phone system with a much larger numbering plan. The address space is vastly larger, but its practical benefit comes from structured allocation and routing, not just long numbers. The addresses look difficult until you learn how to read and shorten them.

Why IPv6 exists

32 bits give about 4.3 billion IPv4 addresses. That sounded huge in the 1980s. Today, there are many more phones, laptops, servers, cameras and smart devices than that. The regional registries that hand out addresses have faced IPv4 exhaustion at different times; allocation policies and remaining pools vary by region.

The internet kept growing by using workarounds. The main one is NAT (Network Address Translation): a home or office uses private addresses inside, and a router replaces them with one shared public address on the way out. Some providers even add a second layer of NAT, called carrier-grade NAT. These workarounds work, but they have a cost:

  • Devices on the internet cannot start a connection to a device behind NAT without extra rules, such as port forwarding.
  • Games, voice calls and peer-to-peer apps need special techniques to get through NAT.
  • The NAT router must track every connection, which uses memory and makes problems harder to troubleshoot.
  • Public IPv4 addresses are now bought and sold, and they are expensive.

IPv6 fixes the root problem by making the address space so large that every device can have its own globally unique address again. 2128 is about 340 undecillion, a number with 39 digits.

IPv4 and IPv6 side by side

IPv4IPv6
Length32 bits128 bits
Written as4 decimal numbers with dots8 hex groups with colons
Example192.168.1.102001:db8:10:1::10
Total addressesAbout 4.3 billionAbout 340 undecillion (3.4 × 10³⁸)
Mask style255.255.255.0 or /24Prefix length only, e.g. /64
Typical LAN size/24 (254 hosts)/64 (about 18 quintillion addresses)
BroadcastYesNo (multicast instead)
Needs NAT to save addressesUsuallyNo

A quick hex refresher

IPv6 addresses are written in hexadecimal (hex), which is base 16. Normal decimal numbers use 10 digits, 0 to 9. Hex needs 16 digits, so after 9 it uses letters: a=10, b=11 and so on, up to f=15. Upper and lower case mean the same thing, but lower case is the standard way to write IPv6 addresses.

The useful fact is that one hex digit is exactly 4 bits, because 4 bits can hold 16 values (0000 to 1111). So you can convert hex into binary one digit at a time, without any calculation.

HexDecimalBinary (4 bits)
000000
110001
220010
770111
991001
a101010
b111011
c121100
d131101
e141110
f151111

For example, the hex group 0db8 is the four digits 0, d, b and 8. In binary, that is 0000 1101 1011 1000, which is 16 bits.

The structure: 8 hextets of 16 bits

An IPv6 address is split into 8 groups, separated by colons. Each group has 4 hex digits. 4 digits × 4 bits = 16 bits per group, and 8 groups × 16 bits = 128 bits. One group is called a hextet (like an “octet” in IPv4, but 16 bits instead of 8).

Hextet12345678
Value20010db8abcd00100000000000000025
Bits0–1516–3132–4748–6364–7980–9596–111112–127

Written out in full, that is 2001:0db8:abcd:0010:0000:0000:0000:0025. This is long and easy to mistype, so IPv6 has two rules for shortening it.

The two shortening rules

Rule 1: drop leading zeros in each group

Inside any group, you may remove zeros at the start (the left). You may never remove zeros at the end, because they carry value, just as 50 is not the same as 5.

  • 0db8 → db8
  • 0010 → 10
  • 0025 → 25
  • 0000 → 0 (a group always keeps at least one digit)
  • ff00 → stays ff00 (the zeros are at the end)

After rule 1: 2001:db8:abcd:10:0:0:0:25

Rule 2: replace one run of zero groups with ::

A run of groups that are all zero (two or more in a row) can be replaced by a double colon ::. Choose the longest run. If two runs are the same length, use the first one.

After rule 2: 2001:db8:abcd:10::25

Why only once? When someone reads an address with ::, they work out how many zero groups it hides by counting the groups they can see and filling the rest up to 8. With one :: there is only one answer. With two, for example 2001:db8::1::5, the 4 hidden zero groups could be split 1+3, 2+2 or 3+1, which are three different addresses. So two :: in one address is invalid.

Shorten your own address

Type any IPv6 address below, in full or shortened form. The tool expands it to 8 full groups and then applies rule 1 and rule 2 one at a time, so you can see exactly what each rule does.

1Expand to the full form: 8 groups of 4 hex digits

2001
0db8
0000
0000
0000
ff00
0042
8329
first 64 bits: network prefix (on a /64)last 64 bits: interface ID

2001:0db8:0000:0000:0000:ff00:0042:8329

2Rule 1: drop the leading zeros in each group

2001
db8
0
0
0
ff00
42
8329

2001:db8:0:0:0:ff00:42:8329

Only zeros on the left of a group can go. 0db8 becomes db8, but ff00 stays ff00.

3Rule 2: replace the longest run of zero groups with :: (once)

2001
db8
0
0
0
ff00
42
8329

Groups 3 to 5 (3 zero groups) become ::. Any other zero group stays as a single 0.

Shortest correct form

2001:db8::ff00:42:8329

Try the presets, or type your own. Expanding is the same steps in reverse: count the groups you can see, fill the :: with enough 0000 groups to make 8, then pad each group back to 4 digits.

Worked example: compressing

Shorten 2001:0db8:0000:0000:0001:0000:0000:0001.

Diagram
Process, step by step
Start
2001:0db8:0000:0000:0001:0000:0000:0001
Rule 1: drop leading zeros
2001:db8:0:0:1:0:0:1
Find the zero runs
Two runs, each 2 groups long (groups 3–4 and 6–7). It's a tie.
Rule 2: use :: on the first run
2001:db8::1:0:0:1

Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.

When there is a tie, the first run gets the ::. The other run stays as 0:0.

2001:db8:0:0:1::1 is also valid and means the same address. However, the standard form (RFC 5952, the rule book for writing IPv6 addresses as text) says to choose the first run when there is a tie. Tools and logs follow this rule, so learning it helps you match what you see on screen.

Worked example: expanding

Expand 2001:db8:5::a:1 back to the full form.

Diagram
Process, step by step
Count the groups you can see
2001, db8 and 5 on the left; a and 1 on the right. That's 5 groups.
Work out what :: hides
8 − 5 = 3 zero groups.
Write them in
2001:db8:5:0:0:0:a:1
Pad every group to 4 digits
2001:0db8:0005:0000:0000:0000:000a:0001

Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.

Expanding means applying the shortening rules in reverse.

Two more quick ones to test yourself:

Diagram
Worked example: expanding
Worked example: expanding
Short formFull form
::10000:0000:0000:0000:0000:0000:0000:0001
fe80::1fe80:0000:0000:0000:0000:0000:0000:0001
2001:db8::2001:0db8:0000:0000:0000:0000:0000:0000
Each item on the left, with what it means on the right.

Prefix notation: /64, /48, /56

IPv6 has no dotted subnet mask like 255.255.255.0. It uses only the prefix length: a slash followed by the number of bits that belong to the network. You already know this idea from Subnet mask basics: in IPv4, /24 means the first 24 bits are the network.

2001:db8:abcd:10::25/64 means that the first 64 bits (the first 4 hextets, 2001:db8:abcd:10) are the network, and the rest identify this one interface. The network itself is written with the host part set to zero: 2001:db8:abcd:10::/64.

Shortcut: every hextet is 16 bits, so /16, /32, /48 and /64 end exactly at a colon: /48 is the first 3 hextets and /64 is the first 4. A /56 ends in the middle of the 4th hextet (after its first 2 hex digits).

Network part and interface ID

Diagram
Read an IPv6 address without guessing the boundary
Read an IPv6 address without guessing the boundary
Read an IPv6 address without guessing the boundaryThe IPv6 address 2001:db8:10::25/64 expands to eight groups of four hexadecimal digits. In this /64 example, the first four groups form the 64-bit subnet prefix and the last four form the interface identifier.2001:db8:10::25/6420010db800100000000000000000002564-bit subnet prefix64-bit interface identifierEach group: 4 hexadecimal digits × 4 bits = 16 bits; 8 groups = 128 bits

On small screens, swipe sideways or focus the diagram and use the arrow keys.

A /64 example using the documentation prefix 2001:db8::/32. The double colon compresses zero groups; it does not set the subnet boundary.

Read the /64 before dividing the address. Each full group contains 16 bits, so the first four groups make up the 64-bit subnet prefix in this example. The remaining four groups identify the interface within that subnet. A hextet is simply one of those 16-bit groups, written with hexadecimal digits: 0–9 and a–f.

The double colon is only a writing shortcut for consecutive zero groups; the prefix length sets the network boundary. Expand the address if you are unsure, then use the prefix length to find the boundary. In ordinary SLAAC Ethernet LANs, /64 supports automatic address formation; other prefix lengths exist for other purposes. A shorter-looking address is not a smaller address: the complete value still contains 128 bits.

On almost every IPv6 LAN, the 128 bits are split exactly in half:

  • The network prefix (first 64 bits): the same for every device on that subnet. It is set by the router or the network administrator.
  • The interface ID (last 64 bits): unique for each device on the subnet. It plays the role of the “host part” in IPv4. Devices can even create it themselves, as the next lesson shows.

Learn more: IPv6 Address Types and Autoconfiguration

How addresses are handed out

IPv6 blocks are handed down in layers. Each layer takes a large block and divides it into smaller ones for the next layer:

Diagram
Path, step by step
ISP
2001:db8::/32
Customer site
2001:db8:abcd::/48
Subnet (one VLAN)
2001:db8:abcd:10::/64
One interface
2001:db8:abcd:10::25

Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.

Provider → site → subnet → device. Each step fixes more bits.

Here is the same address, drawn as its 128 bits in rows of 32:

Provider block from the registry to the ISP: 2001:0db832 bits/32
Site part chosen by the ISP: abcd16 bits→ /48
Subnet ID chosen by you: 001016 bits→ /64
Interface ID (first half): 0000:000032 bits
Interface ID (second half): 0000:002532 bits

Read each row from left to right. The ruler gives bit positions 0–31 within that row; field sizes are labelled in bits or bytes.

2001:db8:abcd:10::25/64 split into its parts. The subnet ID is the 16 bits that a site uses to number its own LANs.

How many /64 subnets fit in a /48?

A /48 fixes 48 bits, and a subnet is a /64. You can use the 16 bits between them (64 − 48) to number your subnets. 216 = 65,536 subnets. In practice, that is the 4th hextet, which can go from 0000 to ffff.

Diagram
How many /64 subnets fit in a /48?
How many /64 subnets fit in a /48?
Subnet IDSubnetCould be used for
00102001:db8:abcd:10::/64VLAN 10, staff PCs
00202001:db8:abcd:20::/64VLAN 20, phones
00302001:db8:abcd:30::/64VLAN 30, servers
ffff2001:db8:abcd:ffff::/64The last of the 65,536
Read each row across: the left box names the item, the others describe it.

Many administrators match the subnet ID to the VLAN number, as above, so the address itself tells you which VLAN a device is on.

/32 · Internet provider (ISP)

A typical block that a regional registry gives a provider. Example: 2001:db8::/32.

Holds: 65,536 /48s

/48 · One customer site

A company office or campus. Example: 2001:db8:abcd::/48.

Holds: 65,536 /64s

/56 · One home

Many providers give homes a /56 instead of a /48. Example: 2001:db8:abcd:ab00::/56.

Holds: 256 /64s

/64 · One subnet (one LAN or VLAN)

The standard size for a network with hosts on it. Example: 2001:db8:abcd:10::/64.

Holds: 2⁶⁴ addresses

To split a prefix yourself, use the IPv6 Subnet Calculator. It shows the network, the address range and the number of subnets for any prefix.

No broadcast in IPv6

IPv4 has a broadcast address in every subnet (for example, 192.168.1.255) that reaches every device, whether the message is relevant to it or not. IPv6 has no broadcast at all. It uses multicast instead: a message is sent to a group address, and only devices that have joined that group listen. This means less unnecessary traffic for every device on the LAN.

One useful side effect: because there is no broadcast address, IPv6 has no “minus two” rule when you count usable addresses. (The all-zeros interface ID is reserved for routers, but in a /64 with 264 addresses that makes no practical difference.)

Dual stack: IPv4 and IPv6 together

The internet cannot switch to IPv6 overnight. Most networks today run dual stack: every device and router runs IPv4 and IPv6 at the same time, with an address of each kind. When your browser looks up a website in DNS, it asks for both an IPv4 address (an A record) and an IPv6 address (an AAAA record). If both exist, modern systems usually try IPv6 first and quickly fall back to IPv4 if IPv6 is slow or fails.

Diagram
Process, step by step
The browser looks up www.example.com
It gets an A record (IPv4) and an AAAA record (IPv6).
It tries IPv6 first
If the IPv6 connection works quickly, it is used.
It falls back to IPv4 if needed
If IPv6 is broken or slow, IPv4 is used. The user usually doesn't notice.

Read in arrow direction. Labels describe each stage or hop; connectors show the sequence, not a complete physical cabling plan or time to scale.

Dual stack: both protocols run side by side. The host uses IPv6 when the destination supports it and it works, and IPv4 otherwise.

Seeing your IPv6 address

On Windows, ipconfig shows the IPv6 lines next to the IPv4 ones:

Example output from a Windows PC, shortened and written for this lesson
C:\> ipconfig
Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : home.arpa
   IPv6 Address. . . . . . . . . . . : 2001:db8:abcd:10::25
   Link-local IPv6 Address . . . . . : fe80::5d2e:8a41:c07b:19f3%12
   IPv4 Address. . . . . . . . . . . : 192.168.10.25
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : fe80::1%12
                                       192.168.10.1
What to look for: IPv6 Address and IPv4 Address both appear, so this PC is dual stack. The fe80:: lines are link-local addresses, and %12 is Windows' number for this network card. Both are explained in the next lesson.

On Linux, use ip -6 -brief address for a one-line summary per interface:

Example output from a Linux PC, written for this lesson
$ ip -6 -brief address
lo               UNKNOWN        ::1/128
eth0             UP             2001:db8:abcd:10::25/64 fe80::1c2a:3bff:fe4d:5e6f/64
What to look for: eth0 is UP and has a global address (2001:db8:abcd:10::25) and a link-local address (fe80::…). The /64 after each address is the prefix length: the first 4 hextets are the network.

When it goes wrong

Diagram
When it goes wrong
When it goes wrong
SymptomLikely causeWhat to check
The device shows only an fe80:: addressNo router is advertising an IPv6 prefix on this LANThe router's IPv6 settings; see the next lesson on autoconfiguration
A configuration is rejected as “invalid address”:: used twice, or a group with 5 digitsExpand the address by hand to 8 groups of 4 digits
Two devices on one LAN can't reach each other over IPv6They were given different prefixes or different prefix lengthsCompare the first 4 hextets and the prefix length
Websites are slow to start loading, then workIPv6 is partly broken; the browser waits, then falls back to IPv4ping -6 a known IPv6 host and check the provider's IPv6 status
Read each row across: the left box names the item, the others describe it.

Shortening and prefix errors

  • Removing zeros from the end of a group. ff00 is not ff; only leading zeros can be removed.
  • Using :: twice. The address becomes ambiguous, so it is invalid.
  • Forgetting the hidden groups when expanding. Always count them: the total must be 8 groups.
  • Carrying over IPv4 habits, such as giving a LAN a /120 to “save addresses”. LANs with hosts should be /64, or automatic addressing (SLAAC) will not work.
  • Thinking IPv6 has a broadcast address. It has none; it uses multicast instead.
  • Using real addresses in documentation and labs. They may belong to someone else. Use 2001:db8::/32, which is reserved for examples.
IPv6 notation, briefly
  • IPv6 exists because IPv4's 4.3 billion addresses have run out; NAT is only a workaround.
  • An IPv6 address is 128 bits: 8 hextets of 4 hex digits, separated by colons.
  • Shorten with two rules: drop leading zeros, and replace the longest run of zero groups with :: (only once).
  • Prefixes are written as /length. A LAN is a /64, a site usually gets a /48 and a home often gets a /56.
  • IPv6 has no broadcast. Most networks run dual stack: IPv4 and IPv6 together.

Practise reading IPv6 addresses

Predict · scenario 1

You need to type 2001:0db8:0000:0000:0000:0000:0000:0100 into a router. What is its shortest correct form?

Predict · scenario 2

A router rejects the address 2001:db8::5::1. Why is it not valid?

Predict · scenario 3

Your company receives 2001:db8:abcd::/48. How many /64 subnets can you make?

Predict · scenario 4

A server has the address 2001:db8:abcd:10::25/64. Which part is the interface ID?

Predict · scenario 5

A PC on a dual-stack network opens a website that has both A and AAAA records. What usually happens?

Next, learn what each type of IPv6 address does (link-local, multicast and more) and how devices give themselves an address.

Learn more: IPv6 Address Types and Autoconfiguration

FAQ

Why are IPv6 addresses written in hexadecimal?
Because they are long. Written in dotted decimal, 128 bits would need 16 numbers. In hexadecimal, one digit holds exactly 4 bits, so the whole address fits in 32 digits, and the shortening rules often make it much shorter.
Can I use :: twice in the same address?
No. :: means "as many zero groups as needed to make 8". If it appeared twice, nobody could tell how many zero groups belong to each one, so the address would be ambiguous. Use it once, for the longest run of zero groups.
Is 2001:db8:: a real address I can use?
No. 2001:db8::/32 is reserved for documentation, books and lessons like this one, in the same way that 192.0.2.0/24 is in IPv4. It is never routed on the internet.
Why is every IPv6 LAN a /64 when that wastes so many addresses?
IPv6 has so many addresses that saving them inside a LAN no longer matters. A fixed /64 keeps network design simple. It also lets devices build their own 64-bit interface ID automatically (SLAAC), which needs exactly 64 bits of room.
Do I still need IPv4 if I have IPv6?
For now, yes. Many websites and services are still IPv4-only, so most networks run dual stack. Devices have both an IPv4 and an IPv6 address and use whichever one the destination supports (usually preferring IPv6).