week06-05_IPv6
IPv6
Table of Contents
IPv6 address and subnetting
Here's the hard truth. The IANA is out of IP addresses. When IPv4 was first developed, a 32-bit number was chosen to represent the address for a node on a network. The Internet was in its infancy, and no one really expected it to explode in popularity the way it has. 32-bits were chosen, but it's just not enough space for the number of Internet connected devices we have in the world. IPv6 was developed exactly because of this issue.
By the mid 1990s, it was more and more obvious that we were going to run out of IPv4 address space at some point, so a new Internet Protocol was developed. Internet Protocol version 6, or IPv6. You might wonder what happened to version 5, or IPv5. It's actually a fun bit of trivia.
IPv5 was an experimental protocol that introduced the concept of connections.
It never really saw wide adoption, and connection state was handled better later on by the transport layer and TCP. Even though IPv5 is mostly a relic of history, when development of IPv6 started, the consensus was to not reuse the IPv5 name. The biggest difference between IPv4 and IPv6 is the number of bits reserved for an address, while IPv4 addresses are 32 bits, meaning there can be around 4.2 billion individual addresses. IPv6 addresses are 128 bits in size. This size difference is staggering, once you do the math. Don't worry, we won't make you.
2 to the power of 128 would produce a 39 digit long number. That number range has a name you've probably never even heard of, an Undecillion. An Undecillion isn't a number you hear a lot, because it's ginormous. There really aren't things that exist at that scale. Some guesses on the total number of atoms that make up the entire planet Earth and every single thing on it get into that number range. That should tell you we're talking about a very, very large number. If we can give every atom on Earth its own IP address, we'll probably be okay when it comes to network devices for a very long time. Just for fun, let's look at what that number actually looks like. It looks like this.
Just like how an IPv4 address is really just a 32-bit binary number, IPv6 addresses are really just a hundred 28-bit binary numbers. IPv4 addresses are written out in four octets of decimal numbers, just to make them a little more readable for humans. But trying to do the same for an IPv6 address just wouldn't work. Instead, IPv6 addresses are usually written out as 8 groups of 16-bits each. Each one of these groups is further made up of four hexadecimal numbers. A full IPv6 address might look something like this.
That's still way too long, so IPv6 has a notation method that lets us break that down even more.
A way to show how many IPv6 addresses there are is by looking at our example IP. Every single IPv6 address that begins with 2001:0db8 has been reserved for documentation, in education, or for books and courses, just like this one.
That's over 18 quintillion addresses, much larger than the entire IPv4 address space reserved just for this purpose.
There are two rules when it comes to shortening an IPv6 address.
- The first is that you can remove any leading zeros from a group.
- The second is that any number of consecutive groups composed of just zeros can be replaced with two colons. I should call out that this can only happen once for any specific address. Otherwise, you couldn't know exactly how many zeros were replaced by the double colons.
For this IP, we could apply the first rule, and remove all leading zeros from each group. This would leave us with this.
Once we apply the second rule, which is to replace consecutive sections containing just zeros with two colons, we'll end up with this.
This still isn't as readable as an IPv4 address, but it's a good system that helps reduce the length a little bit. We can see this approach taken to the extreme with IPv6 loopback address. You might remember that with IPv4, this address is 127.0.0.1. With IPv6, the loopback address is 31 0s with a 1 at the end, which can be condensed all the way down to just ::1.
The IPv6 address space has several other reserved address ranges, besides just the one reserved for documentation purposes, or the loopback address. For example, any address that begins with FF00:: is used for multicast, which is a way of addressing groups of hosts all at once. It's also good to know that addresses beginning with FE80:: are used for link-local unitcast. Link-local unicast addresses allow for local network segment communications, and are configured based upon a host's MAC address.
The link-local address are used by an IPv6 hosts to receive their network configuration, which is a lot like how DHCP works. The host's MAC address is run through an algorithm to turn it from a 48-bit number into a unique 64-bit number. It's then inserted into the addresses host ID. The IPv6 address space is so huge, there was never any need to think about splitting it up into address classes like we used to do with IPv4.
From the very beginning, an IPv6 address had a very simple line between network ID and host ID. The first 64-bits of any IPv6 address is the network ID, and the second 64-bits of any IPv6 address is the host ID.
This means that any given IPv6 network has space for over 9 quintillion hosts. Still, sometimes network engineers might want to split up their network for administrative purposes. IPv6 subnetting uses the same CIDR notation that you're already familiar with. This is used to define a subnet mask against the network ID portion of an IPv6 address.
IPv6 Headers
When IPv6 was being developed, they took the time to introduce a few improvements instead of just figuring out a way to increase the address size. This should come as a relief to you, and IT support specialists love networks that perform well.
One of the most elegant improvements was made to the IPv6 header, which is much simpler than the IPv4 one.
The first field in an IPv6 header is the
Version Field: This is a 4-bit field that defines what version of IP is in use. You might remember that an IPv4 header begins with this exact same field.
Traffic Class Field: This is an 8-bit field that defines the type of traffic contained within the IP datagram and allows for different classes of traffic to receive different priorities. The next field is the flow label field.
Flow Label Field: This is a 20-bit field that's used in conjunction with the traffic class field for routers to make decisions about the quality of service level for a specific datagram.
Payload length field: This is a 16-bit field that defines how long the data payload section of the datagram is.
Next header field: This is a unique concept to IPv6, and needs a little extra explanation.
IPv6 addresses are four times as long as IPv4 addresses. That means they have more ones and zeros, which means that they take longer to transmit across a link. To help reduce the problems with additional data that IPv6 addresses impose on the network, the IPv6 header was built to be as short as possible. One way to do that is to take all of the optional fields and abstract them away from the IPv6 header itself.The next header field defines what kind of header is immediately after this current one. These additional headers are optional, so they're not required for a complete IPv6 datagram. Each of these additional optional headers contain a next header field and allow for a chain of headers to be formed if there's a lot of optional configuration.
Hop limit field: This is an 8-bit field that's identical in purpose to the TTL field in an IPv4 header.
Finally, we have the source and destination address fields, which are each a 128 bits. If the next header field specified another header, it would follow at this time. If not, a data payload the same length as specified in the payload length field would follow.
IPv6 and IPv4 Harmony
It's just not possible for the entire Internet and all connected networks to switch to IPv6 all at once. There would be way too much coordination at play. Too many old devices that might not even know how to speak IPv6 at all, still requiring connections. So the only way IPv6 will ever take hold is to develop a way for IPv6 and IPv4 traffic to coexist at the same time. This would let individual organizations make the transition when they can.
One example of how this can work is with what's known as IPv4 mapped address space. The IPv6 specifications have set aside a number of addresses that can be directly correlated to an IPv4 address. Any IPv6 address that begins with 80 zeros, and is then followed by 16 ones is understood to be part of the IPv4 mapped address space. The remaining 32 bits of the IPv6 address is just the same 32 bits of the IPv4 address it's meant to represent.
This gives us a way for IPv4 traffic to travel over an IPv6 network. But probably more important is for IPv6 traffic to have a way to travel over IPv4 networks. It's easier for an individual organization to make the move to IPv6 than it is for the networks at the core of the Internet to. So while IPv6 adoption becomes more widespread, it'll need a way to travel over the old IPv4 remnants of the Internet backbone.
The primary way this is achieve today is through IPv6 tunnels. IPv6 tunnels are conceptually pretty simple. They consist of IPv6 tunnels servers on either end of a connection. These IPv6 tunnel servers take incoming IPv6 traffic and encapsulate it within traditional IPv4 datagrams. This is then delivered across the IPv4 Internet space where it's received by another IPv6 tunnel server. That server performs the de-encapsulation and passes the IPv6 traffic further along in the network.
Along with IPv6 tunnel technologies, the concept of an IPv6 tunnel broker has also emerged. These are companies that provide IPv6 tunneling endpoints for you, so you don't have to introduce additional equipment to your network.
There are a lot of competing protocols to be used for these kinds of IPv6 tunnels. Since this is still a new and evolving space, it's not clear who the winner will be.There are some links to read about the main competitors.
The future of networking is the adoption of IPv6 as the main protocol at the network layer, and one day we won't need any tunnels at all. The future is limitless, and tunnelless, or something like that.
Supplemental Reading for IPv6 and IPv4 Harmony
While IPv6 adoption becomes more widespread, it'll need a way to travel over the old IPv4 remnants of the Internet backbone. The primary way this is achieved today is through IPv6 tunnels. IPv6 tunnels are conceptually pretty simple. They consist of IPv6 tunnel servers on either end of a connection. These IPv6 tunnel servers take incoming IPv6 traffic and encapsulate it within traditional IPv4 datagrams. This is then delivered across the IPv4 Internet space where it's received by another IPv6 tunnel server. That server performs the de-encapsulation and passes the IPv6 traffic further along in the network.
There are a lot of competing protocols to be used for these kinds of IPv6 tunnels. Since this is still a new and evolving space, it's not clear who the winner will be. Some of the main competitors are 6in4, Tunnel Setup Protocol, and Anything in Anything (AYIYA).
Practice Quiz
- An IPv6 address is how many bits long?
- 16
- 32
- 64
- 128
- The very first field in an IPv6 header is the _______.
- version field
- traffic class field
- source address field
- data payload field
This field is used to indicate what version of IP is being used.
- The IPv6 header field that indicates how many routers can forward a packet before it's discarded is called the ________.
- hop limit field
- TTL
- router forward field
- next header field
The hop limit field configures how many routers can try to forward a packet before it's discarded.
References:
https://coursera.org/learn/computer-networking/lecture/MOcQY/ipv6-addressing-and-subnetting
https://www.coursera.org/learn/computer-networking/lecture/lR0Wf/ipv6-headers
https://www.coursera.org/learn/computer-networking/lecture/sleYt/ipv6-and-ipv4-harmony