What is a subnet?
A subnet is a logically distinct part of an IP network, created by dividing one network into several smaller ones.
Short wording for an interview:
A subnet is a group of IP addresses united by one network part, defined by the subnet mask. All devices within a subnet can communicate with each other directly and are in the same broadcast domain.
The basic idea of subnets
A subnet consists of:
- a network address
- a range of usable hosts
- a broadcast address
- a subnet mask (/xx)
The boundary between the network and host parts is determined by the subnet mask.
A simple example
Subnet:
192.168.1.0/24
- Network: 192.168.1.0
- Broadcast: 192.168.1.255
- Host range: 192.168.1.1 - 192.168.1.254
- Number of hosts: 254
All these addresses are: one subnet.
What using subnets gives you
1. Dividing the network into smaller segments
Allows splitting a large network into:
- departments (IT, accounting, HR)
- VLANs
- different branches
- server segments
This reduces load and makes the network more structured.
2. Limiting broadcast domains
Broadcast (ARP, DHCP) operates within a subnet. If a subnet is too large → a lot of broadcast traffic → load.
Subnets help isolate traffic, improving performance.
3. Increasing security
Different subnets can be filtered at the level of:
- ACLs
- a firewall
- a router
For example:
- servers in the 10.0.10.0/24 subnet
- users: 10.0.20.0/24
- access policies are applied between them
4. Efficient routing
Routers use the network part of the IP to determine where to send a packet.
Subnets:
- reduce the routing table
- are convenient for aggregation (summarization)
Subnet calculation formula
Number of hosts:
2^(number of zeros in the mask) - 2
Examples:
| Mask | Hosts | Where it is used |
|---|---|---|
| /24 | 254 | Home/office networks |
| /25 | 126 | Splitting /24 in half |
| /26 | 62 | Small departments |
| /30 | 2 | Point-to-point links |
Example of dividing a network (subnetting)
We have the network:
192.168.1.0/24
We want 4 subnets. /24 → split into /26:
Subnets:
192.168.1.0/26
192.168.1.64/26
192.168.1.128/26
192.168.1.192/26Each subnet contains 64 addresses, 62 hosts.
Subnet = broadcast domain
All devices in one subnet:
- are in the same broadcast domain
- can communicate directly (without a router)
- use ARP to find each other
To cross subnet boundaries, a router or VLAN routing is required.
Ready answer for an interview
A subnet is a logically distinct part of an IP network, defined by the subnet mask. It sets the address range, broadcast behavior, and the boundaries of the broadcast domain. All hosts within a subnet can communicate directly, while a router is required to connect different subnets. Subnets are used for network segmentation, security, and routing optimization.
Cheat sheet (5 seconds)
- Subnet = part of a network, defined by the mask.
- Contains: network, hosts, broadcast.
- All hosts → one broadcast domain.
- A router is needed to connect subnets.
- Used for segmentation, security, and optimization.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.