← All lessons
IP addressing and subnetting · Lesson 7 of 7

IPv6

IPv6 fixes the shortage for good: addresses are 128 bits, which allows about 3.4 × 10³⁸ of them. Most phone networks and many home connections already use it alongside IPv4.

An IPv6 address is eight groups of four hex digits, separated by colons: 2001:0db8:0000:0000:0000:0000:0000:0001. Two rules make it shorter. Leading zeros in a group can be dropped (0db8 → db8, 0000 → 0). And one run of all-zero groups can be replaced by ::, but only once per address, or you couldn't tell how many groups each one stood for.

import ipaddress
a = ipaddress.ip_address("2001:0db8:0000:0000:0000:0000:0000:0001")
print(a)
print(a.exploded)
Prints
2001:db8::1
2001:0db8:0000:0000:0000:0000:0000:0001

Prefixes work as in IPv4. A normal LAN is almost always a /64: the first 64 bits say the network, and the last 64 are for hosts, enough that devices can pick their own addresses (SLAAC) instead of needing DHCP. A home might be given a /56, room for 256 such networks.

A few addresses to know: ::1 is loopback, like 127.0.0.1. Addresses starting fe80: are link-local, which every IPv6 device has on every link. There's no broadcast in IPv6 (multicast does that job), and ARP is replaced by Neighbor Discovery. With so many addresses, NAT isn't needed; a firewall on the router does the protecting instead.

Practice

How many bits long is an IPv6 address?

More info

Quick reference

IPv6128 bits: eight groups of four hex digits.
ShorteningDrop leading zeros; one run of zero groups → ::.
/64The usual LAN size.
::1Loopback.
fe80::Link-local; every device has one.
Neighbor DiscoveryIPv6's replacement for ARP.

The other networking courses