What is Subnet Mask ?
What is Subnet Mask ?
A subnet mask is a key element in IP networking used to determine which part of an IP address belongs to the network and which part identifies a host within that network. It works by "masking" the network portion of the IP address.
- Like an IP address, a subnet mask consists of 32 bits for IPv4 and is usually represented in dotted decimal format (e.g., 255.255.255.0).
- Subnet masks help divide large networks into smaller subnetworks, enhancing routing efficiency.
- A subnet mask is composed of contiguous 1s followed by contiguous 0s.
- The 1s represent the network portion of the address, while the 0s represent the host portion.
- For an IPv4 address 192.168.10.100, with a subnet mask of 255.255.255.0
In binary:
IP address : 11000000.10101000.00001010.01100100
Subnet Mask: 11111111.11111111.11111111.00000000
Here, the first 24 bits (192.168.10) represent the network, and the last 8 bits (100) represent the host. The subnet mask allows devices to:
- Identify their own network segment.
- Determine whether another device is within the same network or needs routing.
- Class A: 255.0.0.0 or /8
- Class B: 255.255.0.0 or /16
- Class C: 255.255.255.0 or /24