You’ll be working with IPv4 and IPv6 throughout your networking career. In this video, you’ll learn about the structure of an IPv4 address and an IPv6 address, and you’ll learn how to compress and uncompress IPv6 addresses.
<< Previous Video: Dynamic Routing Protocols Next: Configuring IPv6 >>
These days, TCP/IP is the protocol of choice on our networks, which means all of the devices on your network will be assigned an IP address and it will be a unique number. Here’s an example of one– 192.168.1.165 is just one example of an IP address that may be on a network. The IP address is usually combined with a subnet mask. The subnet mask is used by the local device to determine what IP subnet it happens to live on. The subnet mask is not usually transmitted across the network. It’s something that’s usually used on that local workstation, and if you’ve been tasked with configuring an IP address for a workstation, it’s very common to ask for the IP address that will be assigned and the subnet mask associated with that IP address.
It’s the subnet mask that helps turn the IP address into something more than a simple identifier. The subnet mask allows you to separate out the two pieces of the IP address into a network ID and the host ID, and in the future video, we’re going to show you how to use that subnet mask and the IP address to determine exactly what IP network a device might belong to.
When you start looking at subnet masks and IP addresses and trying to determine the network ID from the host ID, you usually perform a number of calculations in binary. And as we do more subnetting calculations in this video series, you’ll start to see the IP address and the subnet mask represented as a binary value.
If you’re configuring an IP version 4 address, and it might be an address like this one, that is 192.168.1.131, and if we write out this particular address in binary, you’ll see the binary representation just underneath it. This IP version 4 address, then, is four groupings of these 8-bit octets. This is how we represent an IP version 4 address in a binary form. Most often you’re going to see it written in a decimal value. But since we only have 8 bits to work with, the maximum value that this particular address can have in each one of these groups is 255. That means the maximum values that you would ever see in IP would be 255.255.255.255. This IPv4 address is 32 bits long or 4 bytes long, and you’ll become more accustomed to seeing these four octets used to describe the network ID and the host ID of the devices on your network.
IPv6 is an update to IPv4 which greatly expands the capabilities of the IP protocol. One major difference between an IPv4 address and an IPv6 address is the total length. With IP version 4, we were looking at four different octets which totaled 32 bits in size. An IP version 6 address is 128 bits long. This allows us to have many more addresses available for the devices we use these days, with the 6.8 billion people or so on the earth could have this many addresses for each individual person. These large numbers of addresses is where we start to see that IPv6 is a bit more scalable than IPv4.
This is an example of an IPv6 address. You can see it’s represented in hexadecimal, and there are eight different groups of hexadecimal values that make up the 128 bits. If we were to break this entire address out in binary, you would see the binary representation here and the hexadecimal representation is just above it. So you can see that each one of these groups is 16 bits long or two bytes long, which means it’s perfect to be able to represent as a hexadecimal value.
With IP version 4, we almost became accustomed to memorizing the IP address of a device but with IPv6, you can see it might be a little more difficult to memorize all of these addresses. That’s why in IP version 6, you can imagine, the domain name server will become much more important so that you can reference these devices by name rather than having to remember an IP address.
Fortunately, IPv6 does allow us to abbreviate certain kinds of addresses. If there are any of these groups that happen to be all zeros, IPv6 compression allows us to abbreviate those groups with a double colon. We can only use this type of abbreviation one time per IPv6 address. We can also remove any leading zeros. So we can take an address like this one and abbreviate it or compress it in a number of different ways. This address is 2600:DDDD:1111:0001, a bunch of zeros, and then it also ends with 0001. One of the things you can do is remove any leading zeros from any of these particular groups, and if we look at these groups, we can see there are some leading zeros here and there are some leading zeros obviously in the groups that are all zero, and the last grouping has three zeros and a one. We can remove those three zeros which greatly abbreviates or compresses this IPv6 address already.
Another opportunity to compress this address even further is to eliminate any groups of zeros that may be in two or more different consecutive groups. So we can see in this address, we do have three zeros that are consecutive. We can remove all of those zeros and replace them with a double colon. So our final compressed IPv6 address is 2600:DDDD:1111, one, a double colon, and another one. So we were able to take this very long IPv6 address at the top, and compress it down to something that’s a little more manageable when you start working with it on your routers and your switches.
Let’s go through this IPv6 compression process again. We’ll take a different IPv6 address, you can see it listed here. And the first thing that we’d like to do is remove any leading zeros. And if we look at this address, we have a leading zero in the second group. There is a group of zeros, and there are some leading zeros in the last group. So we’ll remove all of those zeros. Notice that we’re removing the leading zeros. We’re not removing any of the trailing zeros. So a grouping such as BE00 remains the same when you perform the compression.
Next we’ll look through the address and see if there are any two or more groups that happen to be consecutive zeros. We have one, two, three different groups that have zeros, so we’ll replace those with a double colon, giving our final IPv6 compressed address of 260:4C3:4002:BE00::66. That is a big difference from the original IPv6 address that we started with at the beginning.
Whenever you start working with your routers, and workstations, and switches, you’ll start to see these abbreviated IPv6 addresses because it’s much easier to be able to write and manage those as you work with these configurations. So you should become accustomed to switching back and forth from a full IPv6 address and it’s compressed version of an IPv6 address.