# Calculating number of bits for host reservation

errorken
■□□□□□□□□□ Posts:

**21**Member ■□□□□□□□□□
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 ?

#### 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.9K All Categories
- 120 Welcome Center
- 20 Announcements
- 3 Forum Rules of Engagement
- 62 Introduce Yourself
- 34 TechExams Support
- 87.5K Certification Preparation
- 131 Check Point: CCSA & CCSE
- 32.8K Cisco
- 21.5K CCNA & CCENT
- 368 CCDA & CCDP
- 8.9K CCNP
- 1.7K CCIE
- 412 Cloud Certifications
- 154 Amazon Web Services (AWS)
- 7 Azure
- 103 CCSP
- 73 Cloud+ & Cloud Essentials
- 15.4K CompTIA
- 5K A+
- 223 CASP+
- 92 CySA+
- 970 Linux+
- 4.4K Network+
- 23 PenTest+
- 259 Project+
- 3.8K Security+
- 329 Server+
- 249 Other CompTIA Certifications
- 1.2K EC-Council
- 583 CHFI
- 600 CEH
- 1.3K GIAC
- 27 IAPP
- 960 ISACA
- 11 CRISC
- 265 CISA
- 670 CISM
- 4.2K (ISC)²
- 600 CISSP
- 32 CSSLP
- 3.6K SSCP
- 921 Juniper
- 720 LPI, Red Hat & Linux Foundation
- 18.5K Microsoft
- 135 MCSA 2016 / MCSE 2016
- 159 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
- 144 Offensive Security: OSCP & OSCE
- 2K Other Security Certifications
- 334 Virtualization Certifications
- 231 Citrix Certifications
- 96 VMware
- 1.9K Other Certifications
- 6 Business Analyst Certifications
- 387 CWNP Certifications
- 859 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.6K Education & Development
- 35 Colleges & Schools
- 32 Educational Resources
- 17.5K IT Jobs / Degrees
- 34 Professional Development
- 86 Cybersecurity
- Forensics
- 1 Pentesting
- 4 Cloud Security & IoT
- 8 OWASP
- 28 Security Awareness & Training
- 32 Security News & Breaches
- 19.9K General
- 13 Conferences & Events
- 12 Computer Gaming
- 3 Data Center
- 43 Classifieds
- 26 For Sale
- 6 Wanted (ISO)
- 9 Help Wanted
- 11 Just for Fun
- 17.4K Off-Topic
- 9 Scripting
- 2 Show Us Your Tech!
- 7 Troubleshooting
- 2.4K Virtualization

## Comments

12,314Banned ■■■■■■■■□□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,343BannedI'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.