๐ IP Addressing & Subnetting
1
IPv4 Addressing
IPv4 Basics
An IPv4 address is a 32-bit number expressed in dotted-decimal notation (e.g., 192.168.1.10). Divided into a network portion and a host portion, determined by the subnet mask.
IPv4 Address Classes (Classful)
| Class | Range | Default Mask | Use |
|---|---|---|---|
| A | 1.0.0.0 โ 126.255.255.255 | /8 (255.0.0.0) | Large networks |
| B | 128.0.0.0 โ 191.255.255.255 | /16 (255.255.0.0) | Medium networks |
| C | 192.0.0.0 โ 223.255.255.255 | /24 (255.255.255.0) | Small networks (up to 254 hosts) |
Private IP Ranges (RFC 1918)
- 10.0.0.0/8 โ Class A private range
- 172.16.0.0/12 โ Class B private range (172.16.0.0 โ 172.31.255.255)
- 192.168.0.0/16 โ Class C private range
2
CIDR & Subnetting
CIDR Notation
Classless Inter-Domain Routing (CIDR) uses a prefix length (e.g., /24) instead of classful subnet masks. The prefix length specifies how many bits are the network portion.
Subnetting Formula
- Number of subnets = 2s where s = subnet bits borrowed.
- Hosts per subnet = 2h โ 2 where h = host bits (subtract 2 for network address and broadcast).
Common Subnet Reference
| Prefix | Subnet Mask | Usable Hosts |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /30 | 255.255.255.252 | 2 (point-to-point links) |