The /31 prefix means the first 31 bits of the address identify the network and the remaining 1 identify the host. Written out, the mask is 255.255.255.254, in binary 11111111.11111111.11111111.11111110, and its Cisco wildcard or inverse form is 0.0.0.1. It covers 2 addresses, of which 2 can be given to hosts.
| CIDR prefix | /31 |
|---|---|
| Subnet mask | 255.255.255.254 |
| Mask in binary | 11111111.11111111.11111111.11111110 |
| Wildcard (inverse) mask | 0.0.0.1 |
| Host bits | 1 |
| Total addresses | 2 |
| Usable hosts | 2 |
| Block size (magic number) | 2 in octet 4 |
A 192.168.1.0/24 contains 128 subnets of /31. Here are the first 8, which is enough to see the pattern: each one starts 2 after the last in octet 4.
| Network | First host | Last host | Broadcast |
|---|---|---|---|
| 192.168.1.0/31 | 192.168.1.0 | 192.168.1.1 | n/a |
| 192.168.1.2/31 | 192.168.1.2 | 192.168.1.3 | n/a |
| 192.168.1.4/31 | 192.168.1.4 | 192.168.1.5 | n/a |
| 192.168.1.6/31 | 192.168.1.6 | 192.168.1.7 | n/a |
| 192.168.1.8/31 | 192.168.1.8 | 192.168.1.9 | n/a |
| 192.168.1.10/31 | 192.168.1.10 | 192.168.1.11 | n/a |
| 192.168.1.12/31 | 192.168.1.12 | 192.168.1.13 | n/a |
| 192.168.1.14/31 | 192.168.1.14 | 192.168.1.15 | n/a |
Take the interesting octet of the mask, the one that is neither 255 nor 0. For /31 that is 254 in octet 4. Subtract it from 256:
256 - 254 = 2
That is the block size. Every /31 network address is a multiple of 2 in octet 4, so you can list them by counting: 0, 2, 4, 6, and so on. No binary needed once you know the number.
A /31 is the modern fix for point-to-point links. RFC 3021 says that on a link with exactly two devices you can drop the network and broadcast addresses entirely and use both addresses as hosts, halving the waste of a /30.
A /31 holds 2 addresses and RFC 3021 allows both to be used as hosts on a point-to-point link, so the answer is 2.
The /31 subnet mask is 255.255.255.254 in dotted-decimal notation.
The wildcard mask, also called the inverse mask, is 0.0.0.1. It is the bitwise inverse of 255.255.255.254 and is what Cisco access lists and OSPF network statements expect.
The /31 mask written out bit by bit is 11111111.11111111.11111111.11111110: 31 ones followed by 1 zeros.
A /24 splits into 128 subnets of /31.