Skip to content

 Octets

An Octet is a unit of digital information that consists of bits. As we know that An IP address consists of 4 octet (separated by a period). We will now discuss how to convert decimal to binary and why it’s important to do so.

Subnet Mask Explained

So 255.255.255 are the three network parts (octets) while 0 is for the host part.

Octet chart &Conversion

The number on the chart each represent a bit of an octet. if you add them all up it equals to 255. So let’s say you have a subnet mask: 255.255.255.192. This is not a default “C” class subnet mask. However, Like we discussed previously. A “C” class subnets mask’s first three octets (left-to right) and reserved by the network.

Decimal to Binary Conversion

Let’s convert the subnet mask:255.255.255.192 to Binary form. Starting from the left. We look at the octet chart. We keep on selectively adding the numbers that add up to the number in the octet (255 in this case). The numbers that we skip will have a 0 underneath it and the numbers we add will get a 1.

Adding The top row from left-to-right we get the total of 255 which in binary form is 11111111 (eight 1’s).  Every number that needed to be added to get the total gets a 1 below it. 

Now in the case of the last octet 192. We only added the first two numbers from the table and got 192. That means the added numbers get a 1 below them while the rest all get a giving us the binary form 11000000 (two 1’s and six 0’s). Another example would be 179 where we skip multiple numbers to get a total of 179 shown below.

Now, as you can see the binary number consists of both 1’s and 0’s based on what numbers were added and what were skipped.

Network Bits vs Host Bits 

Now that we have the binary form of the subnet mask 255.255.255.192 which is 11111111-11111111-11111111-11000000.  To find out which octets are for network and which are for host we will cancel out all the 1’s from the subnet mask’s binary form with the binary form of the default subnet mask for class “C” subnet. 

Now what is that 192 in place of 0? This means that we have borrowed or stolen bits from the host portion of the subnet mask. However, which can be found out by converting the decimal (255.255.255.192) to binary form as done above 

Class “C” is by default 255.255.255.0 which means that the last octet “0” which has 8 bits is for the host. Since our subnet mask in this example was 255.255.255.192. This means after converting into binary and crossing all the one’s of our subnet mask ( 11111111.11111111.11111111.11000000) with the default subnet mask. 

Taking a look at the  diagram above. We find that the two 1’s in the last octet are the stolen bits that were two 0’s in the default subnet mask.  Each binary number either 1 or 0 (Left-to-right) represents a number from the octet chart.  The borrowed Two bits (1’s) from the last octet when compared with the octet chart are 128 and 64. Hence the number 192 as the last octet in decimal form.

examples:

  • Comparing the binary number 11000000 (Left-to-right) with the octet chart 128,64,32,16,8,4,2,1 (Left-to-right). You will see 1’s is in place of 128 and 64 which when added gives 192.. The decimal of 11000000 is 192.
  • The Binary 10101000. Now, 128 has a 1,64 does not, 32 has a 1, 16 does not, 8 has a 1, 4 does not, 2 and 1 don’t as well. So, Adding 128+32+8=168 which is the decimal value of the octet.

Conclusion:

  • Whenever working with any subnet mask whether Class A,B or C. The custom/new subnet mask is compared against the default subnet mask.
  • This allows you to calculate the network and host bits when converting to Binary form. However, with practice you might not need to do so as well.
  • The Decimal numbers can be obtained by adding the 1’s of the binary form (left-to-right) in an octet with reference to the octet chart.
Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *