/31 subnet
A /31 fixes the first 31 bits of the address and leaves 1 for hosts. That gives 2 addresses and subnet mask 255.255.255.254.
Example: 192.168.1.0/31
- CIDR block
- 192.168.1.0/31
- Network address
- 192.168.1.0
- Broadcast address
- 192.168.1.1
- Usable host range
- 192.168.1.0 – 192.168.1.1
- Total addresses
- 2
- Usable hosts
- 2
- Subnet mask
- 255.255.255.254
- Wildcard mask
- 0.0.0.1
- Mask in binary
- 11111111.11111111.11111111.11111110
Check another address in the subnet calculator.
Where you see a /31
- RFC 3021 lets point-to-point links use a /31. A two-host link needs no network or broadcast address, so both addresses are assigned to hosts.
What fits inside a /31
| Smaller block | How many |
|---|---|
| /32 | 2 |
Splitting 192.168.1.0/31 into /32 blocks starts with 192.168.1.0/32, 192.168.1.1/32.
How many fit in a larger block
- A /8 holds 8,388,608 blocks of /31.
- A /16 holds 32,768 blocks of /31.
- A /24 holds 128 blocks of /31.
A /31 in the cloud
| Provider | Usable addresses |
|---|---|
| AWS VPC | Not allowed: the smallest subnet is /28 |
| Azure Virtual Network | Not allowed: the smallest subnet is /29 |
| Google Cloud VPC | Not allowed: the smallest subnet is /29 |
Each provider reserves addresses in every subnet: AWS VPC 5, Azure Virtual Network 5, Google Cloud VPC 4 (primary range).
Questions
How many hosts are in a /31 subnet?
A /31 has 2 addresses. On a point-to-point link both are usable (RFC 3021), because the link needs no network or broadcast address.
What is the subnet mask for a /31?
The subnet mask for a /31 is 255.255.255.254, written in binary as 11111111.11111111.11111111.11111110. The wildcard mask is 0.0.0.1.
What is an example of a /31 range?
192.168.1.0/31 runs from 192.168.1.0 to 192.168.1.1.