What is a subnet mask?
Why Interviewers Ask This
This is a classic screening question for Networking roles. Hiring managers ask it early in interviews to gauge your baseline understanding and determine if you can communicate technical concepts clearly.
Answer
A subnet mask is a 32-bit number that divides an IP address into the network portion (identifying the network) and the host portion (identifying the individual device on that network). It uses 1s for network bits and 0s for host bits. Example: 255.255.255.0 (or /24) means the first 24 bits are the network address and the last 8 bits identify hosts — allowing 254 usable host addresses (2^8 - 2, excluding network and broadcast addresses). The network address is found by ANDing the IP with the subnet mask. CIDR notation: 192.168.1.0/24. Understanding subnet masks is fundamental to IP routing — routers use them to determine if a destination is on the local network or must be sent to a gateway.
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.