Latest tutorial: Premium Flash Files | Ask Tutorial5! | Subscribe to RSS Register Login Find Hobbies
Advertisement

Get tutorials on EMail




Do you need more help? You can now Ask Tutorial5! and get free support - Ask a question now!

Subnetting example explained

(4 votes)
Written by Mihai Dobos   
In this tutorial, I will show how to calculate subnets, network addresses and the number of hosts within a given IP and subnet mask.


Let's follow this example:

We have the IP address of 192.32.65.10 with a CIDR (Classless Interdomain Routing standard) notation of /27.

The /27 means we have 27 bits reserved for the network in the IP address. /27 also means that the subnetmask in dotted decimal is
the equivalent of 11111111.11111111.11111111.11100000 (first 27 of the 32 bits are 1) = 255.255.255.224.

We have 3 IP classes to keep in mind:

A: 1.0.0.0 -> 127.255.255.255 with a mask of /8 by default
B: 128.0.0.0 -> 191.255.255.255 with a mask of /16 by default
C: 192.0.0.0 -> 223.255.255.255 with a mask of /24 by default.

These are specified by international organizations.

We conclude that our IP address 192.32.65.10 is in class C. So by default, we have 24 bits for network part. But we applied 27 bits for this part, so 27-24 = 3 bits used for subnet.

Keep this in mind.

Q: How do we calculate the number of subnets?

A: We have 3 bits for the subnet part in our case. Each bit can take two values: 1 or 0. The total number of possibilities is 2^3 (2 raised to the power of number of bits). This means 8 subnets, from which 1 or 2, depending on the technology used (if we subnet zero or not - Cisco routers use a service called ip subnet-zero to use the first subnet) cannot be used. So we have a total of 7 subnets generally, or 6 on older routing systems.

Q: How do we calculate the network address?

A: We have to write down our IP address in binary.

192.32.65.10=
11000000.00100000.01000001.00001010 and we also type down the subnet mask in same format
11111111.11111111.11111111.11100000 and do an operation called ANDing comparing bit by bit.
 -----------------------------------------------
11000000.00100000.01000001.00000000, which in dotted decimal is 192.32.65.0; and this is your network address


ANDing works by comparing bit by bit (first bit in the IP with first bit in the network mask and so on).
The results are like this:

1 AND 1 = 1
1 AND 0 = 0
0 AND 1 = 0
0 AND 0 = 0


Q: How do we calculate the number of hosts?

A: Well we use the same idea in calculating the number of subnets. The IP address has 32 bits, from which 27 are reserved for network usage. So we end up with 32-27=5 bits for hosts. So the total number of hosts is 2^5 = 32, from which 2 are unusable: the first one - the network address itself and the the last one - the broadcast address of the network. So we end up with 2^the-number-of-host-bits minus 2.


For a closer look, see http://www.tutorial5.com/content/view/89/79/.


 



Subscribe now via RSS feed and get all the new tutorials

written by Ced , February 28, 2008

1. If you worked on an older network that could not interpret classless addressing, and your
network ID was 145.27.0.0, what is the theoretical maximum number of different subnets you could
create on this network?
2. You have decided to create 254 subnets on your Class B network. What subnet mask will you
use to accomplish this?

3. If you subdivide your Class B network into 254 subnets, what is the maximum number of hosts
you can assign to any single subnet?

4. Your company has leased a Class C network whose network ID is 205.61.128.0. You want to
create 16 subnets within this network. One of the subnets will have an extended network prefix of
205.61.128.64. What will be the broadcast address for this subnet? (Hint: If you know the number of
hosts per subnet, you can easily determine the broadcast address.)

5. What is Supernetting

6. How do you calculate a default gateway
written by Mihai Dobos , February 28, 2008

Hello Ced

We are more then happy to answer your questions, but this does not include your homework assessments. To fully understand subnetting, read our tutorials related to this topic and do some exercises.
written by Boley, Emmanuel , March 16, 2008

can you send me a more detail lesson on this subject to my email box to help me out. Thanks.

Boley
written by Boley, Emmanuel , March 16, 2008

The stuff is good and i like it...it comes down to your level. Even my kid knows what's in it to learn. Thanks

Do you need more help? Ask now!
 

busy
Last Updated ( Thursday, 28 February 2008 )