Skip to content
Tape and Square

N-01 · Subnet · /31

/31 subnet

A /31 network keeps 31 of the 32 address bits for the network and leaves 1 for hosts. Its mask, host count, the blocks it fits in and example networks, all worked out below.

Short answer

Subnet mask
255.255.255.254Wildcard 0.0.0.1
Usable hosts
22 addresses, both hosts (RFC 3021)

A /31 has two addresses and no broadcast address. On a point-to-point link both are host addresses (RFC 3021), so nothing is lost to the network and broadcast addresses.

The /31 mask in binary and hex

31 one bits, then 1 zero bit. The wildcard is the mask inverted.

MaskDottedHex
Subnet mask255.255.255.254FF.FF.FF.FE
Wildcard0.0.0.100.00.00.01

The mask ends inside the fourth octet, at 254 (11111110). That leaves 1 host bit in the octet, so /31 networks start every 2 in it: 0, 2, 4, 6 and so on. Cisco access lists take the wildcard form, 0.0.0.1, where a 1 bit means “any value” (Cisco document 23602).

RFC 1878's table lists /31 as FF.FF.FF.FE hex, 2 addresses, equal to 1/128 C in the old class terms. RFC 1878 gives only the address count; RFC 1860, the table it replaced, called /31 unusable, which RFC 3021 later reversed for point-to-point links.

How many /31 subnets fit

The three private ranges (RFC 1918) and one /24.

Block/31 subnets in it
10.0.0.0/88,388,608
172.16.0.0/12524,288
192.168.0.0/1632,768
192.168.181.0/24128

10.0.0.0/8 holds 8,388,608, 172.16.0.0/12 holds 524,288 and 192.168.0.0/16 holds 32,768 /31 subnets. A /24 splits into 128 of them.

Splitting a /31

Each extra prefix bit halves the block.

IntoSubnetsUsable each
/3221

The two /32 halves of a /31 hold one address each, the same 2 addresses the /31 had.

/31 subnets of 192.168.181.0/24

192.168.181.0/24 holds 128 of them. The row in bold holds 192.168.181.150.

SubnetFirst addressLast address
192.168.181.0/31192.168.181.0192.168.181.1
192.168.181.2/31192.168.181.2192.168.181.3
192.168.181.4/31192.168.181.4192.168.181.5
… 72 more subnets
192.168.181.150/31192.168.181.150192.168.181.151
… 51 more subnets
192.168.181.254/31192.168.181.254192.168.181.255

Check an address

Pre-filled with 192.168.181.150/31. Change the address or the prefix.

/31

Also accepts 192.168.1.130 255.255.255.192, 192.168.1.0 60 hosts or IPv6 like 2001:db8::/48.

Result

192.168.181.150/31

2 usable hosts

Network
192.168.181.150
First usable
192.168.181.150
Last usable
192.168.181.151
Broadcast
None
Subnet mask
255.255.255.254
Wildcard mask
0.0.0.1
Total addresses
2

A /31 has no network or broadcast address: both addresses go to the two ends of a point-to-point link (RFC 3021).

PRIVATE

Inside 192.168.0.0/16, a private range (RFC 1918). Not routable on the public internet.

Binary view

Address · 192.168.181.150
11000000.10101000.10110101.10010110
Mask · 255.255.255.254
11111111.11111111.11111111.11111110
Network · 192.168.181.150
11000000.10101000.10110101.10010110

Bold bits are fixed for the network; orange bits number the hosts.

192.168.181.0/24 split into /31 · 128 blocks

  1. … 72 before
  2. 192.168.181.150/31.150–.151 ◂
  3. … 48 more

/31 next to /30 and /32

One bit shorter, a /30 (255.255.255.252) has 4 addresses and 2 usable, the same as a /31, because a /31 keeps both of its addresses for hosts. One bit longer, /32 (255.255.255.255) has 1 address and 1 usable. /30 subnet · /32 subnet

A host count never produces a /31: the calculator sizes networks by head count down to /30 and leaves /31 and /32 for links and single hosts, which you enter directly.

RFC 3021 (2000) says that on a point-to-point link with a 31-bit mask, both addresses must be read as host addresses, and broadcasts use the limited broadcast address, 255.255.255.255. RFC 4632 labels /31 “p2p link”. RFC 3021 covers point-to-point links only; Cisco allows /31 on Ethernet with a warning.

Worked example

Take 192.168.181.150/31. The mask ends in the fourth octet. There the address is 150 = 10010110 and the mask 254 = 11111110; AND keeps the first 7 bits: 10010110 = 150. So the network is 192.168.181.150. OR the wildcard 0.0.0.1 onto it to set every host bit: 192.168.181.151.

Both 192.168.181.150 and 192.168.181.151 are host addresses: one for each end of the link. In 192.168.181.0/24 this is subnet 76 of 128.

References

  • RFC 4632, Classless Inter-domain Routing (CIDR), §3.1: prefix lengths and block sizes ("p2p link").
  • RFC 950, Internet Standard Subnetting Procedure: subnet masks.
  • RFC 1878, Variable Length Subnet Table For IPv4, the prefix table.
  • RFC 1122, Requirements for Internet Hosts, §3.2.1.3: network and broadcast addresses.
  • RFC 3021, Using 31-Bit Prefixes on IPv4 Point-to-Point Links.
  • RFC 1918, Address Allocation for Private Internets: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.

Other prefixes