OR Just count the remaining host bits after you borrowed bits from finding subnet
# Number of host bits since network add & broadcast add
2^n - 2
Great example
10.217.182.223/11
network address = ?
broadcast address = ?
first usable address = ?
last usable address = ?
number of host (usable) address = ?
First step:
10.217.182.223 /11
# First we have to convert the 217
# Why we only convert the 2nd octet to binary?
# Because it is /11 which is located in 2nd octet
10.11011001.0.0 = 10.217.0.0
# Convert the remaining network portion of the address from /11
10.11000000.0.0 = 10.192.0.0 network address
Like this
Second step
For the first usable address
Just add a 1 into the last octet
Third step
For broadcast address
# JUST CONVERT THE REMANING HOST BITS ALL TO 1
# From
10.11011001.10110110.11011111 = 10.217.182.223
# To
10.11011111.11111111.11111111 = 10.223.255.255 broadcast address
Fourth step
For you to determine the usable hosts
# We have 21 host bits which is the orange
# -2 since we have to exclude the network address and broadcast address
2^21 - 2 = 2,097,150 usable hosts per subnet
Example:
10.0.0.0/8 ===== 2000 subnets
# 11 is the borrowed bits
2^11 = 2048 subnets
11 borrowed bits means /19
# 19 is the position in octets
# 32 is the overall count for 4 octets (8+8+8+8)
19 - 32 = 13 remaining host bits
13 is the host bits
# -2 since we have to exclude the network and broadcast address
2^13 - 2 = 8190 hosts
Now we have
2048 subnets === 8190 hosts
Example:
You need to divide this network into 5 subnets
192.168.255.0/24 ====== 5 subnets
First step:
We have to find the right subnet to us. We will borrow to the host portion of the IP
# In binary form the last octet
# Why the last octet only?
# Because it starts with /24
# So you dont have to touch other octets
192.168.255.00000000
Then we will find the subnet using this formula
# x is the borrowed bit from host portion
2^x
Let's try finding number of subnet
2^1 = 2 subnet
2^2 = 4 subnet
# We will stop since we got 8 it will be enough for 5 subnets
2^3 = 8 subnet
The 3 is the borrowed bits 3 which means /27 in binary format
Our new IP address and prefix
192.168.255.0/27
2^3 = 8 subnets
0 0 0 0 0 0 0 0
128 64 32 16 8 4 2 1
Second step:
You will just put 1 in the specific target like /27 or in order number 27
After that you just have to +32 +32 +32 +32
Why 32? Because it is on slot 27 or /27 (see it in binary form, count it)
If it is /26 then it will be +64 +64 +64 +64
If it is /28 then it will be +16 + 16 +16 +16
192.168.255.00000000 = 192.168.255.0 network address
192.168.255.00100000 = 192.168.255.32 network address
192.168.255.01000000 = 192.168.255.64 network address
192.168.255.01100000 = 192.168.255.92 network address
192.168.255.10000000 = 192.168.255.128 network address
# THE OTHER 3 SUBNET WHICH IS EXTRA
192.168.255.160 network address
192.168.255.192 network address
192.168.255.224 network address
OVERALL = 8 SUBNETS
BUT YOU ONLY NEED = 5 SUBNETS
Example:
what subnet does 172.21.111.201/20 belong to?
ANS: = 172.21.96.0 network address
172.21.01101111.0 = 172.21.111.0
# Just turn 0 the host portion of the IP
# Except /20 backwards
# So 64 + 32 = 96
# That is why we have 96 in IP
172.21.01100000.0 = 172.21.96.0 network address
Example:
What is the broadcast address of 192.168.91.78/26 belongs to?
ANS = 192.168.91.127 broadcast address
192.168.91.01001110 = 192.168.91.78
# Just put flip 1 in /26 or slot 26
192.168.91.01000000 = 192.168.91.64 network address
# Just flip the 0 to 1 for you to get the broadcast address
192.168.91.01111111 = 192.168.91.127 broadcast address