Subnet Mask & Subnetting: What is it?
โก Smart Summary
Subnetting divides a large network into smaller logical segments, improving routing efficiency, conserving scarce IPv4 addresses, and tightening security. A subnet mask, a 32-bit value, marks which bits identify the network and which identify the host.

What is Subnetting?
Subnetting is the practice of dividing a network into two or more smaller networks. It increases routing efficiency, helps to enhance the security of the network, and reduces the size of the broadcast domain.
IP subnetting designates high-order bits from the host as part of the network prefix. This method divides a network into smaller subnets. It also helps you reduce the size of the routing tables stored in routers, extend the existing IP address base, and restructure the IP address.
Why Use Subnetting?
Here are important reasons for using subnetting:
- It helps you to maximize IP addressing efficiency.
- It extends the life of IPv4, whose public addresses are scarce.
- IPv4 subnetting reduces network traffic by eliminating collision and broadcast traffic, which improves overall performance.
- This method allows you to apply network security policies at the interconnection between subnets.
- It optimizes IP network performance and facilitates spanning of large geographical distances.
- The subnetting process helps to allocate IP addresses so that large numbers of IP network addresses do not remain unused.
- Subnets are usually set up geographically for specific offices or particular teams within a business, which allows their network traffic to stay within the location.
What is Subnet Mask?
A subnet mask is a 32-bit address used to distinguish between a network address and a host address in an IP address. A subnet mask identifies which part of an IP address is the network address and which part is the host address. Subnet masks are not shown inside the data packets traversing the Internet; the packets carry the destination IP address, which a router matches with a subnet.
1 represents the network, 0 represents the hosts
Two types of subnet masks are:
- The default subnet mask is the number of bits reserved by the address class. Using this default mask accommodates a single network subnet in the relative class.
- A custom subnet mask can be defined by an administrator to accommodate many networks.
How to Use a Subnet Mask?
The subnet mask is used by the router to cover up the network address. It shows which bits are used to identify the subnet.
Every network has its own unique address. For example, a Class B network has the network address 172.20.0.0, which has all zeroes in the host portion of the address.
Example IP address: 11000001. Here the 1st and 2nd bits are 1 and the 3rd bit is 0; hence, it belongs to Class C.
How to identify which class the IP address belongs to
The example above shows how IP addresses should be deconstructed, which makes it simple for Internet routers to find the right network to route data into. However, in a Class A network there could be millions of connected devices, and it could take some time for the router to find the right device.
Methods of Subnet Masking
We can perform the subnet masking process in two ways: Straight or Short-cut.
1) Straight
You should use the binary notation method for both the address and the mask, and then apply the AND operation to get the block address.
2) Short-Cut Method
- When the byte in the mask is 255, copy the byte in the destination address.
- When the byte in the mask is 0, replace the byte in the address with 0.
- When the byte in the mask is neither 255 nor 0, write the mask and the address in binary and use the AND operation.
- If the extracted network address matches the local network ID, the destination is located on the local network. If they do not match, the message must be routed outside the local network.
| Class | Default subnet mask | No. of networks | No. of hosts per network |
|---|---|---|---|
| A | 255.0.0.0 | 128 | 16,777,214 |
| B | 255.255.0.0 | 16,384 | 65,534 |
| C | 255.255.255.0 | 2,097,152 | 254 |
Important Formulas to Determine the Subnets
Use the 2s − 2 formula, and do not use the zero and broadcast ranges, if:
- You use the classful routing method.
- RIP version 1 is used.
- The no ip subnet-zero command is configured on your router.
Use the 2s formula and use the zero and broadcast ranges if:
- You use a classless routing or VLSM method.
- RIP version 2, EIGRP, or OSPF is used.
- The ip subnet-zero command is configured on your router.


