This is just quick and dirty cheatsheet for subnet masks. It compares the relationship of host bits, prefix length, subnet mask, and usable IP addresses per subnet.
Host Bits | Prefix Length | Subnet Mask | Usable IP Addresses |
1 | /31 | 255.255.255.254 | 21-2 = 0* |
2 | /30 | 255.255.255.252 | 22-2 = 2 |
3 | /29 | 255.255.255.248 | 23-2 = 6 |
4 | /28 | 255.255.255.240 | 24-2 = 14 |
5 | /27 | 255.255.255.224 | 25-2 = 30 |
6 | /26 | 255.255.255.192 | 26-2 = 62 |
7 | /25 | 255.255.255.128 | 27-2 = 126 |
8 | /24 | 255.255.255.0 | 28-2 = 254 |
9 | /23 | 255.255.254.0 | 29-2 = 510 |
10 | /22 | 255.255.252.0 | 210-2 = 1022 |
What is Subnetting?
Subnetting is a networking concept that allows you to divide a larger network into smaller, more manageable sub-networks, known as subnets. This is done by borrowing bits from the host portion of an IP address and using them to create additional network addresses.
Here’s a more detailed explanation of subnetting:
IP Address Structure
- An IP address is composed of two main parts: the network portion and the host portion.
- The network portion identifies the network, while the host portion identifies individual devices within that network.
Purpose of Subnetting
- Subnetting helps to improve network efficiency, security, and scalability.
- It allows you to create multiple smaller networks (subnets) within a larger network, each with its own network address and range of available host addresses.
- This can help to reduce network congestion, improve network performance, and make it easier to implement access control and routing policies.
The Subnetting Process
- Subnetting involves borrowing bits from the host portion of the IP address and using them to create additional network addresses.
- The number of bits borrowed determines the number of subnets and the number of hosts per subnet.
- For example, if you have a Class C network (e.g., 192.168.1.0/24) and you borrow 2 bits from the host portion, you can create 4 subnets (2^2 = 4) with 62 hosts per subnet (2^6 – 2).
Benefits of Subnetting
- Improved network performance: Subnetting can help reduce network congestion and improve overall network performance by containing network traffic within the appropriate subnets.
- Enhanced security: Subnetting can help to isolate and secure different parts of the network, making it more difficult for unauthorized access or network attacks.
- Efficient use of IP addresses: Subnetting allows you to make better use of available IP addresses by dividing a larger network into smaller, more manageable subnets.
- Easier network management: Subnetting simplifies network administration and makes it easier to implement routing policies, access control lists, and other network management tasks.
Subnetting is a fundamental concept in network design and is widely used in both small and large-scale networks to improve efficiency, security, and scalability.