What a /31 subnet is: a point-to-point link with no waste
A /31 holds 2 addresses and, unusually, both are usable. RFC 3021 removed the network and broadcast addresses for this prefix specifically so point-to-point links stop wasting half their block.
At a glance
- Subnet mask
- 255.255.255.254
- Wildcard mask
- 0.0.0.1
- Total addresses
- 2
- Usable hosts
- 2 (RFC 3021, no network or broadcast address)
- Block size in the last octet
- 2
- Host bits
- 1 of 32
In detail
The mask is 255.255.255.254. On a normal prefix the all-zeros and all-ones host parts are reserved, which would leave a /31 with no usable addresses at all. RFC 3021 makes an explicit exception: on a point-to-point link there is nothing to broadcast to, so both addresses are assigned.
The correct modern choice for router-to-router links. It halves the address space spent on infrastructure compared with a /30 and behaves identically once both ends support it.
Check both ends before deploying. Support is near universal in current routers and much less reliable in older gear and in some virtual appliances, and a device that does not understand a /31 will reject the configuration rather than misbehave quietly.
Examples
10.255.1.4/31
router A 10.255.1.4
router B 10.255.1.5
no network address, no broadcast address
# the equivalent /30 would need four addresses for the same two endsThings that catch people out
- A /31 is only valid on a point-to-point link. On a shared segment there is no broadcast address, so anything relying on broadcast breaks.
- The subnet calculator reports 2 usable hosts for a /31 rather than the 0 that the usual formula would give. That is RFC 3021 behaviour, not a bug.
Try it: IP Subnet Calculator
Enter any IPv4 address with a prefix or a dotted mask and get the network address, broadcast address, wildcard mask, usable host range, address class, and the hex and binary forms.
IP Subnet Calculator
LOCAL · Browser-OnlyCalculate IP subnet details, network ranges, and CIDR notation
192.168.1.0192.168.1.255255.255.255.00.0.0.255192.168.1.0/24192.168.1.1 - 192.168.1.254192.168.1.1192.168.1.254256254C0xC0A8016411000000.10101000.00000001.01100100Split into two /25 subnets
Dividing 192.168.1.0/24 one prefix deeper.
Common Subnet Masks
Related IPv4 subnets
All ipv4 subnets →What a /30 subnet is: a point-to-point link
A /30 uses the mask 255.255.255.252 and gives 2 usable addresses. What it is for and where it goes wrong.
What a /32 subnet is: a single host
A /32 uses the mask 255.255.255.255 and gives 1 usable addresses. What it is for and where it goes wrong.
What a /29 subnet is: eight addresses
A /29 uses the mask 255.255.255.248 and gives 6 usable addresses. What it is for and where it goes wrong.
What a /0 subnet is: the default route
A /0 uses the mask 0.0.0.0 and gives 4,294,967,294 usable addresses. What it is for and where it goes wrong.
What a /4 subnet is: the multicast block
A /4 uses the mask 240.0.0.0 and gives 268,435,454 usable addresses. What it is for and where it goes wrong.
What a /8 subnet is: a full class A block
A /8 uses the mask 255.0.0.0 and gives 16,777,214 usable addresses. What it is for and where it goes wrong.
Tools for this
- IP Subnet Calculator Free online IP subnet calculator - calculate IP subnet details, CIDR notation, and network address ranges
- IP Address Lookup Free online IP address lookup - find your public IP address and basic network information
- Number Base Converter Free online number base converter - convert numbers between decimal, binary, octal, and hexadecimal