IPv6 is the next version of IP after IPv4. It solves the problem of address scarcity that IPv4 suffers from.
There were several design goals for IPv6:
- Support billions of hosts
- Reduce the size of routing tables
- Speed up packet processing
- Improve security
- Support different types of service, e.g. VoIP
- Enable host roaming without changing IP address
- Enable protocol to evolve in future
- Permit both protocols to coexist for long period of time
Despite IPv6 being standardized in 1998, the Internet still mostly uses version IPv4.
The IPv6 main header is simple. IPv6 uses an extensions header system to add extra options, which will be discussed later in this section.
The main header:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| Traffic class | Flow label | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Payload length | Next header | Hop limit | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Source address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Destination address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The Version field is always 6. Routers use this field to determine whether to process packets as IPv4 packets or IPv6 packets.
The Traffic class field describes the class of service, e.g. VoIP.
The Flow label field is used to mark groups of packets as having the same requirements.
The Payload length field specifies the number of bytes that follow the 40 byte header.
The Next header field can specify whether another header follows the current one. If this header is the last IP header, Next header defines which transport protocol is contained in the IP payload.
The Hop limit field is the TTL field renamed. It limits the number of hops a packet can take before it’s dropped.
The Source address and Destination address fields specify the IPv6 address of the source and destination respectively.
Some fields included in the IPv4 header were removed from the IPv6 header:
- Protocol (Next header is used instead).
- Fragmentation fields (IPv6 takes different approach to fragmentation).
- The Checksum field (calculating it reduces performance, and other protocols perform their own checksums anyway).
Extension headers are an approach for adding extra options to an IPv6 header.
There are six kinds of extension headers:
|Hop-by-hop options||Miscellaneous information for routers|
|Destination options||Additional information for the destination|
|Routing||Loose list of routers to visit|
|Fragmentation||Management of datagram fragments|
|Authentication||Verification of the sender’s identity|
|Encrypted security payload||Information about the encrypted contents|
Each header is optional, but if one is present it must appear directly after the fixed header [1, P. 461].
Some headers are a fixed length, others contain a variable number of variable-length options.
For fields that contain variable number of items, each item is encoded as a <Type, Length, Value> tuple. Type is a 1-byte field that specifies the type of option, Length is a 1-byte field that tells how long the value is (up to 255 bytes). Value can be any information required [1, P. 461].
Each extension header includes a Next header field which works the same way as the Next header field in the IP main header, and is used to specify which extension header (if any) comes next.
IPv6 addresses are 128-bits, which gives 3x10^38 possible addresses.
The notation for IPv6 address is eight groups of four hexadecimal digits separated by colons:
Leading zeroes in a group can be omitted, and one or more groups of zeros can be replaced by two colons:
-  A. Tanenbaum and D. Wetherall, Computer Networks, 5th ed. 2011.
-  B. Hinden and D. S. E. Deering, “Internet Protocol, Version 6 (IPv6) Specification,” no. 2460. RFC Editor, Dec-1998.