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 Mask | CIDR Notation | Number of Hosts | Use Case |
255.0.0.0 | /8 | ~16 million | Large organizations |
255.255.0.0 | /16 | ~65,000 | Medium-sized networks |
255.255.255.0 | /24 | 254 hosts | Small office/home networks |
255.255.255.128 | /25 | 126 hosts | Subdividing 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.
Subscribe to my newsletter
Read articles from Ravi Vishwakarma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
