8

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

Ron Maupin
  • 98,218
  • 26
  • 115
  • 191
orange
  • 263
  • 1
  • 3
  • 6
  • 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. – Ron Maupin Jan 25 '19 at 21:21
  • By the way, you may find [this two-part answer](https://networkengineering.stackexchange.com/a/53994/8499) valuable. – Ron Maupin Jan 25 '19 at 21:22

1 Answers1

14

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.

OK. This is 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
Ron Maupin
  • 98,218
  • 26
  • 115
  • 191
  • Ok I have lots of crossing outs. Any chance you can show me please. :) Much appreciated. (This ip addressing stresses me out so much) – orange 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? – orange Oct 27 '14 at 20:44
  • 3
    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. – Sander Steffann Oct 27 '14 at 22:04
  • Is it possible to split a /24 into an uneven number of subnets? – divB Aug 29 '21 at 07:01
  • 1
    @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. – Ron Maupin Aug 29 '21 at 12:20