###

Binary .VS Dotted Decimal

To begin, lets understand the difference between binary and dotted decimal when it comes to subnetting. This way we can identify the difference when seeing these formats on exams and in the real world.

Binary example: 11111111.11111111.11111111.00000000

Dotted Decimal example: 255.255.255.0

Dotted Decimal example: 255.255.255.0

Binary to little surprise to most, consist of only 1s and 0s, with dotted decimal have a dot between each decimal value. Keep in mind that each decimal value can be between 0 and 255.

### Octet Introduction

Refer to Step 1 and noticed that each method, binary and dotted decimals have dots in them. These dots represent octets and every octet consists of 8 binary bits. There are also 4 octets and with 8 bits in each that's a total of 32 total bits. Which makes up the 32 bit IPv4 address.

### The Powers of Two

How we convert binary to dotted decimal and back is by using the powers of two. Every bit in an octet represents a power of two. Starting from the right side the bit value represents 1 and moves left increasingly. See below for a visual representation of this.

7 6 5 4 3 2 1 0 <-- Powers of 2

128 64 32 16 8 4 2 1 <-- Values of the Powers of 2

The total value of the 8 bits is 255, we find that by adding 128+64+32+16+8+4+2+1.

Note that values have to line up with the power of 2 for example 2^7 equals 128 and the most left bit in an octet also is 128 because its the product of 2^7 no other value exists in the far left bit in an octet.

### A Little Conversion

Taking what we learned in step 3 we can easily use that as a method to convert binary values to dotted decimal. Working with the below binary value, lets walk through the conversion.

Binary Value

10110110

10110110

What we have to do now is add up the different values to get the dotted decimal value. 2^7 + 2^5 + 2^4 + 2^2+ 2^1 = 182

An easy & quick way to get this value is to right down the values of the powers of two and add them. This takes a little memorizing but not much.

128 64 32 16 8 4 2 1 ( Simply line the binary bits up with the values

1 0 1 1 0 1 1 0

------------------------------

128+32+16+4+2 = 182

1 0 1 1 0 1 1 0

------------------------------

128+32+16+4+2 = 182

### Reverse Conversion

After understanding binary to dotted decimal conversions as covered in Step 4 it's time for dotted decimal to binary. To start we'll begin with a simple subtraction process. Say we were given a value of 224 and we were tasks with finding the binary value of that number. The first step is to subtract the powers of 2 start from left to right.

Value Given = 224

Powers of 2

128 64 32 16 8 4 2 1

128 64 32 16 8 4 2 1

Does 128 subtract from 224? Yes, now subtract 128 from 224 = 96

Does 64 subtract from 96? Yes, now subtract 64 from 96 = 32

Does 32 subtract from 32? Yes, subtract 32 and we have gotten to zero so we're done.

Does 64 subtract from 96? Yes, now subtract 64 from 96 = 32

Does 32 subtract from 32? Yes, subtract 32 and we have gotten to zero so we're done.

When subtracting the values we used a bit from the octet and it became a 1. The binary value of 244 is,

11100000 <-- this is because we had to subtract the three first values before we reached zero.

Spiceworks How-to Link http://community.spiceworks.com/how_to/show/55103-understanding-binary-for-subnetting