Fundamentals of IPv6

IPv6 is the replacement for IPv4: it defines the same general functions, packets, addresses and the roles of hosts and routers, with 128-bit addresses instead of 32-bit ones. It came because public IPv4 addresses ran out. Its header is larger but simpler, and most networks move to it slowly, routing IPv4 and IPv6 at the same time: dual stack.

In Daveth Pro (Network)14 min video

By , founder of Daveth · Updated

Opening frame of the video walkthrough of Fundamentals of IPv6

Watch this lesson

14 min · Video walkthrough

In Daveth Pro (Network)

The full 14 min walkthrough is in Daveth Pro (Network). See what the plan opens

What this page answers

What is IPv6?

IP version 6, the replacement for IPv4. The core protocol, RFC 2460, does what IPv4's does: it defines packets, addresses for them, and the roles of hosts and routers, but with far larger addresses. Read it in “More than one protocol”

What is the difference between IPv4 and IPv6?

IPv6 addresses are 128 bits, against IPv4's 32, and its header is larger but simpler, with a required part of 40 bytes, to reduce a router's work per packet. Many related protocols have new versions for IPv6. Read it in “A bigger, simpler header”

What is dual stack?

Routing IPv4 and IPv6 packets at the same time, with some or all routers forwarding both, so a network can migrate to IPv6 slowly instead of switching overnight. Read it in “Both at once”

The ISP's email

Monday, month five, week one. Ravi had asked the ISP for a few more public IPv4 addresses, for next year's growth. The reply arrives at nine: the ISP has no new public IPv4 addresses left to give. It can offer the company an IPv6 prefix instead.

The subject line said "An update on your address request". It was an update, technically.

IP version 6 (IPv6) is the replacement for IP version 4 (IPv4). It defines the same general functions: addresses, subnetting larger groups of addresses into smaller ones, a packet header, and rules for routing packets. The details are different, and the biggest difference is the address: IPv4 uses a 32-bit address, IPv6 a 128-bit one.

The clearest reason for the change is growth. A 32-bit address allows a few billion addresses, which sounds like plenty and turned out to be too few.

IPv6 supplies more than 10,000,000,000,000,000,000,000,000,000 times as many addresses as IPv4. The address is only 4 times as long, but each extra bit doubles the number of addresses, and there are 96 extra bits.

A different address changes much more than IP itself. Routing relies on understanding the addresses, so routers must understand IPv6 addresses and IPv6 routing. Routing protocols that learn routes dynamically must support IPv6's addressing rules, including how IPv6 creates subnets. Moving from IPv4 to IPv6 touches many protocols, not just one.

How IPv4 ran out

04.1 met the organisations involved: IANA assigns blocks of public IPv4 addresses to five Regional Internet Registries (RIRs), which assign smaller blocks to ISPs and companies. Here's the longer story, starting with the growth that used the addresses up:

WhenWhat happened
late 1960sThe ARPANET begins; research at universities drives the growth through the 1970s and 1980s.
late 1980sThe IPv4 address exhaustion problem is already known.
early 1990sCommerce arrives: people sell products and services over the internet, and growth spikes again.
later 1990sThe IPv6 RFCs appear, while short-term tools such as NAT and CIDR put off the need for IPv6.
around 2000Fixed internet access (dial, DSL, cable) becomes common.
around 2010Internet use from mobile devices such as smartphones becomes pervasive.
2011IANA allocates its final /8 blocks (each the size of a Class A network), one to each of the five Regional Internet Registries (RIRs), which still have addresses left to hand out. That same year, APNIC (Asia Pacific) becomes the first RIR to run out.
late 2015ARIN (North America) announces it has run out.
2019IANA considers every RIR except AFRINIC to have run out, and AFRINIC is expected to run out that year.

So the day has come when a new company connecting to the internet can't simply use IPv4 and ignore IPv6. The same wall has now reached this company's ISP.

Those who look after the internet knew about the problem, called the IPv4 address exhaustion problem, from the late 1980s. It could have brought the internet's huge growth in the 1990s to a screeching halt. The IETF came up with several short-term solutions and one long-term one. 04.5 met three of the short-term tools: NAT, private addressing and CIDR. Tools such as NAT and CIDR extended IPv4's life by another couple of decades.

They made the existing public addresses go further; they didn't create new ones. The long-term solution is IPv6: it replaces IPv4, with a new header and new addresses, and its address size should solve the shortage for generations.

And IPv5? There was an earlier effort to create a new version of IP, numbered 5. It never reached the standards stage, but because version 5 had been used in some documents, the next effort was numbered 6 to avoid confusion.

So IPv5 is the version everyone skips, a bit like floor 13 in some hotels. (Where it stops: hotels skip 13 for luck; version 5 was skipped because the number had already been used.)

More than one protocol

The core IPv6 protocol, defined in RFC 2460, does what the core IPv4 protocol (RFC 791) does: it defines packets, addresses for them, and the roles of hosts and routers, so that packets sent by hosts cross several routers and arrive at the right host. But because IPv6 affects so many other functions, many more RFCs define its details. Some describe how to migrate from IPv4 to IPv6. Others define new versions of familiar protocols, or replace old ones.

  • OSPF version 2 → OSPF version 3. The OSPF the company runs is version 2, which works for IPv4 but not for IPv6. OSPF version 3 was created to support IPv6, and was later upgraded to advertise both IPv4 and IPv6 routes.
  • ICMP → ICMP version 6. ICMP worked well with IPv4 but needed changes to support IPv6; the new version is ICMPv6.
  • ARP → Neighbor Discovery Protocol. For IPv4, ARP discovers neighbours' MAC addresses. IPv6 replaces ARP with a more general protocol, NDP.

Almost 300 RFCs have IPv6 in their titles. Used broadly, "IPv6" means that whole family; the one protocol actually called IPv6 is the one that defines the 128-bit address.

Written in binary, 128 bits probably wouldn't even fit across the width of a page. So IPv6 addresses are written in hexadecimal: one hex digit for every 4 bits, at most 32 hex digits, with rules for shortening them. Each of these is an IPv6 address, with 32 or fewer hex digits:

  • 2345:1111:2222:3333:4444:5555:6666:AAAA
  • 2000:1:2:3:4:5:6:A
  • FE80::1

How to read, write and shorten them is the next topic, 06.2. The ISP's prefix is written the same way.

A bigger, simpler header

Like IPv4, IPv6 defines a header with a source address field and a destination address field. It changes more than the address size, though. The IPv6 header is larger than the IPv4 header, but it's simpler, on purpose, to reduce the work a router does each time it routes an IPv6 packet. The required part is 40 bytes:

Network drawing: The required part of the IPv6 header: 40 bytes. The two addresses take 32 of them.

Most of those bytes are the two 16-byte addresses. Three of the smaller fields are worth recognising now:

  • Version says which version of IP this packet is: 6.
  • Next Header says what follows the header: for example, TCP or UDP, or an optional extension header. Options go in extension headers, so the required header carries none of them.
  • Hop Limit is lowered by each router that forwards the packet, and a packet whose limit runs out is discarded, the same job IPv4's time to live (TTL) does (01.6), so a packet caught in a loop can't go round forever.

Hop Limit is the packet's travel budget: a longer address doesn't buy it an unlimited holiday. (Where it stops: a budget can be topped up; no router adds hops back.)

Both at once

A company won't adopt IPv6 by switching off IPv4 late one weekend night and turning IPv6 on everywhere. In most enterprise networks, the routers will route IPv4 and IPv6 packets at the same time, with some or all of them forwarding both, which allows a slow migration. Running both is called dual stack.

Networks have run several stacks before: in the 1980s companies used protocol stacks from different vendors, in the 1990s they added TCP/IP with IPv4 alongside them, and by the 2000s many ran TCP/IP alone. IPv6 has to reach hosts, servers, routers and other devices, so what will likely happen is a long period of coexistence: for a large number of years, most company networks run two stacks again, one IPv4 and one IPv6. One day they may run IPv6 only, with no IPv4 left, but nobody knows how long that will take.