# Subnetting: Detrmining Subnet Mask based on Desired Hosts?

Kikode
Posts:

**74**Member ■■□□□□□□□□
Hello,

Just finished the Subnetting section on CBT nuggets. Started searching for more subnetting exercises online and found a great practice sheet. However the practice work Im doing now Gives me the Class of the network (A,B,C) and wants me to determine the best subnet mask to use based on the desired amount of subnets.

The first question is if you have a Class A network and wish to have 50 subnets what should the subnet be if you want the most hosts per network as possible. The answer is already goven as 255.252.0.0 however it doesn't explain the math process to get to this number and I'm curious how to do it. If any of you subnetting Gurus know more about this please help.

Thanks.

Just finished the Subnetting section on CBT nuggets. Started searching for more subnetting exercises online and found a great practice sheet. However the practice work Im doing now Gives me the Class of the network (A,B,C) and wants me to determine the best subnet mask to use based on the desired amount of subnets.

The first question is if you have a Class A network and wish to have 50 subnets what should the subnet be if you want the most hosts per network as possible. The answer is already goven as 255.252.0.0 however it doesn't explain the math process to get to this number and I'm curious how to do it. If any of you subnetting Gurus know more about this please help.

Thanks.

#### Welcome

We're proud to offer IT and security pros like you access to one of the largest IT and security certification forums on the web.

## Quick Links

#### Categories

- 109.7K All Categories
- 106 Welcome Center
- 15 Announcements
- 3 Forum Rules of Engagement
- 57 Introduce Yourself
- 30 TechExams Support
- 87.4K Certification Preparation
- 131 Check Point: CCSA & CCSE
- 32.8K Cisco
- 21.5K CCNA & CCENT
- 367 CCDA & CCDP
- 8.9K CCNP
- 1.7K CCIE
- 398 Cloud Certifications
- 148 Amazon Web Services (AWS)
- 6 Azure
- 101 CCSP
- 73 Cloud+ & Cloud Essentials
- 15.3K CompTIA
- 5K A+
- 219 CASP+
- 84 CySA+
- 965 Linux+
- 4.4K Network+
- 22 PenTest+
- 259 Project+
- 3.8K Security+
- 328 Server+
- 248 Other CompTIA Certifications
- 1.2K EC-Council
- 583 CHFI
- 599 CEH
- 1.3K GIAC
- 25 IAPP
- 951 ISACA
- 9 CRISC
- 262 CISA
- 669 CISM
- 4.2K (ISC)²
- 581 CISSP
- 32 CSSLP
- 3.6K SSCP
- 920 Juniper
- 718 LPI, Red Hat & Linux Foundation
- 18.5K Microsoft
- 132 MCSA 2016 / MCSE 2016
- 158 Windows 10 exams
- 139 Windows 8 exams
- 1.4K Windows 7 exams
- 1.6K MCSA / MCSE on Windows 2012 General
- 2.3K MCTS / MCITP on Windows 2008 General
- 828 Exchange Server & Office Communications Server Exams
- 528 Other Microsoft Electives
- 350 MCSA/MCSE: Security
- 300 Microsoft Developers Certifications
- 483 SQL Server exams
- 141 Offensive Security: OSCP & OSCE
- 2K Other Security Certifications
- 331 Virtualization Certifications
- 231 Citrix Certifications
- 94 VMware
- 1.9K Other Certifications
- 6 Business Analyst Certifications
- 387 CWNP Certifications
- 856 ITIL Certifications
- 212 Project Management Certifications
- 84 Apple Mac OS X Certifications
- 62 Novell Certification
- 81 Oracle Certifications
- 52 Sun Microsystems Java Certification
- 112 Storage Certifications
- 6.6K General Certification
- 17.5K Education & Development
- 30 Colleges & Schools
- 27 Educational Resources
- 17.4K IT Jobs / Degrees
- 29 Professional Development
- 71 Cybersecurity
- 2 Cloud Security & IoT
- 8 OWASP
- 24 Security Awareness & Training
- 27 Security News & Breaches
- 19.9K General
- 9 Conferences & Events
- 10 Computer Gaming
- 3 Data Center
- 38 Classifieds
- 25 For Sale
- 4 Wanted (ISO)
- 8 Help Wanted
- 10 Just for Fun
- 17.4K Off-Topic
- 9 Scripting
- 2 Show Us Your Tech!
- 6 Troubleshooting
- 2.4K Virtualization

## Comments

1,506Member128 (1 additional bit)

192 (2 additional bits)

224 (3 additional bits)

240 (4 additional bits)

248 (5 additional bits)

252 (6 additional bits)

254 (7 additional bits)

255 (8 additional bits)

Class A subnet mask is 255.0.0.0 (8bits); when subnetted to 255.252.0.0, you are adding 6 bits to be used for additional subnets, 2^6 = 64, this meets the requirements for 50 subnets, 5 bits (.248 ) won't work because 2^5 = 32 which is <50.

Also, you should know that IPv4 addresses are 32 bits, so 32-8-6=18 bits are available for addressing the hosts within each subnets. In other words, 255.252.0.0 will support 64 subnets each with 2^18 - 2 host addresses (You need to subtract 2 because of the network/broadcast addresses)

4,212Member ■■■■■■■■□□To answer your question...

A class A address defaults to a 255.0.0.0 mask. The question is asking you to divide it so there is exactly 50 subnets. It doesn't say this directly, but if you divided it into 51 or more subnets, then you would no longer to have the maximum hosts possible.

2^x=50 is the equation that you need.

2^1=2 (not enough)

2^2=4 (not enough)

2^3=8 (not enough)

2^4=16 (not enough)

2^5=32 (not enough)

2^6=64 (more than enough, we only needed 50 subnet, but we are going to get 64)

So we must give 6 more bits to the network address.

Default mask: 11111111.00000000.00000000.00000000

New mask: 11111111.11111100.00000000.00000000

Convert the new mask into decimal, and you have 255.252.0.0

Decide what to be and go be it.4,212Member ■■■■■■■■□□I should say that 2^x >= 50 is the equation that you are looking for. The reason being, if your boss asks for 50 subnets, and you give him 32, there is going to be trouble. If he asks for 50, and you give him 64, then you have an extra 14 subnets for if your company expands.

And yes, you could have borrowed 7 bits, and given him 128 subnets. But now you don't have the maximum number of hosts per subnet. As number of subnets increases, the number of potential hosts goes down. As the number of subnets decreases, the number of potential hosts go up.

Decide what to be and go be it.74Member ■■□□□□□□□□I just remembered something I heard in the video. From 1995 and prior you had to subtract -2 from the subnets because of the routers. Perhaps this Question sheet wanted me to subtract two and therfore I would have had to go with 2^3=8 which would in fact give me 255.255.224.0

4,212Member ■■■■■■■■□□There is probably the issue.

For me, I subtract 2 if I am given the number of hosts. But do not subtract 2 if given the number of subnets. You do not need to lose 2 subnets, but you will lose 2 possible addresses because of the network address and the broadcast address.

Just remember, that when a bit in the mask is a 1, it is used for the network and when it is a 0, it is used for the host. So when you are working on a problem that says you have a class B address and need to have 500 hosts per subnet you do the following.

2^x-2=500

2^x=502

x=9

Since you are working with hosts, this means that you need to have at least 9 0's.

So your mask could be anything from 255.255.0.0 to 255.255.254.0, but there will likely be a second part of the question to determine what the answer is, such as "while having the most number of subnets." (which would make the answer 255.255.254.0)

Just a note, I usually use shorthand to write subnet masks. 255.255.255.0 is the same as 11111111.11111111.11111111.00000000 but I will only usually write out the binary for the octet that the change occurs in. So for your initial problem, I would use something like 255.11111100.0.0 just to save time and space. I will only convert to full binary when I am finished with the problem. I'm not fluent enough with subnetting to look at 224 and instantly know that it is 11100000 so I work it out and write it down. If my way doesn't make sense to you, don't use it. There are a thousand ways to subnet, pick the one that works for you.

Decide what to be and go be it.74Member ■■□□□□□□□□