/31 Subnet: Mask 255.255.255.254

A /31 has only 2 addresses, and both are usable. RFC 3021 dropped the network and broadcast addresses for point-to-point links, because a link with two ends doesn't need them.

/31 at a glance

Subnet mask
255.255.255.254
Wildcard mask
0.0.0.1
Usable hosts
2
Total addresses
2 (21)
Block size (fourth octet)
2
Network / host bits
31 / 1
Mask in hex
0xFFFFFFFE

Mask in binary: 11111111.11111111.11111111.11111110

Network bits Host bits

Try it: which /31 is an address in?

Network address
10.0.255.8/31
First usable host
10.0.255.8
Last usable host
10.0.255.9
Last address (no broadcast)
10.0.255.9
Next /31 starts at
10.0.255.10

How many /31 networks fit

How /31 relates to /8, /16 and /24 blocks
Parent block Relationship
/8 8,388,608 × /31 fit inside one /8
/16 32,768 × /31 fit inside one /16
/24 128 × /31 fit inside one /24

128 × /31 = one /24. A /31 uses half the space of a /30 for the same link.

Worked example: 10.0.255.9/31

A leaf switch uplink is configured as 10.0.255.9/31. What address does the spine switch at the other end need?

  1. The mask is 255.255.255.254. The fourth octet (254) is the "interesting" one — the first that is not 255.
  2. Block size = 256 − 254 = 2. Networks start at multiples of 2 in the fourth octet: 0, 2, 4, …
  3. The fourth octet of 10.0.255.9 is 9. 9 ÷ 2 = 4 remainder 1, so the block starts at 4 × 2 = 8.
  4. Network = 10.0.255.8. Last address = 8 + 2 − 1 = 9, giving 10.0.255.9 (the last address — a /31 has no real broadcast).
  5. A /31 has no network or broadcast address (RFC 3021), so both 10.0.255.8 and 10.0.255.9 are usable on a point-to-point link.

Same thing in binary (network bits | host bits):

Address  00001010.00000000.11111111.0000100|1
Mask     11111111.11111111.11111111.1111111|0
Network  00001010.00000000.11111111.0000100|0

Where /31 is used in real networks

  • Data-centre leaf-spine fabrics

    Fabrics with BGP or OSPF on every link often have hundreds or thousands of point-to-point links. Using /31 instead of /30 halves the address space needed.

  • ISP and core links

    Modern routers (Cisco IOS/IOS-XE/XR, Junos, Arista EOS, Linux) all accept /31 on point-to-point interfaces.

Common /31 mistakes

  • Calculating usable hosts as 2 − 2 = 0. A /31 is a special case: both addresses are usable. Calculators that don't handle RFC 3021 will show 0.
  • Using a /31 on a multi-access segment (a VLAN with more than two devices). It only works on true point-to-point links.
  • Assuming every device supports it. Some older firewalls and host operating systems reject a /31 or treat one address as broadcast. Test before rolling out.

/31 FAQ

How many usable hosts are in a /31?

2. RFC 3021 lets both addresses be used on point-to-point links, so there is no network or broadcast address.

What is the wildcard for /31?

0.0.0.1. Only the last bit varies, so an ACL entry like 10.0.255.8 0.0.0.1 matches both ends of the link: .8 and .9.

Is /31 better than /30?

For point-to-point links between devices that support it, yes: it uses half the addresses. Use /30 when one end might not support RFC 3021.

Related tools