Subnetting: Subnet Mask
Subnetting: Subnet Mask
IP address is a 32-bit binary number. It consists of two parts. Network part and Host Part.
Subnet Mask
Subnet mask is also a 32-bit binary number which consists of 1's and 0's which tells the
host(the device to which the IP address is assigned) which bit in the IP address is Network
bit and which bit is Host bit.
Subnet mask allocates an each bit for each bit of IP address. If IP bit is a network bit, then
the assigned subnet mask bit will be 1. If IP bit is a host bit, assigned subnet mask bit will
be 0.
Lets say the IP address is 10.1.1.1 and subnet mask is 255.0.0.0
In binary form
10.1.1.1--> 00001010 00000001 00000001 00000001 (IP address)
255.0.0.0--> 111111111 00000000 00000000 00000000 (Subnet Mask)
From the above IP address and subnet mask pair, you can see that for each bit of ip
address there is a corresponding subnet mask bit. A 1 in the subnet mask bit indicates that
the corresponding bit in the IP address is a Network bit and a 0 in the subnet mask bit
indicates that the corresponding bit in the IP address is a host bit.
So from the above we can see that the first eight bits of of subnet mask are 1’s. This
means that the first 8 bits of the ip address are network bits and remaining 24 bits are host
bits as the concerned subnet mask bits are 0’s
1st 8 bits in IP address Remaining 24 bits are host bits because their
Are network bits Corresponding subnet mask bits are 0’s
IP 10.1.1.1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1
address
Subnet 255.0.0.0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mask
A 0 in the subnet mask indicates that particular position bit in the IP address
is a Host bit.
The below table shows the list of subnet masks on the left side and IP address bits as N or
H where N=>Network bit and H=>Host bit.
Now i will write the 32 bit subnet mask by adding a dot (.) after each octet as shown below.
10000000.00000000.00000000.00000000
Now i will convert each octet which is in binary in to decimal.
Lets consider the 1st octet which is 10000000.
we have to mark the position of each bit starting from the right hand side to the left hand
side.The right hand side bit starts with position “0” and moving towards the left hand side
by increasing one number till the end. That is left hand side. Since there are 8 bits and if
the right most bit is having the 0 position then the next bit is 1 and the right most bit is 7 as
shown below.
Lets say P is the position of the bit which can be from 0 to 7 .
20= 1
21= 2
22= 4
23= 8
24= 16
25= 32
26= 64
27= 128
128+0+0+0+0+0+0+0=128
11000000=
=1x27 + 1x26 + 0x25 + 0x24 +0x23 + 0x22 +0x21 +0x20 =
=128+64+0+0+0+0+0+0=192
11100000
= 1x27 + 1x26 + 1x25 + 0x24 +0x23 + 0x22 +0x21 +0x20
=128+64+32+0+0+0+0+0+0
=224
11110000
= 1x27 + 1x26 + 1x25 +1x24 +0x23 + 0x22 +0x21 +0x20
=128+64+32+16+0+0+0+0
=240
11111000
= 1x27 + 1x26 + 1x25 + 1x24 +1x23 + 0x22 +0x21 +0x20
=128+64+32+16+8+0+0+0
=248
11111100
= 1x27 + 1x26 + 1x25 + 1x24 +1x23 + 1x22 +0x21 +0x20
=128+64+32+16+8+4+0+0
=252
11111110
= 1x27 + 1x26 + 1x25 + 1x24 +1x23 + 1x22 +1x21 +0x20
=128+64+32+16+8+4+2+0
=254
111111111
= 1x27 + 1x26 + 1x25 + 1x24 +1x23 + 1x22 +1x21 +1x20
=128+64+32+16+8+4+2+1
=255
10000000.00000000.00000000.00000000
1stoctet 2ndoctet 3rdoctet 4thoctet
128 0 0 0
10000000.00000000.00000000.00000000= 128.0.0.0
11000000.00000000.00000000.00000000= 192.0.0.0
11100000.00000000.00000000.00000000= 224.0.0.0
The complete possible list of subnet mask values are shown in the below table both
in binary and decimal formats.
Table: Subnet Mask list in binary and decimal format.
All the IP address are by default divided in five classes. They are Class A,B,C,D and E.
For subnetting we will be only interested in Class A,B and C as class D and E are
reserved.
Class B
Class C
Note:- Last 2 bits(31 & 32) are reserved for host portion.
Class Subnet First Octet Maximum hosts Total
Mask range Networks
Class A 255.0.0.0 1-126 224-2=16,777,214 27=128
Class B 255.255.0.0 128-191 16
2 -2=65,534 214=16,384
Each network from the above classes(class A, Class B or class C) which is having a
default subnet mask is called a classful network. Which means when i say the classful
network, a network with default subnet mask.
So we need to create subnetworks like where there are less no of hosts and more
networks. Then only we can use them according to our requirement.
For this purpose we will convert the available host bits in the classful networks(networks
with default subnet mask) to network bits.The resulting additional network bits after
conversion are called the subnet bits. And the resulting smaller networks after conversion
are called subnets( means sub-network).
Subnetting means borrowing few bits from the host bits and making them as subnet bits.
Interesting Octet:- Interesting octet is the octet in the subnet mask which is used to
calculate the block size. Normally interesting octet is the octet in the subnet mask whose
value is not either 0 or 255 except for two cases. For class A or B network if the subnet
mask given is 255.255.255.0 then interesting octet is 3 rd octet. For class A networks if the
subnet mask is 255.255.0.0 then interesting octet is 2 nd,
Note:- Interesting octet for class C network is always the 4 th octet.
Block Size:- Block size is the total number of IP addresses between two consecutive or
successive subnets.
The first subnet id is same as the Class A, B or C network ID which we are going to
subnet. So, we have to just copy the Network ID and make it as the first subnet id.
Example 1:-
Find the number of subnets and number of hosts for the network 192.168.1.0 with the
subnet mask 255.255.255.128 ?
Answer:
1)The first step is to identify the class of the given network 192.168.1.0. The network
192.168.1.0 belongs to Class C .
4) If we compare the default subnet mask with the given subnet mask then we notice that
the one host bit(0) is converted to network bit(1). That converted bit is called the subnet bit
. So
Number of subnet bits S=1 and
Number of Host bits H=7
5) Number of subnets=2S=21=2
and Number of hosts = 2H-2=27-2=128-2=126
6) Since 192.168.1.0 is a class C network, the interesting octet is 4 th octet which is 128
9)For the next subnet just write the first three octet’s as it is . And for the fourth octet we
have to add the block size in the last octet(interesting octet position) which is 0+128=128.
Hence the second subnet is 192.168.1.128
10) The last subnet would be the subnet where the interesting octet (here its 4 th octet)
reaches a value equal to interesting octet subnet mask value. The second subnet
192.168.1.128, the 4th octet(interesting octet) is equal to block size which is 128. So the
subnet 192.168.1.128 is the last subnet.
Example 2:-
Network -->192.168.1.0 and subnet mask is 255.255.255.192
Find the No of subnets and the No of hosts per subnet ?
Answer:
1)The first step is to identify the class of the given network 192.168.1.0. The network
192.168.1.0 belongs to Class C.
2) Given subnet mask is 255.255.255.192.
5) Number of subnets=2S=22=4
and Number of hosts = 2H-2=26-2=64-2=62
6) Since 192.168.1.0 is a class C network, the interesting octet is 4 th octet which is 192 in
this case.
9)For the next subnet just write the first three octet’s as it is . And for the fourth octet we
have to add the block size in the last octet(interesting octet position) which is 0+64=64.
Hence the second subnet is 192.168.1.64 and we should keep doing the same for the
remaining subnets
10) The last subnet would be the subnet where the 4 th octet (here its 4th octet) reaches a
value equal to interesting octet subnet mask value. The fourth subnet 192.168.1.192, the
4th octet(interesting octet) is equal to interesting octet subnet mask value, which is 192. So
the subnet 192.168.1.192 is the last subnet.
So the subnets are 192.168.1.0,192.168.1.64, 192.168.1.128 & 192.168.1.192.
192.168.1.129
192.168.1.130
192.168.1.131
.
.
.
.
192.168.1.190
Example 3:-
Answer:
1)The first step is to identify the class of the given network 192.168.1.0. The network
192.168.1.0 belongs to Class C .
4) If we compare the default subnet mask with the given subnet mask then we notice that
the three host bits(0’s) are converted to network bits(1’s). That converted bits are called
the subnet bits . So
Number of subnet bits S=3 and
Number of Host bits H=5
5) Number of subnets=2S=23=8
and Number of hosts = 2H-2=25-2=32-2=30
6) Since 192.168.1.0 is a class C network, the interesting octet is 4 th octet which is 224 in
this case.
9)For the next subnet just write the first three octet’s as it is . And for the fourth octet we
have to add the block size in the last octet(interesting octet position) which is 0+32=32.
Hence the second subnet is 192.168.1.32 and we should keep doing the same for the
remaining subnets
10) The last subnet would be the subnet where the 4 th octet (here its 4th octet) reaches a
value equal to interesting octet in subnet mask value. The eigth subnet 192.168.1.224, the
4th octet(interesting octet) is equal to interesting octet subnet mask value, which is 224. So
the subnet 192.168.1.224 is the last subnet.
So the subnets are as follows
192.168.1.225
192.168.1.226
192.168.1.227
.
.
.
.
192.168.1.255
Example 4:-
Answer:
1)The first step is to identify the class of the given network 192.168.1.0. The network
192.168.1.0 belongs to Class C .
4) If we compare the default subnet mask with the given subnet mask then we notice that
the four host bits(0’s) are converted to network bits(1’s). That converted bits are called the
subnet bits . So
Number of subnet bits S=4 and
Number of Host bits H=4
5) Number of subnets=2S=24=16
and Number of hosts = 2H-2=24-2=16-2=14
6) Since 192.168.1.0 is a class C network, the interesting octet is 4 th octet which is 240 in
this case.
9)For the next subnet just write the first three octet’s as it is . And for the fourth octet we
have to add the block size in the last octet(interesting octet position) which is 0+16=16.
Hence the second subnet is 192.168.1.16 and we should keep doing the same for the
remaining subnets
10) The last subnet would be the subnet where the 4 th octet (here its 4th octet) reaches a
value equal to interesting octet value in subnet mask value. The sixteenth subnet
192.168.1.240, the 4th octet(interesting octet) is equal to interesting octet value in subnet
mask value, which is 240. So the subnet 192.168.1.240 is the last subnet.
So the subnets are as follows
Subnet 192.168.1.0
Network Address 192.168.1.0
Broadcast Address 192.168.1.15
First host address 192.168.1.1
Last host address 192.168.1.14
Subnet 192.168.1.16
Subnet 192.168.1.32
Subnet 192.168.1.48
Subnet 192.168.1.64
Subnet 192.168.1.80
Network Address 192.168.1.80
Broadcast Address 192.168.1.95
First host address 192.168.1.81
Last host address 192.168.1.94
Subnet 192.168.1.96
Subnet 192.168.1.112
Subnet 192.168.1.128
Subnet 192.168.1.144
Subnet 192.168.1.176
Subnet 192.168.1.192
Subnet 192.168.1.208
Subnet 192.168.1.224
Subnet 192.168.1.240
Answer:
1)The first step is to identify the class of the given network 192.168.1.0. The network
192.168.1.0 belongs to Class C .
2) Given subnet mask is 255.255.255.248.
3) Class C Default Subnet Mask is 255.255.255.0
255.255.255.0 in binary is 11111111.11111111.11111111.00000000
4) If we compare the default subnet mask with the given subnet mask then we notice that
the five host bits(0’s) are converted to network bits(1’s). That converted bits are called the
subnet bits . So
5) Number of subnets=2S=25=32
and Number of hosts = 2H-2=23-2=8-2=6
6) Since 192.168.1.0 is a class C network, the interesting octet is 4 th octet which is 248 in
this case.
9)For the next subnet just write the first three octet’s as it is . And for the fourth octet we
have to add the block size in the last octet(interesting octet position) which is 0+8=8.
Hence the second subnet is 192.168.1.8 and we should keep doing the same for the
remaining subnets
10) The last subnet would be the subnet where the 4 th octet (here its 4th octet) reaches a
value equal to interesting octet value in subnet mask value. The thirty two subnet
192.168.1.248, the 4th octet(interesting octet) is equal to interesting octet value in subnet
mask value, which is 248. So the subnet 192.168.1.248 is the last subnet.
Subnet 192.168.1.0
Subnet 192.168.1.8
Subnet 192.168.1.16
We have to follow the same procedure for the remaining subnets. I am writing the details
for the last subnet which is 192.168.1.248
Subnet 192.168.1.248
Example 6:-
Answer:
1)The first step is to identify the class of the given network 192.168.1.0. The network
192.168.1.0 belongs to Class C .
4) If we compare the default subnet mask with the given subnet mask then we notice that
the six host bits(0’s) are converted to network bits(1’s). That converted bits are called the
subnet bits . So
5) Number of subnets=2S=26=64
and Number of hosts = 2H-2=22-2=4-2=2
6) Since 192.168.1.0 is a class C network, the interesting octet is 4 th octet which is 252 in
this case.
Subnet 192.168.1.0
Subnet 192.168.1.4
Subnet 192.168.1.8
We have to follow the same procedure for the remaining subnets. I am writing the details
for the last subnet which is 192.168.1.252
Subnet 192.168.1.252
Class B Subnetting:-
2) The subnetting procedure will be the same as the subnetting of class C Network.
Example 1:
Answer :
1)The first step is to identify the class of the given network 172.16.0.0. The network
172.16.0.0 belongs to Class B .
4) If we compare the default subnet mask with the given subnet mask then we notice that
the one host bit(0) are converted to network bit(1). That converted bit is called the subnet
bit . So
5) Number of subnets=2S=21=2
and Number of hosts = 2H-2=215-2=32768-2=32766
6) Since 172.16.0.0 is a class B network and subnet bits are below 8, the interesting octet
is 3rd octet which is 128 in this case.
Example 2:
Answer :
1)The first step is to identify the class of the given network 172.16.0.0. The network
172.16.0.0 belongs to Class B .
4) If we compare the default subnet mask with the given subnet mask then we notice that
the two host bits(0’s) are converted to network bits(1’s). That converted bits is called the
subnet bits . So
5) Number of subnets=2S=22=2
and Number of hosts = 2H-2=214-2=16384-2=16382
6) Since 172.16.0.0 is a class B network and subnet bits are below 8, the interesting octet
is 3rd octet which is 192 in this case.
9)For the next subnet just write the all the octets except the interesting octet same. . And
for the interesting octet (here 3rd octet)we have to add the block size to the 3rd octet
value(interesting octet value) to get the next subnet 3 rd octet value. Here it is 0+64=64.
Hence the second subnet is 172.16.64.0 and we should keep doing the same till we reach
the subnet in which the interesting octet value will be same as the value in the subnet
mask, which is 192.
10) So the last subnet would be 172.16.192.0
So the subnets are as follows
172.16.0.0, 172.16.64.0, 192.16.128.0, 172.16.192.0
Network=172.16.0.0
Subnet Mask= 255.255.255.0
Answer :
1)The first step is to identify the class of the given network 172.16.0.0. The network
172.16.0.0 belongs to Class B.
2) Given subnet mask is 255.255.255.0
3) Class B Default Subnet Mask is 255.255.0.0
255.255.0.0 in binary is 11111111.11111111.00000000.00000000
255.255.255.0 in binary is 11111111.11111111.11111111.00000000
4) If we compare the default subnet mask with the given subnet mask then we notice that
the eight host bits(0’s) are converted to network bits(1’s). Those converted bits is called
the subnet bits . So
5) Number of subnets=2S=28=256
and Number of hosts = 2H-2=28-2=256-2=254
6) Since 172.16.0.0 is a class B network and subnet bits are equal to 8 bits, the interesting
octet is 3rd octet which is 255 in this case.
9)For the next subnet just write the all the octets except the interesting octet same. . And
for the interesting octet (here 3rd octet)we have to add the block size to the 3rd octet
value(interesting octet value) to get the next subnet 3 rd octet value. Here it is 0+1=1.
Hence the second subnet is 172.16.1.0 and we should keep doing the same till we reach
the subnet in which the interesting octet value will be same as the value in the subnet
mask, which is 255.
Follow the same steps for the remaining subnets. The details for the last subnet
172.16.255.0 as follows
Example 1:
Network=172.16.0.0
Subnet Mask= 255.255.255.128
1)The first step is to identify the class of the given network 172.16.0.0. The network
172.16.0.0 belongs to Class B.
2) Given subnet mask is 255.255.255.0
3)Class B Default Subnet Mask is 255.255.0.0
255.255.0.0 in binary is 11111111.11111111.00000000.00000000
255.255.255.128 in binary is 11111111.11111111.11111111.10000000
4)If we compare the default subnet mask with the given subnet mask then that nine 0’s are
converted to nine1’s. Which means nine host bits are converted to nine network bits. The
host bits which are converted to network bits are called subnet bits. So in this case S=9
and H=7
5) Number of subnets S =2S=29=512 and Number of hosts =2H-2=27-2=126
6)Interesting octet is 4th octet (Refer the table above) which is 128.
172 16 0 0
172 16 0 128
172 16 1 0
172 16 1 128
172 16 2 0
172 16 2 128
172 16 3 0
172 16 3 128
.......... .......... .......... ..........
.......... .......... .......... ..........
172 16 255 0
172 16 255 128
From the above table of subnets we can see that the first two octets are same for all the
subnets. The 3rd is same as the previous subnet till the interesting octet value is equal to
the interesting octet value in the subnet mask(in this case its 128). After that the 3 rd octet is
incrementing by one and will remain same till the fourth octet value is equal to the
interesting octet value in the subnet mask. After that the 3 rd octet is incrementing by one.
This is repeating till the 3rd octet reached the value equal to 255.
Similarly we can find the Network Address, Broadcast Address, First Host address and the
Last Host address for the remaining subnets till 172.16.255.128.
Example 2:
Network=172.16.0.0
Subnet Mask= 255.255.255.192
Answer:-
1)The first step is to identify the class of the given network 172.16.0.0. The network
172.16.0.0 belongs to Class B.
2) Given subnet mask is 255.255.255.0
3)Class B Default Subnet Mask is 255.255.0.0
255.255.0.0 in binary is 11111111.11111111.00000000.00000000
255.255.255.128 in binary is 11111111.11111111.11111111.10000000
4)If we compare the default subnet mask with the given subnet mask then that nine 0’s are
converted to nine1’s. Which means nine host bits are converted to nine network bits. The
host bits which are converted to network bits are called subnet bits. So in this case S=10
and H=6
5) Number of subnets S =2S=210=1024 and Number of hosts =2H-2=27-2=62
6)Interesting octet is 4th octet (Refer the table above) which is 192.
7)Block size=256-interesting octet value =256-192=64
8)Finding the subnets:-
The first subnet will be same as the network which is 172.16.0.0
172 16 0 0
172 16 0 0
172 16 0 0
172 16 0 0
172 16 1 64
172 16 1 64
172 16 1 64
172 16 1 64
172 16 2 128
172 16 2 128
172 16 2 128
172 16 2 128
172 16 3 192
172 16 3 192
172 16 3 192
172 16 3 192
... . .. . . . . . . . . ... . .. . . . . . . . . ... . .. . . . . . . . . ... . .. . . . . . . . .
... . .. . . . . . . . . ... . .. . . . . . . . . ... . .. . . . . . . . . ... . .. . . . . . . . .
... . .. . . . . . . . . ... . .. . . . . . . . . ... . .. . . . . . . . . ... . .. . . . . . . . .
... . .. . . . . . . . . ... . .. . . . . . . . . ... . .. . . . . . . . . ... . .. . . . . . . . .
172 16 255 192
172 16 255 192
172 16 255 192
172 16 255 192
From the above table of subnets we can see that the first two octets are same for all the
subnets. The 3rd is same as the previous subnet till the interesting octet value is equal to
the interesting octet value in the subnet mask(in this case its 128). After that the 3 rd octet is
incrementing by one and will remain same till the fourth octet value is equal to the
interesting octet value in the subnet mask. After that the 3 rd octet is incrementing by one.
This is repeating till the 3rd octet reached the value equal to 255.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Class A Subnetting[1 to 8 Subnet bits]
10.0.0.0
Subnet Mask : 255.192.0.0
Answer:-
1)The first step is to identify the class of the given network 10.0.0.0. The network 10.0.0.0
belongs to Class A.
2) Given subnet mask is 255.192.0.0
3)Class A Default Subnet Mask is 255.0.0.0
255.0.0.0 in binary is 11111111.00000000.00000000.00000000
255.192.0.0 in binary is 11111111.11000000.00000000.00000000
4)If we compare the default subnet mask with the given subnet mask then we notice that
two host bits (0’s) are converted to two1’s(network bits). Which means two host bits are
converted to two network bits. The host bits which are converted to network bits are called
subnet bits. So in this case S=2 and H=22
5) Number of subnets S =2S=22=4 and Number of hosts =2H-2=222-2=41,94,302
6)Interesting octet is 2nd octet (Refer the table above) which is 192.
Answer:-
1)The first step is to identify the class of the given network 10.0.0.0. The network 10.0.0.0
belongs to Class A.
2) Given subnet mask is 255.255.192.0
3)Class A Default Subnet Mask is 255.0.0.0
255.0.0.0 in binary is 11111111.00000000.00000000.00000000
255.255.192.0 in binary is 11111111.11111111.11000000.00000000
4)If we compare the default subnet mask with the given subnet mask then we notice that
ten host bits (0’s) are converted to ten network bits(1’s). Which means ten host bits are
converted to ten network bits. The host bits which are converted to network bits are called
subnet bits. So in this case S=10 and H=14
5) Number of subnets S =2S=210=1024 and Number of hosts =2H-2=214-2=16,382
6)Interesting octet is 3rd octet (Refer the table above) which is 192.
7)Block size=256-interesting octet value =256-192=64
8)Finding the subnets:-
The first subnet will be same as the network which is 10.0.0.0