cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3945
Views
0
Helpful
3
Replies

When it comes to subnetting when do you subtract 2 from the subnet or host?

wrainwater
Level 1
Level 1

for example 

 

172.16.1.1 /30 or 255.255.255.252

252 = 1111 1100

That means 2^6 = 64 and 2^2-2 = 2

 

I checked a subnet chart and found out a /30 has 64 subnets and  2 hosts per subnet.

 

This has tricked me before. Originally I did 2^6-2 which gives you 62. So my question is when do you subtract 2 from either the subnet or the host??

3 Replies 3

Francesco Molino
VIP Alumni
VIP Alumni

Hi

I believe you've a confusion.
The formula 2^n-2 is to calculate the number of hosts in a prefix. N in this formula correspond to all zero in your mask binary conversion.
In your example, you have 2 zeros, which means:
2^2-2=4-2=2 --> you can validate that /30 can have 2 hosts.
The -2 corresponds to broadcast and network address.
For some specific cases like point to point links, you don't need a broadcast and network address which means that you can use /31.


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

natuan
Level 1
Level 1

Hi there,

 

I don't agree this: "I checked a subnet chart and found out a /30 has 64 subnets and  2 hosts per subnet."

Example:

10.0.1.0/24  = (10.0.0000 0001).(0000 0000) / 255.255.255.0

(10.0.0000 0001) : It is the net ID

(0000 0000) : It is the host ID

total IP in this "subnet": 256.

Total IP can assign for host: 254

You can read the book how to master CCNA or other books.

I sympathize that when you are learning about subnetting it can be confusing when you subtract 2 and when you do not since the formulas are so very simple. Francesco makes a good point that when you are talking about how many hosts in a subnet that you subtract 2 since most subnets have two addresses that are reserved and can not be used for host addressing. These are the address of the subnet itself and the broadcast address of the subnet.

 

In modern practice when calculating the number of subnets in a network there is not any need to subtract anything and all subnets are valid. If you read some old documentation there are references about subtracting from the number of subnets. In the early development of IP addressing and subnetting there was a restriction about using subnet zero. So some references might suggest subtracting 1. I have seen some references about subtracting 2 (just like you do for hosts) but I never understood them because there was never any concept of a broadcast subnet. So for calculating the number of subnets do not subtract anything.

 

HTH

 

Rick

HTH

Rick
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: