Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been going over my notes for subnetting, and realised I don't really understand it. Have read this fantastic question which cleared up a lot: How does Subnetting Work?

However, I'm still stuck. Takes this scenario for example:

Assume you work for medium sized law firm that has decided to install a computer network to increase the efficient distribution of its legal records. After talking to the leading partner you determine that you need at least 5 subnets for your network. The Internet Authority has assigned an address of to the network of your firm.

How do I determine how many bits I need to borrow from the host to create my subnet structure? How do I get my subnet mask?

share|improve this question
I've found this calculator to be helpful with to the bit visualization: jodies.de/ipcalc –  Rob Olmos Oct 30 '10 at 6:15
I think something has gone screwy on the question you linked too. I am pretty sure there used to be more to the answer in the 'Urban Planning and IP Routing' section that actually would have answered your question. –  Zoredache Oct 30 '10 at 8:29

4 Answers 4

up vote 2 down vote accepted

You need 5 Subnets. Which means 3 extra bits (2^3 = 8) will be required for that in addition to 24 that you already have.Because with 24 bits , you have only one network.

The public ip address given to you is

so now your subnet prefix will be 27.

Now the number of bits remaining for host part of the address is 5 (32-27). So for 2^5 - 2 (-2 for the subnet number and broadcast address for each subnet) you will have

30 hosts in each subnet. So total hosts available will be No. of subnets 8 x 30 = 240.

Now for the subnet Mask. Your total number of bits in network part is 27 and host part is 5.

Arrange 27 bits in groups of 8. This is the default binary to decimal conversion table


which means in decimal (convert the groups of 8 bits to decimal form). , this is your subnet mask.

I can explain in more simpler terms if you want.

share|improve this answer

How do I determine how many bits I need to borrow from the host to create my subnet structure? How do I get my subnet mask?

You need subnets to seperate the groups of computers because you want them on different broadcast domains, or they are physically separate, or you need to do some kind of filtering between the subnets.

So you basically have to figure out how many computers you will have in each subnet and then you break up your address space in a way that makes sense.

Lets assume for a second that on 3 of subnets you will have between 0-62 computers and the other two 2 will have between 0-30 computers you might subnet things like this.

- -> break into 4 subnets of 62 hosts
 - net 1 - (, 62 usable addresses)
 - net 2 - (, 62 usable addresses)
 - net 3 - (, 62 usable addresses)
 - -> break into 2 subnets of 30 hosts
   - net 4 - (, 30 usable addresses)
   - net 5 - (, 30 usable addresses)

If one of your networks need to have about 120 hosts, and the other 4 need about 30 hosts you would have to break up your networks differently.

- -> break into 2 subnets of 126 hosts
 - net 1 - (, 126 usable addresses)
 - -> break into 4 subnets of 30 hosts
  - net 2 - (, 30 usable addresses)
  - net 3 - (, 30 usable addresses) 
  - net 4 - (, 30 usable addresses)
  - net 5 - (, 30 usable addresses)
share|improve this answer
+1 for showing uneven division. –  Dennis Williamson Oct 30 '10 at 14:35

You can only have up to 254 hosts (/24). For having at least 5 subnets, this means you can have at most around 50 hosts. The closest number would be 32 hosts: 11100000 (last octet)

share|improve this answer
How did you arrive at this? –  Dominic Bou-Samra Oct 30 '10 at 4:55
You want to have at least 5 subnets. You need to convert this number next bigger number that power of two which is 8. (Since it says "at least" having 8 subnet is OK.) Here is the formula you can use: –  Ismail Guneydas Oct 30 '10 at 5:10
number of subnet = (number of total hosts) / (number of host in a subnet) Since you have /24, this means we can have 256 hosts (yes you need to include broadcast address) 8=(256/?) Then ?=32. –  Ismail Guneydas Oct 30 '10 at 5:13
To have 32 hosts in a subnet your mask should be 11100000. (For number of host, look at the zeros at the right side, you have 5 zero. 2^5=32, for number of subnets, look at 1s at left side:you have 3 1s. 2^3=8 subnets. –  Ismail Guneydas Oct 30 '10 at 5:15
So given I have 5 subnets, I need the closest number to contain it (2*2 is too small, so 2*3 works). Then use the formula: # of subnets = # of total hosts / # of hosts in a subnet. I.e. 8 = 256/x. x = 32. So total hosts = 256. Mask is just the total hosts (256) - 2^number of subnets? –  Dominic Bou-Samra Oct 30 '10 at 6:23

Take a look here for a basic networking guide Computer Networking Basics

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.