# How to divide network into subnets?

I've been trying to figure out how to divide a network number into particular subjects where one of them require a particular number of hosts.

I have the Computer Networking: A Top Down Approach but it doesn't really specify or show the method of calculating this.

For example I have the question:

A company has the network number 193.1.1.0/24 and wants to have 6 subnets, where the largest one needs to support up to 25 hosts.

From the material I have it says to determine the number of bits required to define 6 subnets but have no idea how/where to go from there and how the bits needed are determined.

I am looking for the method and explanation how to work out these type of questions, I don't want a answer as I want to learn how to apply it myself. :)

• Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer. Jan 25 '19 at 21:21
• By the way, you may find this two-part answer valuable. Jan 25 '19 at 21:22

Remember that everything is binary, so a power of 2. Addresses and masks have 32 bits. You are given 8 bits (2^8 = 256) to work with since your network is /24 (32 - 24 = 8). The required number of subnets is 6, not a power of 2, so you need to pick the next higher power of 2 (8). 8 is 2^3. The 24 bits you already have plus the 3 bits for the subnets is 27 bits. That leaves 5 bits for the number of addresses (2^5 = 32) per subnet.

You must AND the original subnet with the mask to get the first subnet, and the number of addresses per subnet to that to get the next subnet, etc.

That is how you do it without me telling you the answer.

``````Network 193.1.1.0 is                    11000001.00000001.00000001.00000000 in binary
Mask /24 is                             11111111.11111111.11111111.00000000 in binary
Mask /27 (with 3 bits for 8 subnets) is 11111111.11111111.11111111.11100000
1st subnet is                           11000001.00000001.00000001.00000000
2nd subnet is                           11000001.00000001.00000001.00100000
3rd subnet is                           11000001.00000001.00000001.01000000
4th subnet is                           11000001.00000001.00000001.01100000
5th subnet is                           11000001.00000001.00000001.10000000
6th subnet is                           11000001.00000001.00000001.10100000
``````
• Ok I have lots of crossing outs. Any chance you can show me please. :) Much appreciated. (This ip addressing stresses me out so much) Oct 27 '14 at 19:51
• Brilliant thanks, but only answers one part of the question right? What about the largest one needs to support up to 25 hosts? Oct 27 '14 at 20:44
• They all support 32 addresses per subnet. In IPv4 the first and last address of each subnet are reserved. You probably also need an address for the gateway so that leaves you 32-3=29 addresses for hosts per subnet, which fulfills your requirement. Oct 27 '14 at 22:04
• Is it possible to split a /24 into an uneven number of subnets?
– divB
Aug 29 at 7:01
• @divB, because it is binary, every network is a power of two, meaning it is even, except for `2^0`, which equals one, so only a network with a `255.255.255.255` mask (`2^32`) will have an odd number of networks, and, in fact it is the only mask that can have an odd number as the network address. Aug 29 at 12:20