3

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 IPv4 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 195.3.2.0/24 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?

  • 1
    I've found this calculator to be helpful with to the bit visualization: http://jodies.de/ipcalc – Rob Olmos Oct 30 '10 at 06: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 08:29

4 Answers4

3

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.

- 195.3.2.0/24 -> break into 4 subnets of 62 hosts
 - net 1 - 195.3.2.0/26 (195.3.2.1-195.3.2.63, 62 usable addresses)
 - net 2 - 195.3.2.64/26 (195.3.2.65-195.3.2.127, 62 usable addresses)
 - net 3 - 195.3.2.128/26 (195.3.2.129-195.3.2.191, 62 usable addresses)
 - 195.3.2.192/26 -> break into 2 subnets of 30 hosts
   - net 4 - 195.3.2.192/27 (195.3.2.193-195.3.2.223, 30 usable addresses)
   - net 5 - 195.3.2.224/27 (195.3.2.225-195.3.2.255, 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.

- 195.3.2.0/24 -> break into 2 subnets of 126 hosts
 - net 1 - 195.3.2.0/25 (195.3.2.1-195.3.2.127, 126 usable addresses)
 - 195.3.2.128/25 -> break into 4 subnets of 30 hosts
  - net 2 - 195.3.2.128/27 (195.3.2.128-195.3.2.159, 30 usable addresses)
  - net 3 - 195.3.2.160/27 (195.3.2.161-195.3.2.191, 30 usable addresses) 
  - net 4 - 195.3.2.192/27 (195.3.2.193-195.3.2.223, 30 usable addresses)
  - net 5 - 195.3.2.224/27 (195.3.2.225-195.3.2.255, 30 usable addresses)
Zoredache
  • 128,755
  • 40
  • 271
  • 413
2

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)

  • How did you arrive at this? – Dominic Bou-Samra Oct 30 '10 at 04: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 05: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 05: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 05: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 06:23
  • that is correct – Ismail Guneydas Oct 31 '10 at 20:09
2

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 195.3.2.0/24

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

11111111.11111111.11111111.11100000

which means in decimal (convert the groups of 8 bits to decimal form).

255.255.255.224 , this is your subnet mask.

I can explain in more simpler terms if you want.

Rohan
  • 366
  • 1
  • 6
1

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

Mucker
  • 345
  • 2
  • 9