It is made up of 4 octets (separated by a ‘.’), each of which is 8 bits in size (32 bits in total).
If we look at our binary table for 8 bits, we can see that the very first number that we can create in 8 bits, by turning on all the switches to “off” is ‘0’
The maximum value we can have in an 8 bit value, by turning all the switches ‘on’ is ‘255’
Thus, the lowest value that can be in a single octet of an IP address is ‘0’, and the highest number that can exist is ‘255’ giving us 256 possibilities (Don’t forget ‘0’ is a number as well).
An IP address contains 2 pieces of information that we require to be able to route traffic to the correct device. It has a network value, and a host value.
We can identify which portion of the IP address is network and host based on the subnet mask (SnM).
If you can imagine a building that has 20 floors on it, and each floor has 100 people. If I wanted to find a person called Bob, the first thing I would need to find out, is which floor does Bob work on? Once I have found the correct floor, then I can find Bob. Similarly the network portion of the IP address would be the floor of the building, and the host would be Bob.
If we take an IP address such as 10.1.2.3 that has a SnM of 255.0.0.0 what can we discover?
The subnet mask tells us which portions of the IP address is the network, and which is the Host portion. If a bit in the subnet mask has been turned on, it tells us that the equivalent bit in the IP address is part of network portion.
So looking at the table below, we can see that the first 8 bits of the subnet mask have been turned on (set to ‘1’). This tells us that the first 8 bits of the IP address is the network portion. Anywhere there is a ‘0’ in the SnM represents the host portion.
00001010.00000001.00000010.00000011 (The IP address 10.1.2.3 in Binary)
11111111.00000000.00000000.00000000 (The SnM 255.0.0.0 in Binary)
Based on the above, ’10’ is the name of our network, since the first 8 bits of the octet have been turned ‘on’ in the subnet mask, and the value of the first 8 bits in the IP address is equal to 10. ‘1.2.3’ is the name of our host since the last 3 octets of the subnet mask are set to ‘off’ which indicated the last 3 octets are the host portion.
As another example, if we look at the IP address 172.16.2.3 with a SnM of 255.255.0.0
10101100. 00010000.00000010.00000011 (172.16.2.3 in Binary)
11111111.11111111.00000000.00000000 (255.255.0.0 in Binary)
We would be able to see that the network value is now ‘172.16’ and the host is ‘2.3’
For a third example, let’s look at the IP address 192.168.1.1 with a SnM of 255.255.255.0
11000000.10101000.00000001.00000001 (192.168.1.1 in Binary)
11111111.11111111.11111111.00000000 (255.255.255.0 in Binary)
‘192.168.1’ is now our network, and ‘1’ is the host
What you will also notice between each of the above, is that in the first example we had a total of 24 bits (3 octets of 8 bits each) that belong to the host portion of the IP address. This means that we could have a total of 16,777,216 (2 to the power of 24) hosts in our network called ’10’.
In the second example we have 16 bits that belong to the host portion of the IP address which gives us 65,536 (2 to the power of 16) hosts in our network called ‘172.16’
The third example has 8 bits belonging to the host portion which gives us 256 (2 to the power of 8 ) hosts in our network called ‘192.168.1’
There is a rule that you must remember however… The very FIRST and LAST values in the host portion, are not allowed to be given to a computer device to use as their address.
In our first example we had a network of ’10’ and the total IP range could have been 10.0.0.0 – 10.255.255.255 (16.7 Million values). This means the first value 10.0.0.0 is not allowed, and the last value 10.255.255.255 is not allowed. So the values that can be used and can be allocated to devices are 10.0.0.1 – 10.255.255.254.
The reason for this is… the very first address (10.0.0.0) is the name of our network. This would be the equivalent of talking about floor 10 of a building, we are not talking about anyone on floor 10, we are talking ABOUT the whole floor. The very last address (10.255.255.255) is our broadcast address. This would be the same as having a PA system on floor 10 and sending a message to everyone on floor 10, we are talking TO the whole floor. It’s impossible for someone to be a floor, and it’s impossible for someone to be everyone, the same applies to IP address, it’s not possible for a computer device to be a network, and it’s impossible for a device to be everything.
The biggest mistake I’ve seen people making regarding the rule, is that somewhere, someone told them that ‘0’ and ‘255’ are not allowed in the last octet. This is completely false!!!
In our first example, we CAN have an IP address of 10.0.1.0 as this is not the very FIRST IP address,10.0.0.0 is. Similarly, we CAN have an IP address of 10.0.0.255 as this is not the first or the last, 10.255.255.255 is the last.