CISCOKILLERS

CCNA, CCNP, WLAN ANSWERS AND MUCH MOREEEEE!!
 
HomeFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

 Subnetting made easy

Go down 
AuthorMessage
Admin
Admin


Number of posts : 72
Age : 31
Localisation : Cyprus
Registration date : 2007-02-22

PostSubject: Subnetting made easy   Fri Nov 30, 2007 5:47 pm

Subnetting – The “Magic Number”
Drew Campbell – IT Manager / CCNA / CCAI
Community College of Beaver County Regional Academy


The easiest way to subnet an address is by using the “magic number” method. Here’s how it works:

In order to subnet, we need to know a couple things:
1. The network address we’ll be subnetting
2. How many subnets or hosts we need

Remember the rules of subnetting:
1. You must borrow at least 2 bits
2. You must leave at least 2 bits

We must also be able to identify classes of addresses by looking at the first octet:
1 – 127 - Class A (127 reserved for loopback testing)
128 – 191 – Class B
192 – 223 – Class C (192 used for local intranets)

Depending on the class, a portion of the address (Network) is assigned to us, the remaining portion is the Host portion we can use to subnet.

Class A = N . H . H . H
Class B = N . N . H . H
Class C = N . N . N . H

The Host portion of an address (the H) is the octet(s) we can borrow from for subnetting.

What does this mean?

Take a Class C address:

200.100.11.0 (200 means Class C)

The number in binary: 11001000 . 01100100 . 00001011 . 00000000


Since this is a Class C, we’ll be borrowing from the LAST octet. (00000000)

How many subnets do we want?

Remember: You must borrow at least 2 bits, leave at least 2 bits.

Range = 11000000 to 11111100 (borrowing at least 2, leaving at least 2)


You can determine your subnet(s) either by deciding how many subnets you want or how many hosts per subnet you want. Either way, the number of bits borrowed will be a power of 2:

In a class C, if we borrow 4 bits (11110000), that’s 4 bits of subnetting. Number of subnets is 2 x 2 x 2 x 2 (2-to-the-4th) or 16 subnets.

The number of hosts per subnet is determined by the bits not borrowed (the 0’s. In this case we have 4 zeros (2 x 2 x 2 x 2) or 16 hosts/subnet.

**Binary Note**

To make life a little easier for you, you should be accustomed to the patterns of bits in a mask or any byte) so you can immediately determine a mask just by knowing how many bits are borrowed. In other words, you can do it “in your head” by remembering the following:

Turned on Bits Binary number Decimal Equivalent
0 00000000 0
1 10000000 128
2 11000000 192
3 11100000 224
4 11110000 240
5 11111000 248
6 11111100 252
7 11111110 254
8 11111111 255

*Note that you cannot borrow only 1 or 7 or 8 in a Class C, but remember, if you have an A or B, your borrowing may span 2 or more octets, so in a Class B borrowing 9 bits (xxxxxxxx.xxxxxxxx.11111111.10000000), you should immediately know the mask by looking at the octets. (3rd is 255, 4th is 128)




O.K. Back to the original problem:

200.100.11.0 and we want to borrow 4 bits:

11111111.11111111.11111111.11110000 is our mask.

(Remember: The subnet mask is when all the network and subnet bits, if any, are set to 1)

By looking at the binary representation, we know the mask in decimal is:

255.255.255.240


What we must do now is determine what our network numbers are for each subnet. We borrowed 4 bits which gives us a mask of 240 (last octet):

What is our “Magic Number”? The Magic Number is the increments of our subnet addresses. We obtain the magic number by subtracting the LAST NON-ZERO OCTET in our subnet mask from 256 (the number of possible numbers represented in 1 byte: 0-255 inclusive):

…so, 256 – 240 = 16, our magic number.









Now, let’s write out our network numbers, useable hosts and broadcasts:

Network address (unusable as host IP) 1st useable host Last useable host Broadcast address (unusable as host IP)
200.100.11.0 CANNOT USE ANY
200.100.11.16 200.100.11.17 200.100.11.30 200.100.11.31
200.100.11.32 200.100.11.33 200.100.11.46 200.100.11.47
200.100.11.48 200.100.11.49 200.100.11.62 200.100.11.63
200.100.11.64 200.100.11.65 200.100.11.78 200.100.11.79
200.100.11.80 200.100.11.81 200.100.11.94 200.100.11.95
200.100.11.96 200.100.11.97 200.100.11.110 200.100.11.111
200.100.11.112 200.100.11.113 200.100.11.126 200.100.11.127
200.100.11.128 200.100.11.129 200.100.11.142 200.100.11.143
200.100.11.144 200.100.11.145 200.100.11.158 200.100.11.159
200.100.11.160 200.100.11.161 200.100.11.174 200.100.11.175
200.100.11.176 200.100.11.177 200.100.11.190 200.100.11.191
200.100.11.192 200.100.11.193 200.100.11.206 200.100.11.207
200.100.11.208 200.100.11.209 200.100.11.222 200.100.11.223
200.100.11.224 200.100.11.225 200.100.11.238 200.100.11.239
200.100.11.240 CANNOT USE ANY
^^^^
Note: You add the magic number (16) to each network number to get the next subnet address.

Remember, you have 2 subnets you cannot use: the very first and the very last. The first is a network subnet, the last is a broadcast subnet. We cannot use any ip’s on either of those subnets. Same rule applies to the first and last address on each subnet.


What about a Class B?

Class B address are done the same, but remember you have the last 2 octets to work with:

136.122.0.0, unsubnetted mask: 255.255.0.0

Let’s write out the mask in binary:

11111111 . 11111111 . 00000000 . 00000000





If I must borrow at least 2 host bits and leave at least 2 host bits, I can borrow from 2 to 14 bits (using the last 2 octets). Let’s borrow 9:

11111111 . 11111111 . 11111111 . 1000000

Our mask is: 255.255.255.128

This gives us:

2x2x2x2x2x2x2x2x2 (9 borrowed) or 512 subnets (510 useable)
2x2x2x2x2x2x2 (7 left) or 128 hosts / subnet (126/subnet useable)

Magic number: 256 – 128 (last non-zero octet) = 128

Original address: 136.122.0.0 Magic #128



So, is the first useable address 136.122.0.128 or 136.122.128.0?

Since the last non-zero octet was the last octet, that’s where we start our network increments:

136.122.0.0 (cannot use)
136.122.0.128 (added 128)

136.122.0.256…….hang on!! Can’t do this!!!


Here’s 136.122.0.0:

10001000.01111010.00000000.00000000


256 is NOT a valid decimal number in 1 byte (range: 0 –255)

10001000.01111010.00000000.11111111 (That’s 255!)




Now what?


We roll over the next bit in the previous octet:

10001000.01111010.00000001.00000000

136.122.1.0 – the next subnet..
136.122.1.128 (add 128)
136.122.2.0 (add 128)
136.122.2.128 … and so on.

We are actually carrying the extra 1 from 256 (since we can only represent 255 in an octet) in the last octet, which increments the previous octet.


Hope this helps!!
Back to top Go down
View user profile http://www.ciscokillers.tk
 
Subnetting made easy
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
CISCOKILLERS :: Other :: Usefull stuff-
Jump to: