IP address classes and structure

IP address classes and structure

When the IEEE committee sat down to sort out the range of numbers that were going to be used by all computers, they came up with five different ranges or, as we call them, “classes” of IP addresses. When someone applies for IP addresses they are given a certain range within a specific class depending on the size of their network. To keep things as simple as possible, let’s first have a look at the five different classes:

ip1
In the above table, you can see the five classes. Our first class is A and our last is E. The first three classes (A, B and C) are used to identify workstations, routers, switches and other devices, whereas the last two classes (D and E) are reserved for special use.

An IP address consists of 32 Bits, which means it’s four Bytes long. The first octet (first eight bits or first byte) of an IP address is enough for us to determine the class to which it belongs. And, depending on the class to which the IP address belongs, we can determine which portion of the IP address is the network ID and which is the node ID.

For example, if I told you that the first octet of an IP address is “168,” then, using the above table, you would notice that it falls within the 128-191 range, which makes it a class B IP address.

Understanding the classes

We are now going to take a closer look at the five classes. Earlier I mentioned that companies are assigned different IP ranges within these classes, depending on the size of their network. For instance, if a company required 1000 IP addresses, it would probably be assigned a range that falls within a class B network rather than a class A or C.

The class A IP addresses were designed for large networks, class B for medium size networks and class C for smaller networks.

Introducing network ID and node ID concepts

We need to understand the network ID and node ID concept because it will help us to fully understand why classes exist. Putting it as simply as possible, an IP address gives us two pieces of valuable information:

1) It tells us which network the device is part of (network ID).

2) It identifies that unique device within the network (node ID).

Think of the network ID as the suburb you live in and the node ID as your street in that suburb. You can tell exactly where someone is if you have their suburb and street name. In the same way, the network ID tells us to which network a particular computer belongs and the node ID identifies that computer from all the rest that reside in the same network.

The picture below gives you a small example to help you understand the concept: Explanation:
ip2
In the above picture, you can see a small network. We have assigned a class C IP range for this network. Remember that class C IP addresses are for small networks. Looking now at Host A, you will see that its IP address is 192.168.0.2. The network ID portion of this IP address is in blue, while the host ID is in orange.

I suppose the next question someone would ask is: How do I figure out which portion of the IP address is the network ID and which is the host ID?

That’s what we are going to answer next.

The network and node ID of each class

The network class helps us determine how the four byte, or 32 bit, IP address is divided between network and node portions.

The table below shows you (in binary) how the Network ID and Node ID changes depending on the class:

ip4

Explanation:
The table above might seem confusing at first but it’s actually very simple. We will take class A as an example and analyze it so you can understand exactly what is happening here:

Any class A network has a total of 7 bits for the Network ID (bit 8 is always set to 0) and 24 bits for the Host ID. Now all we need to do is calculate how much seven bits is:

2 to the power of 7 = 128 networks and for the hosts : 2 to the power of 24 = 16,777,216 hosts in each network, of which two cannot be used because one is the Network Address and the other is the network broadcast address (see the table towards the end of this page). This is why when we calculate the “valid” hosts in a network we always subtract “2”. So if I asked you how many “valid” hosts can you have a on class A network, you should answer 16,777,214 and NOT 16,777,216.

Below you can see all this in one picture:
ip5
The same story applies for the other two classes we use, that’s class B and class C, the only difference is that the number of networks and hosts changes because the bits assigned to them are different for each class.

Class B networks have 14 bits for the network ID (Bits 15, 16 are set and can’t be changed) and 16 bits for the host ID, that means you can have up to ‘2 to the power of 14’ = 16,384 networks and ‘2 to the power of 16’ = 65,536 hosts in each network, of which two cannot be used because one is the network address and the other is the network broadcast address (see the table towards the end of this page). So if I asked you how many “valid” hosts can you have on class B network, you should answer 65,534 and NOT 65,536.
ip6
Class C networks have 21 bits for the network ID (Bits 22, 23, 24 are set and can’t be changed) and eight bits for the host ID, that means you can have up to ‘2 to the power of 21’ = 2,097,152 Networks and ‘2 to the power of 8’ = 256 hosts in each network, of which two cannot be used because one is the network address and the other is the network broadcast address (see the table towards the end of this page). So if I asked you how many “valid” hosts you can have on class C network, you should answer 254 and NOT 256.

Now, even though we have three classes of IP addresses that we can use, there are some IP addresses that have been reserved for special use. This doesn’t mean you can’t assign them to a workstation but in the case that you did, it would create serious problems within your network. For this reason it’s best to avoid using these IP addresses.

 

Facebooktwittergoogle_plusredditpinterestlinkedinmail