What is the purpose of a subnet mask, and how is it used in IP addressing?

๐Ÿ”น What is a Subnet Mask & How is it Used in IP Addressing?

1๏ธโƒฃ What is a Subnet Mask?

A subnet mask is a 32-bit number that helps divide an IP address into network and host portions. It determines which part of an IP address belongs to the network and which part identifies a specific device (host) within that network.


2๏ธโƒฃ How Does a Subnet Mask Work?

Each IP address consists of two parts:
โœ” Network Portion (Identifies the network)
โœ” Host Portion (Identifies devices within the network)

A subnet mask helps differentiate these two parts.

Example (IPv4 Addressing):

๐Ÿ“Œ IP Address: 192.168.1.10
๐Ÿ“Œ Subnet Mask: 255.255.255.0

๐Ÿ”น Network Portion: 192.168.1 (determined by 255.255.255.0)
๐Ÿ”น Host Portion: .10 (specific device in the network)

This means all devices with IPs 192.168.1.x belong to the same network.


3๏ธโƒฃ Common Subnet Masks & Their Uses

Subnet MaskCIDR NotationNumber of HostsUse Case
255.0.0.0/8~16 millionLarge organizations
255.255.0.0/16~65,000Medium-sized networks
255.255.255.0/24254 hostsSmall office/home networks
255.255.255.128/25126 hostsSubdividing a /24 network

4๏ธโƒฃ Why is a Subnet Mask Important?

โœ… 1. Efficient IP Address Allocation โ€“ Prevents waste of IP addresses.
โœ… 2. Improves Network Performance โ€“ Reduces broadcast traffic.
โœ… 3. Enhances Security โ€“ Isolates networks for better control.
โœ… 4. Enables Subnetting โ€“ Allows creating multiple smaller networks from a larger one.


5๏ธโƒฃ Example: How Subnet Masks Help Identify Networks

Letโ€™s compare two IP addresses:
๐Ÿ”น 192.168.1.5 and 192.168.2.8
๐Ÿ”น Subnet Mask: 255.255.255.0

๐Ÿ‘‰ The first three octets (192.168.1) define the network.
๐Ÿ‘‰ Since 192.168.1.5 and 192.168.2.8 have different third octets, they belong to different networks.


6๏ธโƒฃ Summary

๐Ÿ”น A subnet mask helps separate network & host portions of an IP address.
๐Ÿ”น It determines which devices can communicate within a network.
๐Ÿ”น Used to optimize IP address allocation & improve security.

0
Subscribe to my newsletter

Read articles from Ravi Vishwakarma directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ravi Vishwakarma
Ravi Vishwakarma