Subnetting becomes an important topic in networks.This is core of networks how network addresses are being assigned.Students find difficulty in solving the questions on subnetting. This article will help you to solve questions on subnetting.
There are currently five different field patterns in use, each defining a class of addresses. The different classes are designed to cover the needs of different types of organisations.An IPV4 Address is represented by 32 bits. Division of bits is done on the basis according to class type. A part of address denotes network ID. Another part denotes host ID.
Class A,B,C are used for addressing.The first octet determines the type of class.
0-127 → Class A
128-191 → Class B
192-223 → Class C
234- 239 → Class D
240- 255 → Class E
Allocation of Host and Network Id In Classes
In class A first bit 0 is fixed , for class B two bit 10 is fixed , for class C three bits 110 is fixed. As shown above in class A first 8 bits are reserved for network id and 24 for host id. In class B first 16 bits are reserved for network id and next 16 bits are reserved for host id. Class D and Class E is not in use. So no allocation of network and host bits.
As above there are 2 levels of hierarchy, network and host. Subnet introduces third level of hierarchy, network, subnet and host.
network id host id
subnet id and host id
It means host id is further divided into subnet and host.
For eg:- in class A first 8 bits are reserved for network id, the next 24 bits can be divided into subnet id and host ID.
To have subnet of IP address we use subnet mask.
Also read : Best Books for GATE-CSE by Toppers
A subnet mask is sequence of 1 & 0’s which determines which is subnet id to host id.
Class A -> 255.0.0.0
Class B -> 255.255.0.0
Class C -> 255.255.255.0
Types of Subnet Mask
Subnet Mask can be two types : Natural and customed. Natural mask are mask defined above for class A,class B,class C. Customed mask is used to determine according to needs, what is subnet id and host id.
Example: suppose 10.5.0.20 is network address
Natural mask should be 255.0.0.0
If use custom 255.255.0.0
10→ network id
5→ subnet id
0.20 → host id (16 bits for host id, if we have used natural mask then we we had 24 bits for host id. Customed mask enables to assign subnets according to requirements of organization)
Tips To Remember
10.5.0.26 -------------------and-----------255.0.0.0 => 10.5.0.0
[Mask only does ‘and’ operation and we get starting address of network]
The bytes in IP address that correspond to 255 in mask will be repeated in subnetwork address
ip address 45 20 25 0
mask 255 0 0 0
45 0 0 0
The bytes in IP address that correspond to 0 in mask will change 0 in subnetwork address as shown above
For other bytes, use network and operator
IP address. 45 123 21 8
Mask 255 192 0 0
45 64 0 0
The number after slash 126.96.36.199/18, Determines number of left mask bits to be used for network mask.
for this subnet mask will be 11111111.11111111.11000000.00000000
The number of host address is 2host id – 2
for example, In class A the number of host address is 224 – 2
and Number of network addresses is 28 – 2
To determine mask of variable number we check the number of subnet and the number of host per network required
2x – 2 = subnets
where, x is number of subnet bit in mask
2x – 2 = host
x is number of host bit in mask
Questions From GATE
A company has a class C network address of 188.8.131.52. It wishes to have three subnets, one with 100 hosts and two with 50 hosts each. Which one of the following represents a feasible set of subnet address/subnet mask pairs?
Since it is class C, we can create subnetting in last octet only. First 3 octet are fixed
In last octet
we need 2 subnets,
128 host address
128 host address
The second subnet of 128 host address can be further divided into 2 blocks of 64 address each that will fulfill our requirement
The address range in lass octet can start from
We can treat this as 2 blocks
- Let us consider 10000000 – 11111111] to 1 block of 128 address
- In next block 00000000, it is further divided into 2 blocks of which first 2 bits are
It can be written as
Mask (here 2 bits are fixed)
when one bit is fixed ,
mask is 255.255.255.128 '10000000'
The no. of addresses are 256-128= 128
when two bit is fixed
mask is 255.255.255.192
The no. of addresses are = 256-192= 64
Hence answer is d
Find the net id and host id for each address
First find the class and then find the net id and host id
- Class A, net id:4 host id 23.145.90
- Class D, no host id or net id
- Class E, no host id or net id
- Class B, net id:129.6 host id 8.4
- Class C, net id:198.76.9 host id 23
The address of a class is to be split into subnet with 6 – bit subnet number. What is the maximum number of subnets and the maximum number of hosts in each subnet?
- 62 subnets and 262142 hosts
- 64 subnets and 262142 hosts
- 62 subnets and 1022 hosts
- 64 subnets and 1024 hosts
The class B is defined as follows
0 16 31
1 0 net id host id
The maximum number of subnet = 26 – 2 = 62
The maximum number of host in each subnet = 210 =1024 – 2 = 1022
Best Wishes !!
Enroll in Mentor Program and Avail your Personalized Mentor for GATE 2017 Preparation and Doubts Clarification!
What aspirants need is the right approach along with concrete strategies to reach their goals. GATE GUARANTEE PACK has been the choice of successful GATE toppers all over India.
It is the perfect online tool to check your level of preparedness among st students preparing all over the country where you study under guidance of mentors.