Internetworking 101 series – Subnets

Internetworking 101 series – Subnets

August 12, 2013 0 By Eric Shanks

ChalkboardThis is a series of posts designed to help readers understand how the Internet works.  This specific post looks directly at how devices know what machines are on their network segment.

In previous posts, we looked at how machines communicate on the same network by utilizing frames, and how machines on different network segments use packets.  The next logical question is, “How do machines know if these machines are on the same network or not?”  The answer to this question is subnetting.

Binary

In order subnet, we need to first be able to convert a 32 bit decimal notation IP address into binary.  For our example we’ll use the IP 192.168.1.10.  Look at the first “octet” 192.

Let’s break the number 192 out into expanded notation.  (Remember from grade school where you’d write out a number based on the location of the digits)

decimal expanded

 

The brief refresher of expanded notation should make our transition to binary easier.  For binary, there are only two numbers available for each column instead of 10. (0-9).  So we instead have something that looks like this:

 binary expanded

So after 2 quick calculations we have shown how to take a decimal and convert it into binary.  192 = 11000000

If we take the rest of the IP address and convert it to binary we get:  11000000.10101000.00000001.00001010

“AND” Operations

Lastly, before we can determine what network segment we are on, we need to understand how an “AND” operation is complete.  An “AND” operation takes two inputs and creates one output.  A binary “AND” operations must take 0s or 1s and the result is a 0 or a 1.

There are four scenarios when running an “AND” operation on binary numbers.

0  AND  0->0
0  AND  1->0
1  AND  0->0
1  AND  1->1

Subnet Masks

A subnet mask get’s get’s applied to an IP address in an “AND” operation to determine the network segment.  A pretty common mask is 255.255.255.0.  Converting this address to binary is an easy calculation:

11111111.11111111.11111111.00000000

Let’s “AND” the subnet mask above with our original IP address of 192.168.1.10

segment1

 

Once the “AND” operation has been completed, we receive a network segment.

Now once a machine tries to determine where a destination machine is, it just checks the IP address of the destination machine to see if it has the same network segment as the source machine.  If it does, the frames are sent directly to the destination machine.  If the destination machine is on a different segment, the source machine passes the frame to the default gateway to be routed.