Subnet or Subnetwork is a logically dividing of an IP Address. The process of dividing a network into two or more networks is called subnetting.
Creating subnetworks is essentially the act of taking bits from the host portion of the address and reserving them to define the subnet address
instead. Clearly this will result in fewer bits being available for defining your hosts.
For the subnet address scheme to work, every machine on the network must know which part of the host address will be used as the subnet address. This condition is met by assigning a subnet mask to each machine. A subnet mask is a 32-bit value that allows the device that’s receiving IP packets to distinguish the network ID portion of the IP address from the host ID portion of the IP address. This 32-bit subnet mask is composed of 1s and 0s, where the 1s represent the positions that refer to the network subnet addresses.
CIDR allows the creation of networks of a size other than those allowed with the classful subnetting by allowing more than the three classful
subnet masks. It’s basically the method that Internet service providers (ISPs) use to allocate a number of addresses to a company, a home—their
customers. They provide addresses in a certain block size.
For example, a Class A default subnet mask, which is 255.0.0.0. This tells us that the first byte of the subnet mask is all ones (1s), or 11111111. When referring to a slash notation, you need to count all the 1-bits to figure out your mask. The 255.0.0.0 is considered a /8 because it has 8 bits that are 1s—that is, 8 bits that are turned on. A Class B default mask would be 255.255.0.0, which is a /16 because 16 bits are ones (1s): 11111111.11111111.00000000.00000000.
255.0.0.0 - /8
255.128.0.0 - /9
255.255.0.0 - /16
255.255.240.0 - /20
Step 1. Get Block size
Subtract the last octate of subnetmask from 256
i.e 256 -[last octate sm]= ?
Step 2. Get number of Subnets
i.e no, of subnets = (2)n
here n=how many bits in last octate are used
Step 3. Know the Valid host number
i.e number of valid host = (2)H-2
here h= unused bits on last octate and 2 is subtracted for broadcast and network id
Q: Subnet 192.168.10.1/25
Here, IP = 192.168.10.1 & Subnet mask = 255.255.255.128
Step 1. Block Size
Step 2. No. of Subnets
Step 3. No. of valid host
When we subnet 192.168.10.1/25 we get 2 subneted network with block size 128 where 126 host are valid.