IPV4 SUBNETTING: THE LONG AND SHORT OF IT (FOR THE NETWORK+ TEST)

Binary to Decimal or Decimal to Binary Conversion

When convering from binary to decimal (or vice versa), remember this simple rule: You have eight numbers, starting with 1, and doubling the number on each move to the left until you reach 128 (or, start at 128 and halve each number moving left to right until you get to 1). A few examples:

Binary to Decimal:

11001010

128 / 64 / 32 / 16 / 8 / 4 / 2 / 1
1 / 1 / 0 / 0 / 1 / 0 / 1 / 0

Adding the numbers, we get: 128+64+8+2 = 202

Here’s another one:

01010011

Again, let’s break this down using the conversion table:

128 / 64 / 32 / 16 / 8 / 4 / 2 / 1
0 / 1 / 0 / 1 / 0 / 0 / 1 / 1

Adding these numbers, we get: 64+16+2+1 = 83

Decimal to Binary:

The key here is to continually ask: “What is the next largest number I need?” Keep in mind that you only have eight decimal numbers: 128, 64, 32, 16, 8, 4, 2, and 1. Here is a walkthrough of converting a decimal number to binary:

Example: Converting 183 from decimal to binary

First question: What is the largest number I need? Answer: 128. So the first of the eight “slots” gets a 1, and, we will subtract 128 from 183, leaving 55. So far, we are here:

10000000 with 55 left over.

Next question: What is the next largest number I need? 64? No. 32? Yes! So the third slot (representing 32) gets the “1” and there is now 23 left over to allocate (55-32). Here is where we’re at:

10100000 with 23 left over.

Continuing the conversion, 16 is the next largest number. We need that as we still have 23 left over to convert. So the fourth slot (representing 16) gets a “1”. Here is where we are:

10110000 with 7 left over.

Finishing the process, the next number (8) does not get filled, but the numbers 4, 2, and 1 (adding to 7) do. Our final conversion:

183 = 10110111

Test points:

  • If you can remember how to match up the decimal octet (128,64,32,16,8,4,2,1) with the binary numbers, you’ve got most of this down already.
  • In an odd decimal number, the last binary number will always be counted as the last binary number (the 1) is the only odd number.
  • Any number over 128 will need the first binary slot filled.

HOW TO FIGURE OUT A NETWORK ID FROM AN IP ADDRESS AND A SUBNET MASK

This looks hard but it really isn’t if you keep in mind these four steps:

1)Get the binary string for the IP address

2)Get the binary string for the subnet mask

3)Line the two up. For each string, if the IP address and the subnet mask are a “1”, the resulting binary string for the network ID is a “1”. Otherwise, it’s a “0”

Here is an example:

IP Address: 192.168.2.200

Subnet Mask: 255.255.255.64

Doing the binary conversion, we see this:

192.168.2.200 = 11000000.10101000.00000010.11001000

255.255.255.64= 11111111.11111111.11111111.11000000

Adding these we get:11000000.10101000.00000010.11000000

And the network ID is: 192.168.2.128

ONE MORE EXERCISE

Here, we want to obtain the Network ID and Subnet Mask for this IP address: 10.5.10.20/14

Now, we can easily figure out the “/13” for the subnet mask. The “13” represents 13 “1s” on the binary string left to right. It looks like this:

11111111.11111100.00000000.00000000 = 255.252.0.0

So, doing the “addition” we get:

10.5.10.20 = 00001010.00000101.00001010.00010100

255.252.0.0 =11111111.11111100.00000000.00000000

Adding:00001010.00000100.00000000.00000000 = 10.4.0.0

BONUS: How many nodes can we have on the above network?

BONUS ANSWER: To start, let’s remember some key figures regarding subnet masks and number of nodes:

255.255.255.0 = 256 (-2) hosts on the subnet

255.255.0.0 = ~ 65,000 hosts on the subnet

255.0.0.0 = ~ 16 million hosts!

To start, find the subnet mask closest to the one you have. Then, for each binary number you turn on or off, either half or double the number of hosts available. For example,

255.252.0.0 =11111111.11111100.00000000.00000000

255.255.0.0 =11111111.11111111.00000000.00000000

The 255.252.0.0 subnet mask is two binary strings to the left of the “master” of a class B subnet. For each move to the left, we will double the number of hosts. Since we are deleting two binary strings, we will need to double the number of hosts not once, but twice. 65,000 doubled is 130,000 and again it is a whopping 260,000, the number of hosts you can have on your subnet.