HomeFAQSearchRegisterMemberlistUsergroupsLog in

Share | 

 Subnetting made easy

Go down 

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 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: 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:

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) CANNOT USE ANY 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:, unsubnetted mask:

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:

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: Magic #128

So, is the first useable address or

Since the last non-zero octet was the last octet, that’s where we start our network increments: (cannot use) (added 128)…….hang on!! Can’t do this!!!



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 – the next subnet.. (add 128) (add 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
Subnetting made easy
Back to top 
Page 1 of 1
 Similar topics
» Rough Engineering Made Easy
» Elemtary school made out of glass
» made umbrella
» Celebrate New Life 2011...The Bride has made Herself Ready!!!

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