# Calculating number of bits for host reservation

errorken
Member Posts:

**21**■□□□□□□□□□
My question is about calculating the number of bits to be able to represent a required number of hosts (its a basic question.

I was following the explanation at nugget lab (Subnetting Examples.pdf - "Great Exception")

I'll be quoting this to make it easy:

The way they explain it, is by searching the first exponent of 2, that represents a number lower than the number of hosts you are searching. For example, if you search 100 hosts, '64' is the first number that gets a binary '1' (since 128 is higher then 100).

x = don't care, since we allready found the highest bit. So, we will need 7 bits for the hosts.

This approach is ok, but there is a problem when you need for example 8 hosts, you'll endup with 4 bits since '1000' is binary for '8'. However, you are looking for 8 combinations, so the correct number of bits is 3, since 2³ = 8.

Now, I find my approach simpler, and it takes care of everything: just add '2' to the number of hosts you are searching, and then figure out how many bits you need to represent all the combinations (hosts).

So, if I would be ask to give the number of bits required to represent 3 hosts, then I would say 3 bits. 3 hosts + 2 hosts = 5 host, 2 bits is not enough since 2² = 4. 3 bits is enough since 2³ = 8.

Is my approach also fine ? Which is the common approach ?

I was following the explanation at nugget lab (Subnetting Examples.pdf - "Great Exception")

I'll be quoting this to make it easy:

There is a similar rule for finding the number of bits to reserve for hosts. For example, if I wanted to break a range into 25 hosts per network, I know that I'll need to save 5 bits as host bits to satisfy the requirement. This rule works fine, but does not account for the two hosts that are unusable from every range: the network IP address and the broadcast IP address. The fact that binary counting starts from zero helps us with one of those IP addresses, but we can still come up one short in certain cases. For example, if we were asked to break a network into subnets that can hold up to 31 hosts, you would assume it would take 5 bits since 31 in binary is:

0 0 0 1 1 1 1 1

However, when you work out the problem you'll find that you only get 30 hosts per subnet (1 IP address short). The same thing happens with every “full” binary number: 3, 7, 15, 31, 63, 127. So how do you avoid this issue? You can always add 1 to the number of hosts required. For example, if you're asked to break a range into 25 hosts per subnet, figure it out for 26. If you're asked to break a range into 63 subnets, figure it out for 64…and so on.

I realize this exception gets somewhat technical… so to summarize:

When subnetting based on the number of networks, SUBTRACT 1 from the number

When subnetting based on the number of hosts per network, ADD 1 to the number

The way they explain it, is by searching the first exponent of 2, that represents a number lower than the number of hosts you are searching. For example, if you search 100 hosts, '64' is the first number that gets a binary '1' (since 128 is higher then 100).

128 64 32 16 8 4 2 1 0 1 x x x x x x

x = don't care, since we allready found the highest bit. So, we will need 7 bits for the hosts.

This approach is ok, but there is a problem when you need for example 8 hosts, you'll endup with 4 bits since '1000' is binary for '8'. However, you are looking for 8 combinations, so the correct number of bits is 3, since 2³ = 8.

Now, I find my approach simpler, and it takes care of everything: just add '2' to the number of hosts you are searching, and then figure out how many bits you need to represent all the combinations (hosts).

So, if I would be ask to give the number of bits required to represent 3 hosts, then I would say 3 bits. 3 hosts + 2 hosts = 5 host, 2 bits is not enough since 2² = 4. 3 bits is enough since 2³ = 8.

Is my approach also fine ? Which is the common approach ?

#### Categories

- All Categories
- 388 Welcome Center
- 82 Announcements
- 10 Forum Rules of Engagement
- 218 Introduce Yourself
- 59 TechExams Support
- 88.7K Certification Preparation
- 131 Check Point: CCSA & CCSE
- 33K Cisco
- 21.6K CCNA & CCENT
- 370 CCDA & CCDP
- 9K CCNP
- 7 Cisco CyberOps
- 1.7K CCIE
- 541 Cloud Certifications
- 199 Amazon Web Services (AWS)
- 40 Azure
- 120 CCSP
- 79 Cloud+ & Cloud Essentials
- 15.5K CompTIA
- 5K A+
- 245 CASP+
- 114 CySA+
- 974 Linux+
- 4.4K Network+
- 35 PenTest+
- 266 Project+
- 3.9K Security+
- 335 Server+
- 252 Other CompTIA Certifications
- 1.2K EC-Council
- 586 CHFI
- 627 CEH
- 1.4K GIAC
- 47 IAPP
- 1K ISACA
- 29 CRISC
- 284 CISA
- 707 CISM
- 4.3K (ISC)²
- 666 CISSP
- 35 CSSLP
- 3.6K SSCP
- 926 Juniper
- 737 LPI, Red Hat & Linux Foundation
- 18.6K Microsoft
- 150 MCSA 2016 / MCSE 2016
- 161 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
- 537 Other Microsoft Electives
- 349 MCSA/MCSE: Security
- 300 Microsoft Developers Certifications
- 485 SQL Server exams
- 161 Offensive Security: OSCP & OSCE
- 2K Other Security Certifications
- 345 Virtualization Certifications
- 231 Citrix Certifications
- 104 VMware
- 1.9K Other Certifications
- 15 Business Analyst Certifications
- 391 CWNP Certifications
- 873 ITIL Certifications
- 220 Project Management Certifications
- 85 Apple Mac OS X Certifications
- 62 Novell Certification
- 81 Oracle Certifications
- 52 Sun Microsystems Java Certification
- 114 Storage Certifications
- 6.7K General Certification
- 18K Education & Development
- 64 Colleges & Schools
- 93 Educational Resources
- 17.7K IT Jobs / Degrees
- 76 Professional Development
- 393 Cybersecurity
- 19 Auditing & Compliance
- 16 Cloud Security & IoT
- 15 Cryptography & PKI
- 38 Cybersecurity Management
- 5 Data Science & Machine Learning
- 9 Forensics
- 8 ICS/SCADA Security
- 35 Incident Response
- 8 Linux Security
- 11 OWASP
- 33 Pentesting
- 44 Security Awareness & Training
- 53 Security News & Breaches
- 11 Windows Security
- 20.2K General
- 35 Conferences & Events
- 22 Computer Gaming
- 7 Data Center
- 86 Classifieds
- 52 For Sale
- 6 Wanted (ISO)
- 16 Help Wanted
- 17 Just for Fun
- 19 Networking
- 17.5K Off-Topic
- 21 Scripting
- Show Us Your Tech!
- 26 Troubleshooting
- 2.4K Virtualization

## Comments

12,312■■■■■■■■■□It seems easy enough to do in your head. Take whatever the required hosts are and add two. You don't need to do that for the subnet bits (in most cases - research subnet zero for more).

I do exactly what you do. It's easier and faster (at least for me). Nearly every trick I've seen just seems to make things more complicated.

Probably the best tip to keep in mind is that each subsequent bit is twice the value while each previous bit is half that value. By simply remembering that the 10th bit is

1024 and the fifth bit is 32, you can get to pretty much any reasonable value by doubling or halving that value a few times (i.e. What's the 12th bit worth? 1024*2*2 = 4096).I think the best subnetting instruction I got was from Chris Bryant. His CCNA guide or his CCNA Trainsignal videos are great.

1,343I've searched and read tons of subnetting guides. The guide from Jeremy Cioara(latest cbt nuggets instructor for ccna/ccent) has been the very fastest. After much practice with his guide and doing lots of examples, it's very easy to do complete subnetting back and forth in less than 10 seconds, in my head.

I really can't say enough about his video and pdf subnetting guides.