IPv4 uses a 32-bit address space, which allows for approximately 4.29 billion unique addresses. This number seemed enough during the early days of the internet, but the growth of internet-connected devices such as smartphones, IoT devices and industrial systems has led to IPv4 exhaustion.
IPv6 uses a 128-bit address space, which provides about 340 undecillion addresses. A big number, capable of assigning billions of addresses to every person on Earth. There are 340,282,366,920,938,463,463,374,607,431,768,211,456 (ca. 340 undecillion) possible IPv6 addresses.
IPv6 has a few types of addresses, each designed for specific use cases:
Global Unicast addresses are used to uniquely identify a specific interface on a host and can be used as a public address on the internet.
Address Range: 2000::/3 to 3FFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF/3
Unique local Unicast addresses are roughly the same as private IPv4 addresses.
Address Range: FC00::/7 to FDFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF/7
Link-local addresses are unicast addresses that are limited to a point to point connection within a local network. Routers will not forward packets with a link-local address.
Address Range: FE80::/10 to FEBF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF/10
Multicast addresses are used to send a single packet to multiple destinations simultaneously.
Address Range: FF00:0000:0000:0000:0000:0000:0000:0000/8 to FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF/8
Loopback Address is all 0, except for the last bit, which is 1. It would be typed as ::1. It operates the same as the IPv4 127.0.0.1 loopback address.
Loopback Address is all 0’s except for the last bit, which is 1. It would be typed as "::1". It operates the same as the IPv4 127.0.0.1 loopback address.
Unspecified address is an all 0 address and cannot be assigned to an interface. It would be typed as "::". This is only used as a source address to indicate the absence of an actual address, it is a placeholder.
IPv6 addresses can be shortened:
2001:0db8:0000:0000:0000:8a2e:0370:7334
--->
2001:db8::8a2e:370:7334
Here are the rules for this:
Remove leading zeros in each block: In an IPv6 address, leading zeros are removed in each of the 8 blocks (each containing 4 hexadecimal digits). For example, "0042" becomes "42".
Replace contiguous zero blocks with "::" A sequence of consecutive blocks that are all 0000 may only be replaced with "::" once in the address. 0:0:0:0 becomes "::".
Example: 2001:0db8:0000:0000:0000:0000:0000:0001 ---> 2001:db8::1
This can happen ONLY once per address and needs to happen as soon as possible:
2001:db8::1:0:0:1 ---> Right.
2001:db8:0:0:1::1 ---> Wrong.
If the shortened block is only one (0000), it can not be shortened with "::". "::" is only for more than one block! Instead, one block with 0 only is shortened to only one 0:
2001:db8:0:1:1:1:1:1 ---> Right.
2001:db8::1:1:1:1:1 ---> Wrong.