HTTPfy

/31 subnet mask (255.255.255.254)

A /31 network has 1 host bit, 2 addresses and 2 usable hosts. It is 1/128 of a /24.

/31 at a glance

Netmask
255.255.255.254
Wildcard mask
0.0.0.1
Hex mask
0xFFFFFFFE
Binary mask
11111111.11111111.11111111.11111110
Host bits
1
Total addresses
2
Usable hosts
2 (RFC 3021)
Compared with a /24
1/128 of a /24

Typical uses of a /31

A /31 has only 2 addresses and, per RFC 3021, both are usable hosts: there is no network or broadcast address on a point-to-point link. Cisco, Juniper, Linux and most modern gear support it, and AWS Direct Connect accepts /30 or /31 BGP peer addresses.

Example /31 ranges

NetworkNetwork addressFirst usableLast usableBroadcastNext /31
10.0.0.0/31 10.0.0.0 10.0.0.0 10.0.0.1 none 10.0.0.2/31 calculate
172.16.0.0/31 172.16.0.0 172.16.0.0 172.16.0.1 none 172.16.0.2/31 calculate
192.168.1.0/31 192.168.1.0 192.168.1.0 192.168.1.1 none 192.168.1.2/31 calculate
203.0.113.0/31 203.0.113.0 203.0.113.0 203.0.113.1 none 203.0.113.2/31 calculate

The /31 boundary falls in the fourth octet, so /31 networks start every 2 in that octet (128 per /24): 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, ....

How many /31s fit

In aNumber of /31 subnets
/88,388,608
/1632,768
/202,048
/24128
/288

What a /31 contains

Smaller blockHow many
/322

Splitting a /31

IntoSubnetsUsable hosts each
/3221

/31 in AWS, Azure and Google Cloud

PlatformAllowed subnet sizes/31 allowed?Usable after reservation
AWS VPC/16 to /28 No -
Azure VNet/2 to /29 No -
Google Cloud VPC/4 to /29 No -

Cloud providers reserve addresses in every subnet (first four and the last address (network, VPC router, DNS, future use, broadcast) on AWS), so the usable count there differs from the classic 2^n - 2.