Tools / cidr / common

How many usable hosts in a /31? Two.

A /31 has 2 IP addresses, and both are usable hosts. RFC 3021 lets a point-to-point link skip the network and broadcast addresses, since a link with two ends needs neither, so a /31 holds exactly the two router interfaces. Its netmask is 255.255.255.254.

/31 at a glance

Prefix
/31
Netmask
255.255.255.254
Wildcard
0.0.0.1
Addresses
2
Usable hosts
2

Example: 192.168.10.0/31

Network
192.168.10.0 (a host address too)
Broadcast
None (point-to-point)
Hosts
192.168.10.0 – 192.168.10.1

Usable IPs in a /31 cloud subnet

No major cloud accepts a /31 subnet: AWS stops at /28, Azure and Google Cloud at /29.

ProviderUsable
AWS VPCReserves 5: network, VPC router, DNS, one held for future use, broadcastNot allowed (/16–/28 only)
Azure VNetReserves 5: network, default gateway, two for Azure DNS, broadcastNot allowed (/2–/29 only)
Google Cloud VPCReserves 4: network, default gateway, second-to-last, broadcastNot allowed (/4–/29 only)

Point-to-point links (RFC 3021)

Use a /31 only on point-to-point links: router-to-router, firewall-to-ISP or a tunnel. On a shared LAN segment hosts still expect a broadcast address, so use a /30 or larger there.

Cisco IOS, Juniper Junos, Arista EOS and Linux all accept /31 addresses. Some older gear and some appliances don’t; check before you renumber a link.

Questions

Quick answers.

Worked out with the same code as the CIDR calculator, which takes any IPv4 block and also splits it and checks overlaps.

What is the subnet mask for a /31?

255.255.255.254. In binary it is 31 ones followed by 1 zero. The wildcard mask, which Cisco ACLs and OSPF use, is 0.0.0.1.

How many /31 subnets fit in a /24?

128. Each extra prefix bit halves the block, so a /24 (256 addresses) splits into 128 /31 subnets of 2 addresses each.

Does a /31 have a broadcast address?

No. Under RFC 3021 both addresses in a /31 are host addresses, and a packet to the other end goes straight to it. There is no network address or broadcast address to reserve.