string(0) ""

Subnet Mask

What is a Subnet Mask?

A subnet mask is a fundamental component of network design used to define which IP addresses belong to a specific network. By combining a subnet mask with an IP address, the boundary between the network portion and the host portion of the address is determined. This makes it possible to divide a larger network into smaller logical subnets.

How does a Subnet Mask work?

An IPv4 address consists of 32 bits, divided into four octets. The subnet mask specifies how many of these bits are used for identifying the network and how many are reserved for individual devices (hosts).

Example:

Type Value
IP Address 192.168.1.10
Subnet Mask 255.255.255.0
Prefix Notation /24
Network Address 192.168.1.0
Usable Hosts 192.168.1.1 – 192.168.1.254

In this example, the subnet mask 255.255.255.0 (/24) shows that the first three octets (192.168.1) make up the network portion. The last octet is used to address up to 254 devices within the subnet.

Common Subnet Masks and Their Scope:

Prefix Subnet Mask Total Addresses Usable Hosts
/30 255.255.255.252 4 2
/29 255.255.255.248 8 6
/28 255.255.255.240 16 14
/24 255.255.255.0 256 254
/16 255.255.0.0 65,536 65,534
/8 255.0.0.0 16,777,216 16,777,214

Why are Subnet Masks used?

  • Efficient address allocation: Prevents IP waste by tailoring the number of hosts to the size of the network
  • Reduced broadcast traffic: Limits unnecessary traffic by segmenting networks
  • Improved security: Subnets can be isolated to allow stricter control and segmentation in sensitive environments

Frequently Asked Questions about Subnet Masks

  • How do I choose the right subnet mask?
    It depends on the number of devices. A typical office network often uses /24, while larger networks may need /16 or even /8.
  • What happens if the subnet mask is incorrect?
    Devices may fail to communicate properly—they might not reach each other, or send traffic outside the intended network.
  • What is CIDR and how does it relate to subnet masks?
    CIDR (Classless Inter-Domain Routing) is a modern way of writing subnet masks in prefix form (e.g., /24 instead of 255.255.255.0). CIDR allows more flexible allocation than the old class-based system.