What is a subnet?
A subnet is a logical division of an IP network defined by a mask. We cover masks, network and broadcast addresses, CIDR prefixes, and why and how to subnet.
Last updated:
A subnet is a logical division of a larger IP network into smaller, separate segments, defined by a subnet mask. The mask splits every IP address into a network part, shared by all hosts in a given segment, and a host part that identifies the individual device. Subnetting lets you carve a large address pool into blocks sized to actual needs, contain broadcast domains and control routing between segments.
Subnet mask and CIDR notation
A subnet mask states how many leading bits of an address belong to the network part. In IPv4 it is 32 bits long and can be written in dotted decimal, such as 255.255.255.0, or in shorthand CIDR notation as a prefix length after a slash, such as /24. The longer the prefix, the smaller the subnet and the fewer addresses available. CIDR notation, defined in RFC 4632, replaced the rigid class A, B and C split and lets you choose block sizes classlessly, matched exactly to the number of hosts required.
Network address, broadcast address and hosts
In every IPv4 subnet two addresses have a special role and are not assigned to hosts. The first address is the network address, which identifies the segment itself, and the last is the broadcast address, used to send packets to all hosts at once. The remaining addresses in the block are usable by devices. That is why a /24 subnet has 256 addresses but only 254 usable hosts.
- /24 (255.255.255.0): 256 addresses, 254 usable hosts.
- /30 (255.255.255.252): 4 addresses, 2 hosts, a typical point-to-point link.
- /29 (255.255.255.248): 8 addresses, 6 hosts.
- The network address is the first address of the block; the broadcast address is the last.
- IPv6 has no broadcast address, and the standard subnet size is /64.
Why and how to divide a network into subnets
Subnetting brings order to addressing and improves security and performance. Each subnet is a separate broadcast domain, so broadcast traffic does not burden the whole network, and segments can be isolated with policies and access control lists. To create subnets you borrow bits from the host part: extending the prefix by one bit splits a block into two equal halves. VLSM, or variable-length subnet masking, lets a single network use different subnet sizes matched to the host count of each segment.
Subnets in practice at AS202520 SkyPass
In the AS202520 SkyPass operator network, subnets are part of daily work. On BGP links with customers we typically use /30 or /31 blocks for point-to-point peering, and we assign IP transit customers addressing from our prefixes. The mask also governs how prefixes are aggregated and advertised to the internet and at the Polish exchange points THINX, TPIX, WRIX and 1-IX. Sound subnet planning makes route aggregation easier, keeps the BGP table smaller and simplifies edge filtering in our PoPs in Warsaw and Wrocław.
Frequently asked questions
What is the difference between 255.255.255.0 and /24?
They are two notations for the same mask. 255.255.255.0 is dotted decimal, while /24 is CIDR notation meaning 24 network bits. Both describe a subnet of 256 addresses and 254 usable hosts.
How many hosts fit in a /30 subnet?
A /30 has 4 addresses, of which 2 are usable. The other two are the network and broadcast addresses. That makes /30 the classic choice for point-to-point links between routers.
Why does a /24 have only 254 usable addresses out of 256?
The first address of the block is reserved as the network address and the last as the broadcast address. Neither is assigned to a host, leaving 254 addresses for devices.
Do you also subnet networks in IPv6?
Yes, but differently. IPv6 has no broadcast address, and the recommended subnet size for a LAN segment is /64. Operators usually receive much larger blocks, such as a /48 or /32, and divide them into /64 subnets.
