High Performance Subnetting

From Braindisconnect
Jump to: navigation, search

by Richard Lohman

Copied from High-performance Subnetting and re-formatted for MediaWiki with permission from the original author.

Check out the Richard Lohman's application for practicing subnetting skills.

Overview

This page describes a process for subnetting. With minimal preparation (the creation of a table), an understanding of the process, and a few hours practice, you should be able to subnet any IP address/mask (or prefix) in under 60 seconds. The end result of this will be the network address, broadcast address, and valid IP address range for hosts.

Prerequisites

There are a few things you must have a good grasp of in order to get through this process. These are listed below:

  • Address classes (A, B, and C): Knowing the address class will help you pick the appropriate row in the table from which you will be working.
  • Interesting Octet: The "interesting octet" is octet of the address that we are working with. For an IP address such as abc.def.ghi.jkl, def is the second octet, ghi the third, and jkl the fourth. This is essentially where we are replacing values to differentiate between a network number and a host address. For example, given the IP address and prefix 163.45.18.29/21, the interesting octet will be the third octet (with the 18) as that is where most of the work in subnetting takes place. We determine this by looking at the prefix, and identifying the row in the table in which the prefix is found. If this seems unclear, we'll be working with exercises below that will help. A few other notes about the interesting octet: 1) the first octet (with the 163) is never the interesting octet, 2) the interesting octet is usually determined by the address class (the second octet is the interesting octet for class A addresses, the 3rd octet is the interesting octet for class B addresses, and the 4th octet is the interesting octet for class C addresses).

The Table

The following table is used to do the subnetting:

Mask
Block Size
128
128
192
64
224
32
240
16
248
8
252
4
254
2
255
1
A       
B    
 9
   17
       25 
 10
    18
        26 
 11
    19
        27 
 12
     20
         28 
 13
     21
         29 
 14
     22
         30 
 15
     23
         31 
 16
     24
         X 

The bottom row lists address prefixes. When given a prefix in the problem, you can look it up here to determine which column you're working in. In addition, prefixes will tell you what the interesting octet is. If the prefix falls in the A row, the 2nd octet is the interesting octet. If it falls in the B row, the 3rd octet is the interesting octet. Finally, if it falls in the C row, the 4th octet is the interesting octet. The top half contains two rows. The top row lists the subnet mask value that will appear in the subnet mask. If you are provided a subnet mask instead of a prefix, you can look at the last octet in the mask before the zero to see which column in the table you're working with during the process. The second row lists block sizes. This is the size of the block of addresses that the address/prefix provides. Subtracting 2 from this number will give you the number of valid host IP addresses in the block. There are other tables out there that you can use for a similar process. I chose this one because of how the exams are administered. You are generally provided two sheets of laminated paper, and a dry-erase marker for the exam. There is not a lot of room (or time) to write large complex tables.

The Xs: In the last row, you will notice two Xs. This is because you cannot subnet an address down to this level. With a /30 prefix, the block size is 4, leaving a network address (1) a brodcast address (2) and two valid host IP addresses (3 and 4). If you attempt to subnet further with a /31 prefix, this would result in a block size of 2, with one for the network address, one for the broadcast address, and nothing left for host IP addresses [sic]. There is a /32 mask that is valid, however that is unrelated to subnetting.

The Process

OK. Enough of the talk. Let's do a few exercises to see how this works.

We begin with the IP address provided above and a prefix, 163.45.18.29/21.

  1. Write down the ip address and prefix on a sheet of paper:
    163.45.18.29/21
    
  2. Look up the prefix number (21) in the bottom half of the table. It falls in the 5th column, so we will be using that column of the table for the remainder of the exercise. At this point we can already make some useful notes about the address. First, we see that it falls within the class B range. This means that the first two octets will be unchanged (and as such, I do not write them down on the piece of paper), and the 3rd octet is the interesting octet, because the prefix (21) falls on the middle row in the bottom half of the table. We also know, by looking at the top row, that the value in the interesting octet of the subnet mask will be 248 (hence, a mask of 255.255.248.0). Finally, we know that the block size we're working with is 8. More on this in the next step. At this point, I usually write the block size above the interesting octet, so I can keep track of where I am at:
            8
    163.45.18.29/21
    
  3. Now, we figure the network and broadcast addresses. To do this, we go back to the block size. The block size determines where network addresses start, and is an incrementing value in the interesting octet. Our goal is to find the network number that supports the provided IP address. To do this, we count incrementally in the interesting octet until we reach the host address number (without passing it). in this case, we count as follows:
    163.45.0.0
    163.45.8.0
    163.45.16.0
    At this point, if we increment again, we will pass the value in the third octet, so we stop, and we are left with the network number: 163.45.16.0. Write this down:
            8
    163.45.18.29/21
           16.0          network address
    
  4. Now, we need to find the broadcast address. This is probably the most difficult part to explain, but after some practice, it will become very intuitive. First, we increment the interesting octet one more time (passing the host address value for that octet) and subtract 1. The next number in that octet (incrementing by the block size) is 24, minus 1 is 23. If this were a class C address (and we were working in the 4th octet), we would be finished. For class A and B addresses, we need to fix octets to the right of the interesting octet. To do this, we throw a 255 in each remaining octet to the right of the interesting octet. In this case, we place 255 in the 4th octet, and we have our broadcast address, again, written down to keep track of where we're at:
            8
    163.45.18.29/21
           16.0          network address
    
           23.255        broadcast address
    
  5. All that is left is to find the valid IP address range; that is, the range of addresses that can be assigned to hosts in the network. To do this, we increment the network address by 1, and decrement the broadcast address by 1. The first valid IP address is obtained by adding 1 to the number in the 4th octet of the network address, and the last valid IP address is obtained by subtracting 1 from the 4th octet of the broadcast address. Thus:
    First valid IP = 163.45.16.[0 + 1] = 163.45.16.1
    Last valid IP address = 163.45.23.[255 - 1] = 163.45.23.254.
    Again, write these down to keep track of where you're at:
            8
    163.45.18.29/21
           16.0          network address
        16.1 - 23.254    valid host addresses
           23.255        broadcast address
    

And there you have it. You've subnetted an IP address to find the network address, the broadcast address, and the valid host IP range.

Another Exercise

Let's do another exercise. This time, we will use an address that falls in the Class A range, and we'll assume that we were given an address and mask (instead of a prefix). The address we want to find subnet information for is 89.65.129.68 with a 255.240.0.0 subnet mask.

  1. Write it down:
    89.65.129.68/12
    
    How did we know to write the prefix of /12? Simple: Remember one of the prerequisites is that you have to have a solid understanding of IP address classes. We know that an address with 89 in the first octet falls in the Class A range. We also know that the last number in the subnet mask before the first 0 octet is 240. We look up the 240 in the top row of the table, follow down that column to the prefixes in the bottom half, and look at the number in the class A row: 12. This is the prefix for the subnet.
  2. Next, get the block size. The block size appears in the lower row of the top half of the table, and it is 16. Remember, this means we have blocks of 16 addresses with two reserved for network and broadcast, leaving 14 for valid host addresses. We also need to find the interesting octet. In this case, it's octet 2, as the second octet is the interesting octet for class A addresses. Write this down:
       16
    89.65.129.68/12
    
  3. Now, we find the network and broadcast addresses. Increment in the interesting octet by the block size:
    89.0.0.0
    89.16.0.0
    89.32.0.0
    89.48.0.0
    89.64.0.0
    The next number in the interesting octet, 80 exceeds the host address number, so we stop at 64 for the network number. Write it down:
       16
    89.65.129.68/12
       64.0.0               network address
    
  4. To find the broadcast address, count up one more in the interesting octet (89.80.0.0), place 255s in all octets to the right of the interesting octet (89.80.255.255) and subtract 1 from the interesting octet to get the broadcast address (89.79.255.255). Write it down:
       16
    89.65.129.68/12
       64.0.0               network address
    
       79.255.255           broadcast address
    
  5. Now, to find the valid host range, add one to the network address, and subtract one from the broadcast address:
    First valid IP = 89.64.0.[0 + 1] = 89.64.0.1
    Last valid IP address = 89.79.255.[255 - 1] = 89.79.255.254
       16
    89.65.129.68/12
       64.0.0               network address
    .65.0.1 - .79.255.254   valid host range
       79.255.255           broadcast address
    

...and we're done.