The Short Answer
A subnet is a block of IP addresses that share the same network part. Every IPv4 address has two parts: the network part, which all hosts of the subnet have in common, and the host part, which is different for each device. The prefix length after the slash says how many bits belong to the network part:
203.0.113.10/24
network part: 203.0.113 host part: 10Hosts in the same subnet talk to each other directly. Traffic to any other subnet goes through a router.
Why Networks Are Split
- Size: a broadcast, such as an ARP request, reaches every host in the subnet. Smaller subnets keep that traffic in bounds.
- Security: traffic between subnets passes a router or firewall, where rules can be applied.
- Order: servers, office machines, and management interfaces can each get their own range.
- Address planning: a block can be handed out in the size that is needed instead of a whole network.
Mask and Prefix
The same boundary can be written two ways. The prefix /24 means the first 24 bits are the network part. The subnet mask 255.255.255.0 says the same thing in dotted form: each 255 stands for eight network bits. The binary arithmetic, a table of every prefix, and the conversions are in subnet mask and CIDR notation.
Two Examples
| /24 | /26 | |
|---|---|---|
| Subnet | 192. | 192. |
| Mask | 255. | 255. |
| Addresses | 256 | 64 |
| Network | .0 | .64 |
| Broadcast | .255 | .127 |
| Usable hosts | .1 to .254 (254) | .65 to .126 (62) |
A /24 split into /26 subnets gives four of them, starting at .0, .64, .128, and .192. The first address of each is the network address and the last is the broadcast address. Neither can be given to a host, which is why a subnet of 64 addresses has 62 usable ones.
The Gateway Is Inside the Subnet
To reach anything outside its subnet, a host sends the packet to its default gateway, a router with an address in the same subnet, often the first or the last usable one. A server at 192.168.10.70/26 can use 192.168.10.65 as its gateway, but not 192.168.10.1, which sits in another subnet. More in what is a default gateway.
Same Subnet or Routed?
For every packet, a host compares the destination with its own subnet:
- If the destination is inside the subnet, the host finds the destination's MAC address with ARP and delivers the frame directly. See what is a MAC address.
- If it is not, the host sends the frame to the gateway's MAC address, and the router forwards the packet toward the destination.
Two hosts in the same range with different prefix lengths can disagree about this, which causes traffic that works in one direction only. Configure the same prefix on every host of a subnet.
See It on a Server
ip -br a
ip routeip -br a lists each interface with its address and prefix, for example 203.0.113.10/24. ip route prints lines similar to these:
default via 203.0.113.1 dev eth0
203.0.113.0/24 dev eth0 proto kernel scope link src 203.0.113.10The first line names the gateway; the second says the whole /24 is reached directly on eth0. Some networks give a server a very small prefix, such as a /32, with a separate route to the gateway; it varies by provider. The ip command guide explains the other fields.
Public and Private Subnets
Subnetting works the same way in public and private address space. A private network between your servers might use 10.10.0.0/24, while each server's public address sits in a public subnet. See public vs private IP and private IP address ranges.
IPv6 Subnets
IPv6 uses the same idea with longer addresses. The standard size for one network segment is a /64: the first 64 bits name the subnet and the last 64 bits the host. Automatic address configuration (SLAAC) expects exactly a /64, and a /64 holds so many host addresses that nobody counts usable hosts. Larger blocks, such as a /56 or a /48, are split into /64 subnets.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations