Skip to content
Glossary

What is a subnet?

Definition

A subnet is a contiguous block of addresses that share a common leading prefix and are administered as one network.

For anyone buying proxies, the subnet is the unit that decides how much of a pool one block decision can take out. A target that decides to stop your traffic can pick its unit: one address, the subnet around it, the route that contains the subnet, or the whole network announcing it. Which unit a given site picks is not published. What you can measure is how much of your own pool each choice would remove.

The split itself is written either as a mask or as a prefix length, and the two carry the same information: 255.255.255.0 is /24, 255.255.255.192 is /26. RFC 950 specified the mask form; CIDR notation is the shorter way to write it and the one that also works for IPv6. Subnetting exists so that one allocation can be divided internally without the rest of the internet having to know about the divisions.

What a block at each level removes

Unit a target acts on What goes with it How to measure your exposure
One address (/32) That exit only Count distinct addresses you were actually served
IPv4 /24 Every address you hold that shares the first three octets Group your addresses by /24 (script below)
Announced route Everything inside the BGP prefix, which may be larger than a /24 Look up the route: line for each address
Network (ASN) Every prefix that network announces Count distinct origin: values
IPv6 /64 Every address on that link, which can be 264 of them Group by the first four hextets

When a provider issues addresses consecutively, they share a subnet. To a target filtering at the /24, twenty addresses in one block behave like one address with twenty numbers. This is most pronounced with datacenter proxies, where a hosting company allocates in blocks by construction, but it is worth checking for any type.

Counting your own blocks

This groups a list of addresses, one per line, by /24 for IPv4 and /64 for IPv6. It uses only the standard library and was run on Python 3.15.0:

import ipaddress, sys
from collections import Counter

blocks = Counter()
for line in open(sys.argv[1]):
    if not line.strip():
        continue
    a = ipaddress.ip_address(line.strip())
    prefix = 24 if a.version == 4 else 64
    blocks[ipaddress.ip_network(f"{a}/{prefix}", strict=False)] += 1

for net, n in blocks.most_common():
    print(f"{n:4d}  {net}")
print(f"{sum(blocks.values())} addresses in {len(blocks)} blocks")

Given a sample list of twelve addresses built from the documentation ranges, it prints:

   6  198.51.100.0/24
   2  203.0.113.0/24
   2  2001:db8:4:1::/64
   1  192.0.2.0/24
   1  2001:db8:4:2::/64
12 addresses in 5 blocks

Twelve addresses, five blocks, and half the list sitting in one /24. Run it against the addresses you were actually served over several days, not the list you were handed at purchase; with a rotating proxy the two are rarely the same set. The rotation guide explains why exposure across a shared pool is a cost in its own right, and residential vs datacenter vs ISP vs mobile lists the other checks worth running before you commit to a provider.

The bad-neighbour problem

The same arithmetic explains why another customer’s behaviour can cost you. If someone else abuses a target from an address next to yours and the target responds at the prefix, your addresses go too, removed by a decision you had no part in and no way to appeal. Spreading a pool across blocks and across networks is the property that survives that; address count alone does not.

The two addresses you cannot use

On an ordinary broadcast network the first address of a subnet names the network and the last is the broadcast address, so neither is given to a host. A /30 therefore has two usable hosts out of four. Point-to-point links are the exception: RFC 3021 allows a /31 with both addresses in use, and Python reflects the rule directly.

>>> list(ipaddress.ip_network("192.0.2.0/30").hosts())
[IPv4Address('192.0.2.1'), IPv4Address('192.0.2.2')]
>>> list(ipaddress.ip_network("192.0.2.0/31").hosts())
[IPv4Address('192.0.2.0'), IPv4Address('192.0.2.1')]

It matters when you count what you bought. On a conventional shared link a /29 holds six usable hosts. A block routed to a single server, rather than configured on a link, can use all eight, so when a listing says “a /29” it is worth asking which of the two you are getting.

Frequently asked questions

How do I tell whether two IP addresses are in the same subnet?
Apply the prefix to both and compare the result. For a /24 that means the first three octets match; for anything else, let a library do it: ipaddress.ip_address("198.51.100.40") in ipaddress.ip_network("198.51.100.0/26") returns True or False in Python. Registry data shows the block as it was really allocated, which can be larger than the /24 you assumed.
Why does subnet diversity matter more than the number of proxy addresses?
Because a block decision removes every address inside the block at once. A thousand addresses in four /24s survive fewer independent decisions than two hundred addresses spread over two hundred blocks across several networks. Count blocks, and count origin networks, before you count addresses.

Sources

  1. RFC 950: Internet Standard Subnetting Procedure
  2. RFC 4632: Classless Inter-domain Routing (CIDR), prefix-length notation in place of fixed classes
  3. RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links
  4. RFC 4291: IP Version 6 Addressing Architecture, the 64-bit interface identifier
  5. Python documentation: ipaddress, networks, hosts() and strict parsing

All terms, A to Z