IP Version 6 (IPv6)
IPv4 is the current protocol used for sending data over the internet. The main issue with IPv4 is its limited address space. With the amount of available IPv4 address rapidly shrinking IPv6 overcomes this by introducing 128 bit addresses and a much larger address space to that of IPv4.
1. Changes Introduced by IPv6
- Header formatting
- Extensions and options
- Authentication and privacy
- The addressing changes from the previous IPv4 32bits to IPv6 128bits.
- IPv6 introduces anycast but removes broadcast addresses.
- IPv6 address space equals 340 trillion trillion trillion addresses.
- IPv4 headers contain (at a min) 12 fields which can vary from 30 to 60 bytes in length.
- IPv6 uses a fixed header size of 8 fields and a fixed header length of 40 bytes. This allows for more efficient network routing.
- IPv6 changes the fragmentation principle by enabling fragmentation to be conducted by the source nodes only.
- The checksum field is removed as IPv6 focuses on the routing of packets and leaves the checksum checking to the higher-level protocols such as UDP or TCP.
- IPv4 processes each packet individually at intermediate routers. These routers do not record packet details for future handling or similar packets. IPv6 uses a concept called flow. A flow is a series of packets that require special handling. Such as a stream of real-time video data.
- IPv4 adds options to the end of the IP header, as IPv6 adds them to separate extension headers. Meaning the option header is processed only when the packet contains options.
2. IPv6 Addressing
In IPv4 addressing each address comprises of 4 octets (X.X.X.X). With each octet being 8 bits which can be assigned a value between 0-255 using decimal notation. An IPv6 address is represented via 8 octets. With each octet being 16 bits in length and addressable via 4 Hex characters. For example:
To make the reading of IPv6 addresses easier there are 2 rules that can be applied:
Rule 1 - The first rule is that consecutive zeros can be omitted with a "::". This can though, be done only once. Below is an example:
2a00:1450:8006:0000:0000:0000:0000:93 > 2a00:1450:8006::93
Rule 2 - The second rule permits the removal of leading zeros from within each octet.
2a00:1450:8006:0000:0000:0000:0000:93 > 2a00:1450:8006:0:0:0:0:93
IPv6 subnetting concepts are based on VLSM (Variable Length Subnet Masking) and Classless Inter-Domain Routing methodology.
[global routing prefix][subnet ID][interface ID]
Each address consists of 128 bits. Organisations are often assigned a /48 (48 bit) block of address space. With 48 bits being assigned to the global routing prefix the remaining 80 bits are assigned to either the subnet ID or interface ID bits.
Example : Based on splitting a /48 down into smaller subnets, a total of 65536 64bit subnets could be obtained. This is calculated using the following values:
- 48bits - Global routing prefix
- 16bits - for the subnet ID
- 64bits - Interface ID
Note : It is worth mentioning that IPv6`s auto configuration requires an interface ID of 64 bits. This is because auto configuration assigns a EUI-64 (64-bit) address to the Interface ID. EUI-64 addresses are explained in more depth later on within this article.
4. Address Types
Previous with IPv4 there were 3 types of addresses: Unicast, Multicast and Broadcast. This is where IPv6 differs. With IPv6 there are 3 types of addresses. They are:
- Unicast - One to One
- Multicast - One to Many
- Anycast - One to closest
"Broadcasts" have now been moved into the role of the multicast address type. Any device needing to send multiple packets to multiple devices can now do so by transmitting a multicast packet with the necessary scope ID set.
Unicast addresses are addresses that are associated exclusively to an interface. Just like IPv4 the address can be split into 2 parts; the subnet prefix and the interface ID. The subnet prefix is used to route the packet and the interface ID identifies the network associated with the target IPv6 interface.
Global Addresses are conventional, publicly routable address, just like conventional IPv4 publicly routable addresses.
Link-local Addresses are automatically generated by the client and can be thought of as much the same to previous APIPA (169.254.x.x) addresses within IPv4. Address always begin with FE80 (10bits) followed by 54 bits of zeros. The remaining 64 bits (Interface ID) is then populated with the devices EUI-64 address. The following is an example of a Link-local address : fe80::210:dbff:fe67:f372/64
Nodes use link-local addresses to communicate with neighbour nodes on the same network link. They are also used for Neighbour Discovery protocol transmissions.
Site Local Addresses were previously used to transmit messages to nodes within the same site and were not accessible to nodes on external sites. These addresses have now been excluded from IPv6.
Special Addresses are loopback addresses, IPv4-address mapped spaces, and 6-to-4 addresses for crossing from an IPv4 network to an IPv6 network.
Transition IPv6 addresses - To help with the transition from IPv4 to IPv6 the following addresses are defined:
- IPv4-mapped addresses are IPv4 addresses that have been mapped to an IPv6 addressable format. The address consists of zeros for the first 5 octets, followed by one octet of all ones, then the IPv4 address. An example of an IPv4-mapped address would be 0:0:0:0:0:FFFF:192.168.1.100
- 6to4 addresses allows for the communication between IPv6 nodes over the internet using IPv4. This is achieved by the encapsulation of the IPv6 packet within a IPv4 header. 6to4 addresses consist of 2001::/16 prefix. This is followed by the IPv4 address in hexadecimal notation. For example the IPv4 address 10.20.30.40 would equate to an IPv6 address of 2002:0A14:1E28::/48.
- IPv4-compatible addresses allow for the communication between IPv6 nodes over a IPv4 infrastructure. This is achieved by the encapsulation of the IPv6 packet within a IPv4 header. An example of a IPv4-compatible address is 0:0:0:0:0:0:22.214.171.124.
This allows multiple interfaces to all receive the same packet. Packets sent to a multicast address are sent to all interfaces linked to that address. IPv6 multicast address consist of four fields.
|Indicator||The first 8 bits are always set to all 1`s and defines that this is a multicast packet.||8|
|Flags||Defines whether the multicast type is permanently assigned address.||4|
|Scope ID||Defines the scope of the multicast address group.||4|
|Group ID||Defines a particular group within each scope level.||112|
An anycast address is a single address assigned to multiple nodes. A packet sent to an anycast address is then delivered to the first available node. This is a slick way to provide both load-balancing and automatic failover. The idea of anycast has been around for a long time; it was proposed for inclusion in IPv4 but it never happened.
5. EUI-64 Addresses
EUI-64 addresses are used in the automatic address configuration process. EUI-64 addresses are created by amending the existing host MAC address (48-bits) to form a 64-bit address.
This is achieved via inserting a 16-bit Hex value (0xFFFE) into the middle of the MAC address, then followed by the changing of the 7th bit to a 1.
6. Neighbour Discovery
IPv6 Neighbour Discovery incorporates ARP, ICMP Router Discovery and ICMP redirects.
ND uses 5 informational message types:
- Router Solicitation - Sent by hosts to routers in order to discover the presence and properties of on-link-routers.
- Router Advertisement - Sent by a router to on-link hosts periodically or in response to a RS request from another host.
- Neighbour Solicitation - Used to request the IP address for a certain MAC address.
- Neighbour Advertisement - Used in response to the Neighbour Solicitation to provide the request MAC address.
- Redirect - Used to provide a router of a more efficient route for the routing of their traffic.
7. Interface Modes
IPv6 allows for 2 types of interface Modes; Host mode and Router mode.
Host Mode - When an interface is configured for Host mode, it functions as an IPv6 host. The interface accepts Router Advertisement (RA) messages from other devices and broadcasts Router Solicitation (RS) messages to other devices.
Router Mode - If you configure the interface for Router mode, it functions as an IPv6 router. This allows on-link hosts to perform address auto configuration by sending RS messages to the interface and receiving RA messages in reply. The hosts use the parameters in the RAs to generate IPv6 addresses and to perform other auto configuration tasks.
8. Auto Configuration
One of the main benefits (other than address space) to IPv6 is auto configuration. Auto configuration provides state-less address auto configuration (SLAAC) to your hosts using ICMP6 Router Solicitation and Router Advertisement messages. Depending on the mode type auto configuration works in one of two ways:
Host - Host mode devices send a Router Solicitation message in order to obtain the network prefix from the on-link router. Once it receives the required configuration parameters it uses (along with the EUI-64 address) to auto configure the IP address of the interface.
Router - For a node operating in Router mode, the network prefix (global routing prefix and subnet ID) is set along with the option for auto configuration. Auto configuration then auto completes the (Interface ID) address using the interfaces EUI-64 address.