A netmask (or subnet mask) is a 32-bit number that divides an IP address into network and host portions. It’s often expressed using dotted-decimal notation. Here’s a cheat sheet for netmasks:
Common Netmasks
- /32:
- Single Host (255.255.255.255)
- /31:
- Used in point-to-point links
- /30:
- 4 Hosts (255.255.255.252)
- /29:
- 8 Hosts (255.255.255.248)
- /28:
- 16 Hosts (255.255.255.240)
- /27:
- 32 Hosts (255.255.255.224)
- /26:
- 64 Hosts (255.255.255.192)
- /25:
- 128 Hosts (255.255.255.128)
- /24:
- 256 Hosts (255.255.255.0)
- /23:
- 512 Hosts (255.255.254.0)
- /22:
- 1024 Hosts (255.255.252.0)
- /21:
- 2048 Hosts (255.255.248.0)
- /20:
- 4096 Hosts (255.255.240.0)
- /19:
- 8192 Hosts (255.255.224.0)
- /18:
- 16384 Hosts (255.255.192.0)
- /17:
- 32768 Hosts (255.255.128.0)
- /16:
- 65536 Hosts (255.255.0.0)
IP Address Calculation
- Network Address:
IP & Netmask
- First Host:
Network Address + 1
- Last Host:
Broadcast Address - 1
- Broadcast Address:
Network Address | ~Netmask
IPv6 Prefix Notation
- /64:
- Standard subnet size for IPv6
- /48:
- Commonly used for site-level addressing
- /32:
- Represents a full IPv6 address
CIDR Notation
CIDR (Classless Inter-Domain Routing):
- Expresses netmasks using a prefix length, e.g.,
192.168.1.0/24
Wildcard Masks
Wildcard Mask Calculation:
255.255.255.255 - Netmask
Subnetting Tips
- Plan Subnets:
- Plan subnets based on the number of required hosts.
- Avoid Wastage:
- Avoid creating subnets with significantly more hosts than needed.
- Use CIDR:
- Utilize CIDR notation for efficient allocation.
Subnetting Examples
Example: Subnetting /24 into /27:
- Divide a /24 network into eight /27 subnets.
Original Network: 192.168.1.0/24
Subnet 1: 192.168.1.0/27
Subnet 2: 192.168.1.32/27
...
This cheat sheet provides a quick reference for common netmasks and subnetting practices. Understanding netmasks is essential for network administrators and anyone working with IP addresses.