A subnet mask is a 32-bit number that divides an IP address into network and host portions. The subnet mask is represented in dotted-decimal format, like an IP address. Here’s a cheat sheet for subnet masks:
- Default Subnet Masks:
- Class A: 255.0.0.0 (CIDR /8)
- Class B: 255.255.0.0 (CIDR /16)
- Class C: 255.255.255.0 (CIDR /24)
- Common Subnet Masks:
- /25: 255.255.255.128
- /26: 255.255.255.192
- /27: 255.255.255.224
- /28: 255.255.255.240
- /29: 255.255.255.248
- /30: 255.255.255.252
- Subnet Mask and Hosts:
- /24 (Class C): 256 addresses (254 usable)
- /25: 128 addresses (126 usable)
- /26: 64 addresses (62 usable)
- /27: 32 addresses (30 usable)
- /28: 16 addresses (14 usable)
- /29: 8 addresses (6 usable)
- /30: 4 addresses (2 usable)
- Subnetting Rules:
- All 0s in the host portion: Network address.
- All 1s in the host portion: Broadcast address.
- Addresses with 0 in the host portion: Subnet ID.
- Addresses with all 1s in the host portion: Directed Broadcast.
- Calculating Subnet Masks:
- To calculate the subnet mask for a specific CIDR notation, subtract the CIDR value from 32.
- Example: For CIDR /26, the subnet mask is 32 – 26 = 6 bits, resulting in 255.255.255.192.
- To calculate the subnet mask for a specific CIDR notation, subtract the CIDR value from 32.
- CIDR Notation:
- CIDR (Classless Inter-Domain Routing) notation represents the number of network bits in the subnet mask. Example: /24.
- IPv6 Subnetting:
- IPv6 uses a different subnetting approach, where each subnet has a fixed size of 64 bits for the host portion.
Understanding subnetting is essential for network administrators and those working with IP addresses to efficiently allocate and manage network resources. This cheat sheet provides a quick reference, but it’s recommended to practice subnetting exercises to solidify the understanding.