IPv4 and IPv6 are the most popular network protocols in the world. In this video, you’ll learn about the structure of IPv4 and IPv6 addresses, the use of private IP addresses, and automatic addressing features in IPv4 and IPv6.
Whenever you’re configuring the network settings of your computer, you’re going to be adding a network address. And this is usually an IP version 4 address or an IP version 6 address, and in some cases, both of those. In this video, we’re going to give you an overview of IPv4 and IPv6.
IPv4 stands for Internet Protocol version 4. You might hear people refer to this as an OSI Layer 3 address. These addresses are usually four numbers separated with a period. We call this a dot. So 192.168.1.131 is an IP version 4 address. In reality, your computer sees this in binary, so it’s actually interpreting this with these eight bits that make up the 192, these eight bits that make up the 168, here’s the eight bits for the number one, and the eight bits for 131. Those are eight bits for each one of these.
We also sometimes refer to each one of those sections as a byte because eight bits does equal a byte. You might also hear it referred to as an octet, which really means it’s eight individual bits making up that byte.
This means that the IPv4 address is 32 bits in length, or four bytes total. One of the things to keep in mind is that we really only have eight bits to work with here. And if you do the conversion from binary to decimal, then you know that you can have a zero in here, of course. But the maximum number you could ever have for each one of these octets is 255, which is eight ones calculating, and we’re converting that back to decimal is 255. So the largest number that could possibly be in these four octets is 255.255.255.255.
In the world of networking, we skipped IP version 5. It was something that was allocated for another use. So we ended up using IP version 6. Internet Protocol version 6. Instead of the 32-bit address like IPv4, an IPv6 address is 128 bits in length.
This means we can have very large address space for IPv6. You can have up to whatever this big long number is. 340 undecillion addresses. That’s a lot of addresses.
If you look at 6.8 billion people– I guess there’s really over 7 billion people on the Earth now– but when I calculated this, 6.8 billion people can have this many numbers of addresses for each individual person. That’s a five with about 27 zeroes on the end of it. That’s a lot of addresses for a single person. It certainly means we’re not going to run out of IPv6 addresses.
And you’ll notice that the structure of IPv6 is also very different. We usually represent IPv6 addresses in hexadecimal instead of in decimal like we did with IPv4. So it’s very common to see these long hexadecimal addresses that represent the IPv6 address.
If we were to break it out into the binary form, you can see it here. Each one of these addresses is 16 bits long, or two bytes long, or two octets long, depending on how you wanted to represent it. And you can see you have a total of 128 bits, or 16 bytes, that makes up the IPv6 address.
With IPv4, the address is relatively small. We could even tell somebody what the address is. It was very easy to write down and transfer over to another computer. But IPv6 addresses are quite long. So instead of referencing everything with an address, we’re probably going to use the names much more often. So our domain name servers are going to be very important.
We usually separate out an IPv6 address into two different pieces. Generally speaking, the first 64-bits, or the first half of an IPv6 address, is the network address, or the network prefix. The last 64 bits are usually used for the host addresses on that particular network. So whenever you’re looking at an IPv6 address, you can usually separate it right in the middle. On the left side is the network address. On the right side are all of the host IDs.
If we were to write out the entire IPv6 address, they can be quite long. You can see that I’ve written one out with all the zeros and everything that you would see on an IPv6 address right here. Fortunately, there are a number of ways to abbreviate, or compress, the address down to a much smaller size. That makes it a little bit easier for us to manage and deal with in our human minds.
One of the first things you can do is to remove all of the leading zeroes from one of these addresses. So if we were to take this address and remove those leading zeroes, you can see that it becomes a much smaller address. Because I have so many leading zeroes, we got rid of the three leading zeroes in these sections. There’s a couple of leading zeroes next to the a7 and there’s a leading zero on those last two bytes.
We can also compress this even further by abbreviating sections where there are multiple zeroes. So if we have two or more groups of zeroes, we can abbreviate them down by specifying simply a double colon. So you’ve removed this section, this section, and this section, and completely added a double colon to replace that with.
So now we have a much smaller address. Now that we’ve removed the leading zeroes and got rid of those multiple groups of zeroes, we finally have an IPv6 address that is much smaller, or much more compressed, than the original address we see here at the top.
Let’s do that compression again and see if we can really get the hang of this. Here’s an IPv6 address that we have. Again the first step should be to remove the leading zeroes. And we have quite a few leading zeroes. There are some in front of the bb0 here. Of course, all of these have leading zeroes associated with them. This two bytes of 00a0– we can get rid of those first two zeroes. And we can get rid of the three zeroes here in the last two bytes of the address.
Now the next step would be to find a place where there are two or more zeroes next to each other. And we have a group of one, two, three, and four zeroes here that we could remove completely from this address and replace it with a double colon. So now you’ve really got rid of a lot of things right in the middle and compressed the entire address down to be this small. That’s certainly a big difference compared to the original address here at the top.
As you can tell with IP version 6, you can have many, many addresses available. In fact, this is one of the biggest problems with IPv4, is there’s a limited number of addresses that we can use in an IPv4 network. To address the shortage of IP version 4 addresses, we created a set of addresses that can be used privately within an organization that would not be routed over the internet. We call these private addresses, or RFC 1918 addresses, and we came up with three separate ranges that we could use in our organizations, so that we can limit the amount of public addresses that would be used in the world.
These ranges are listed here. This first range we generally call the ten dot network, because the entire range starts with 10.0.0.0 through 10.255.255.255. That means that we have over 16 million total addresses that we can use in that single range of IP addresses. If we were to write this in CIDR block notation, we would call it 10.0.0.0/8.
We’ll talk more about CIDR block notation in the next video. If we were to write this in decimal, the subnet mask would be 255.0.0.0. This means that if we’re using the first eight bits as the network address, that means the last 24 bits can be used for hosts.
The next address is 172.16.0.0 through 172.31.255.255. This is a total of just over a million addresses in use. And if we were to write this out in CIDR block notation, it’s 172.16.0.0/12. That means we have 20 bits available for hosts.
On our smaller addresses, what we tend to see this last private address group very often. It’s 192.168.0.0 through 192.168.255.255. A total of 65,000 addresses. The first 16 bits of this address are used as the network address and the last 16 bits are used as the host size.
If you were to look at the workstation that you’re using at home or at your office, it’s probably going to use one of these three addresses. Your network administrator is performing a network address translation and translating your internal address to a public address that can be used out on the internet. But within your organization, you’re always going to be using these private addresses on your network.
In most environments, your private addresses are assigned automatically to your workstation using a DHCP server. But if a DHCP server is not available, your workstation can still assign itself a private address automatically using APIPA, or Automatic Private IP Addressing.
This is also called a link-local address. That’s because it can be used to communicate on your local connection. But you’re not able to communicate outside of your local network.
In IP version 4, there’s a block of addresses that can be assigned using APIPA. This range is 169.254.0.1 through 169.254.255.254.
What’s interesting about this range, however, is you’re not able to use the first 256 addresses or the last 256 addresses. That means that you will functionally see this block of 169.254.1.0 through 169.254.254.255 being assigned to these addresses on a workstation.
These APIPA addresses are automatically assigned by your workstation. It chooses an address, performs an ARP on your network to see if anybody responds, and if nobody responds, then it uses that address as its local network address. If it does receive a response, then it chooses another address in that block, and tries the ARP again. And it keeps doing that until it finds nobody using that address, and assigns that to your local workstation.
One way to tell if you’ve been assigned an APIPA address is to look to see what the address is on your workstation. For instance, you can see that this device has been given 169.254.228.109. And we know that that range is an APIPA address. Windows even gives you some additional details and tells you that this is an Autoconfiguration IP version 4 address.
In IP version 6, you can also be assigned a link-local address. This would be an automatically assigned address that would only work on your local network. In IP version 4, a link-local address was optional. But in IP version 6, every interface is assigned a link-local address. So you may see multiple IP version 6 addresses assigned to a single physical interface. You’ll notice the link-local address is always going to start with fe80.
Technically, it’s fe80 and using 10 subnet bits, but in reality, it’s an all-zero subnet. So it effectively really becomes fe80 with the last 64 bits available to be assigned to individual workstations.
These last 64 bits are also often calculated using the MAC address of a physical interface. That way this link-local address can be calculated. And because every MAC address should be unique, every link-local address is also going to be unique.