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.