Subnet masks and subnetting

A subnet mask is a number that distinguishes between the network portion and the host portion of an IP address, allowing for the creation of multiple smaller networks within a larger network. Subnetting is the practice of dividing a network into these smaller sub-networks to improve management, security, and efficiency of IP address allocation.

A subnet mask splits the IP address into a network portion and a host portion by applying a binary mask. In binary terms, a ‘1’ in the subnet mask represents a bit belonging to the network portion, and a ‘0’ represents a bit belonging to the host portion. The same IP address can be associated with different subnets depending on the subnet mask applied. Example: For the IP address 192.168.1.10 with a subnet mask of 255.255.255.0, the first three octets (255.255.255) represent the network part, and the last octet (.0) represents the host part.

Classless Inter-Domain Routing (CIDR) notation

Sometimes you will be asked to represent the subnet mask in CIDR notation. It indicates the number of bits in the network portion. 255.255.255.0 in binary is 11111111 11111111 11111111 00000000 therefore the CIDR notation for that subnet is /24, 255.255.255.128 is 11111111 11111111 11111111 10000000 the CIDR notation is /25. Ideally, you should memorise these for speed in exams.

https://www.ripe.net/media/documents/IPv4_CIDR_Chart_2015.pdf