Cloud & InfrastructureFebruary 28, 2021·4 views
Subnetting Tutorial (Part 1)
networkingfundamentals
Subnetting divides a network into multiple separate networks and is a common topic in SRE and DevOps interviews.
Key Terms
- IP Address (IPv4): A unique 32-bit address for hosts on TCP/IP networks
- CIDR / Classless Inter-Domain Routing: A format specifying subnet masks for classless network design
- Network bits (b): Bits forming the subnet's network portion (represented as 1s)
- Host bits (h): Bits for host addresses (represented as 0s)
- Subnet mask: Required component for TCP/IP operation
- Network address: First assigned address in a subnet
- Broadcast address: Last assigned address in a subnet
- Number of hosts: 2^h − 2
- Number of subnets: 2^b
How to Answer Subnetting Questions
Using the example 192.168.1.168/24:
- Understand the question clearly.
- Convert the IP to binary and identify the variables (b, h, number of hosts, number of subnets).
- AND the IP address bits with the subnet mask bits to find the network and broadcast addresses.
- Verify your answers.
For this example: network address = 192.168.1.0, broadcast address = 192.168.1.255.
Commonly Used Subnet Classes
| Class | First octet | Subnet mask | CIDR |
|---|---|---|---|
| A | 0–127 | 255.0.0.0 | /8 |
| B | 128–191 | 255.255.0.0 | /16 |
| C | 192–223 | 255.255.255.0 | /24 |