# Understanding Subnetting

In order to understand subnet masks, you MUST understand binary.   If you already have a basic understanding of binary, you can skip ahead to the “Networks and Subnetting” section further down below.

Understanding Binary

The math that you and I and every other person on the planet uses in our day-to-day activities is base-10.  This means our number system is based on 10 individual digits, 0 through 9, and subsequently powers of 10.

Lets take the number one hundred twenty three (123).  It has three “places”, the hundreds place, the tens place, and the ones place.  Simple, I know, but it is necessary to relate to binary.  In the hundreds place, we have the value of 1, the tens place a value of 2, and the ones place a value of 3.

Now we get to the fun part.  The hundreds, tens, and ones place are more technically the 10^2 place, 10^1 place, and 10^0 place (that’s ten to the power of 2, etc.).  Ten to the power of 2 is 100, to the power of 1 is 10, and to the power of 0 is 1 (anything to the power of 0 is 1).So what this means, is that for every place, the value added to the final number is the number in that place, times the appropriate 10^x.  In this example, then:

```(1 * 10^2) = 1 * 100 = 100
(2 * 10^1) = 2 * 10  =  20
(3 * 10^0) = 3 * 1   =   3```

How does this relate to binary?  The only difference is binary uses base-2 instead of 10, meaning our places are 2 to the power of 0, 1, 2, 3, etc. and we only have 2 individual digits, 0 and 1.  So lets do the same number, 123, but in binary.

`01111011`

While the presence of only ones and zeros may seem confusing, it’s easy if you understand the value of each place, which are now 2 to the power of x, and extend the same logic as in the base-10 example.  Also, notice I chose to use 8 digits to represent the number, even though I could have omitted the first zero.  This is important for networking, as we’ll see in a minute.  The value of each place from left to right is shown below, with the appropriate 2^x designation:

```2^7 = 128
2^6 = 64
2^5 = 32
2^4 = 16
2^3 = 8
2^2 = 4
2^1 = 2
2^0 = 1```

In our example number of 123, converted to binary, we have a 1 in the  place values 64, 32, 16, 8, 2, and 1. Add those values together and you end up with: (64+32+16+8+2+1) = 123.  Each increasing place value from right to left is twice the previous place, or half the previous from left to right.

Networks and Subnetting

Let us move on to networking, and see how binary comes in to play along with the concept of subnetting. An IP address is made up of four “octets”, and they are called octets because…they use 8 “binary digits”, or “bits” in each number, just like the example above!  The highest value you can have in any one of the four octets is 255, because that is the highest number you can represent in binary using 8 bits.  11111111 = 255.  Try the conversion yourself: add up the values for all eight places and you’ll see it.

An IP address is useless on it’s own; it also needs a subnet mask to tell the system what network it belongs to.

Lets take a pretty standard example, then break it down. The IP address I chose for this example is one you’ll see on at least half of all consumer routers, so this is hopefully somewhat familiar to you.

```IP:   192.168.1.1

The first three octets in this example are the network address, the last octet contains the host address (we’ll get to the “why” in just a second).  This doesn’t much help, or make any sense, without binary, so let’s convert it!

```IP:   11000000.10101000.00000001.00000001
```IP:   11000000.10101000.00000001.00000001