Sunday, November 13, 2011

Subnetting..random notes

I figure it's easiest to show this as classless, as the same method works for classful.

Analyzing Existing Subnets:


How to determine subnet number?
The easiest way to find the subnet number, is to first convert the IP and subnet mask, and then AND the two together.

Example:
IP: 199.1.1.100
Subnet Mask: 255.255.255.224

If we were to convert the IP to binary, we would mostly be worried about the last octet, as this is where the "magic" happens.

01100100
11100000

The result of ANDing the two numbers is: 01100000, or 96.

Finding the broadcast IP?

Once you have your binary subnet number, change all of the host bit values in the subnet number to binary 1s.  Using the above example, that would give us 01111111 or 127.
Thus, using the above example, we would have a range of 97-126 usable addresses in this particular subnet.

Another example:
Address: 130.4.102.1
Subnet mask: 255.255.252.0

Based on the following example, we are examining the 3rd octet.
102 in binary is...01100110 and 252 in binary is...11111100

ANDing the two numbers..
0 1 1 0 0 1 1 0
1 1 1 1 1 1 0 0

You have: 01100100 or a subnet number of 130.4.100.1  and a broadcast number of 130.4.103.255.

Using the same example, how can we have determined the number of subnets?  To determine the number of subnets, use the formula:

Because we had as subnet mask of 255.255.252.0 or 6 subnet bits, we have potentially 64 subnets.  The cool thing with this formula, is that we can also determine how many bits one must back to get a desired number of subnets.

 Because we know that the subnet number is 130.4.100.1 and the subnetted portion is in the 3rd octet, we can also determine which subnet this subnet number is a part of!  With the "strange" subnet mask portion being a value of 252, we can subtract it from our "magic" number 256.  Subtracting the two numbers gives a result of 4.  With the given subnet mask and IP address, the first non zero subnet would be 130.4.4.0.  The above example, of 130.4.100.0 would then be 25th subnet in a series of 64 subnets!


Imagine your boss were to tell you: "We need a subnet for each printer VLAN."  If you were to know that there were 20 printer VLANs, you would use the 20=2^s.  Because it cannot exactly equal 20, we would need to mask 5 bits.

How can you then determine the number of hosts per subnet?  Use the formula: number of hosts per subnet=2^h-2 with h being the number of host bits.

Example: 
Given the IP address 192.168.10.0/26, provide all useful information (network ID, Subnet numbers, broadcast IPs, etc):


Take your address, and break it down into binary, with a focus on the "interesting part" of the subnet mask. A class C IP has a default subnet mask of 255.255.255.0. Because our provided subnet mask is 255.255.255.192, this is our "interesting octet", or part that isn't 255 or 0. To find your current subnet ID, simply write out the subnet mask & IP interesting octet in binary. In this case we have..
Subnet Mask: 1100000
IP: 0000000

This one is easy because the last octet is 0 (which you will learn to be the network ID). If it wasn't 0, you perform an AND, not add, but AND. Anyways, for this subnet, the subnet ID is the IP you listed. To find the number of subnets, the easiest way is to take the number 256-the number in the "interesting octet" of the subnet mask. 256-192=64.

Because we have two masked bits, we can determine that there are actually 4 subnets. The formula for this is 2^s, with s being the number of masked bits. 2^2=4

192.168.10.0 - Subnet ID
192.168.10.1 through 192.168.10.62 - Possible host addresses
192.168.10.1.63 - Broadcast IP (LAST possible IP before the next subnet ID)

192.168.10.64 - Subnet ID
192.168.10.65 through 192.168.10.126 - Possible host addresses
192.168.10.127 - Broadcast IP (LAST possible IP before the next subnet ID)

192.168.10.128 - Subnet ID
192.168.10.129 through 192.168.10.190 - Possible host addresses
192.168.10.191 - Broadcast IP (LAST possible IP before the next subnet ID)

192.168.10.192 - Subnet ID
192.168.10.193 through 192.168.10.254 - Possible host addresses
192.168.10.255 - Broadcast IP (LAST possible IP before the next subnet ID)

No comments:

Post a Comment