What is subnetting and how do you calculate subnets?
Why Interviewers Ask This
This question targets practical, hands-on experience with Networking. Interviewers want to see if you've worked with these concepts in real projects, not just read about them. Strong answers include concrete examples.
Answer
Subnetting is the process of dividing a larger network into smaller, more manageable subnetworks. It improves security (contain broadcast traffic), performance, and IP address management. To subnet 192.168.1.0/24 into 4 subnets: borrow 2 bits from the host portion (2^2 = 4 subnets), giving /26 (26 network bits). Each subnet has 64 addresses (2^6), 62 usable hosts, and they are: 192.168.1.0/26 (hosts .1–.62, broadcast .63), 192.168.1.64/26 (hosts .65–.126, broadcast .127), 192.168.1.128/26, 192.168.1.192/26. Formula: number of subnets = 2^(borrowed bits); hosts per subnet = 2^(remaining host bits) - 2. VLSM (Variable Length Subnet Masking) allows different subnet sizes in the same network, reducing waste. For example, a point-to-point link needs only /30 (2 hosts) rather than a /24.
Pro Tip
Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a Networking codebase.