A /31 subnet is a smart way to connect two routers without wasting valuable IPv4 addresses. Traditional subnetting often reserves separate addresses for network and broadcast functions. However, RFC 3021 changes this approach for supported point-to-point links. It allows both available addresses to serve as usable endpoints.
This makes IPv4 address conservation easier for network administrators managing large infrastructures. Whether you configure enterprise networks or dedicated WAN connections, understanding CIDR notation helps you plan addresses correctly. In this guide, you’ll learn how /31 subnetting works, how it compares with /30, and how to configure it on Linux and Cisco routers.
What Is a /31 Subnet and How Does RFC 3021 Work?
A /31 subnet is a small IPv4 network containing exactly two addresses. Unlike traditional subnetting, both addresses can identify devices on a point-to-point connection. The RFC 3021 standard introduced this method to improve IPv4 address conservation. It is especially useful when two routers need a direct connection without additional host addresses.
To understand the concept, consider how IPv4 addressing works. Every 32-bit IPv4 address contains network and host portions. A 31-bit prefix uses 31 bits for the network portion and leaves one bit for identifying endpoints. Therefore, only two possible addresses exist. RFC 3021 allows both addresses to function as usable host addresses on qualifying point-to-point links.
Understanding /31 Subnet Masks and IPv4 CIDR Notation
First, you need to understand CIDR notation. CIDR describes how many bits belong to the network portion of an IP address. A /31 prefix uses 31 network bits and one remaining host bit. Its 255.255.255.254 subnet mask looks different from the familiar masks used in larger networks.
For example, consider 192.168.10.0/31. The two addresses are 192.168.10.0 and 192.168.10.1. One address belongs to the first router. The other belongs to the second router. Both devices share the same small network prefix.
| Property | /31 subnet |
|---|---|
| Prefix length | /31 |
| Subnet mask | 255.255.255.254 |
| Total addresses | 2 |
| Host bits | 1 |
| Usable endpoint addresses | 2 |
| Address increment | 2 |
The subnet mask determines which bits identify the network. In binary, the /31 mask contains 31 consecutive ones followed by one zero. This leaves exactly two possible address combinations. That simple structure makes /31 addressing easy to calculate once you understand the rules.
What RFC 3021 Changes About Network and Broadcast Addresses
Traditionally, IPv4 subnetting reserves two addresses in many subnets. The first represents the Network address. The last represents the Broadcast address. Consequently, a traditional two-address requirement usually needs a /30 subnet containing four total addresses.
However, point-to-point connections work differently. They connect only two endpoints. There is no need to send a packet to every device on a shared segment. RFC 3021 therefore allows both /31 addresses to identify the connected endpoints.
This approach also changes how devices interpret traditional broadcast-related addresses. The normal directed broadcast function is unavailable on a /31 link. Instead, devices use the limited broadcast address when broadcast traffic is required. The RFC also explains how endpoint addresses must be handled by supporting routers.
An important distinction exists here. RFC 3021 does not remove every broadcast function from IPv4. It removes the directed broadcast function for that particular /31 link. Read the official RFC 3021 specification for its exact requirements.
Why /31 Subnets Are Ideal for Point-to-Point Connections
Imagine connecting two routers across a private WAN circuit. Router A needs one address, while Router B needs another. A traditional subnet provides additional addresses that neither endpoint requires. A /31 subnet solves this problem with a compact two-address subnet.
This design is useful for ISP backbone connections, enterprise WAN circuits, and direct router connections. It can also simplify large network addressing plans. When engineers manage hundreds of connections, saving two addresses per link makes a noticeable difference.
A Point-to-point interface provides a direct communication path between two devices. Serial connections are common examples. Some Ethernet connections can also use /31 addressing when the segment contains exactly two IPv4 endpoints and the equipment supports the required behavior.
How Many Usable IP Addresses Does a /31 Subnet Provide?
A /31 subnet provides exactly two usable endpoint addresses under RFC 3021. Both addresses identify devices on the same point-to-point link. Neither address is reserved as a conventional network or directed broadcast address on that link.
Consider 10.254.0.0/31. Router A receives 10.254.0.0, while Router B receives 10.254.0.1. Both routers can communicate directly using these addresses. This arrangement provides the same two endpoint addresses as a /30 without consuming four addresses.
The key is understanding the deployment environment. You should use this addressing method only when both endpoints and their network software support RFC 3021 behavior. A normal two-address calculation alone does not guarantee compatibility.
/31 vs. /30 Subnets: Key Differences and Benefits
The main difference between /31 and /30 subnetting involves address consumption. A /30 subnet contains four IPv4 addresses, but only two normally identify hosts. A /31 subnet contains two addresses, and both can identify endpoints on a supported point-to-point link. This /30 subnet comparison shows why RFC 3021 matters for large networks.
Both options can support router-to-router connections. However, /31 provides better IPv4 address efficiency when the connection needs exactly two endpoints. A /30 remains useful when equipment requires traditional subnet behavior. Your decision should depend on network design, device support, and operational requirements.
/31 vs. /30 Subnet Comparison: Address Allocation and Efficiency
A /30 subnet uses two host addresses and reserves the remaining addresses for conventional network and broadcast functions. A /31 subnet changes that arrangement for qualifying point-to-point links. It uses both available addresses as endpoint addresses.
| Feature | /31 subnet | /30 subnet |
|---|---|---|
| Total IPv4 addresses | 2 | 4 |
| Usable endpoint addresses | 2 | 2 |
| Prefix length | 31 bits | 30 bits |
| Subnet mask | 255.255.255.254 | 255.255.255.252 |
| Conventional network address | Both addresses act as endpoints | First address |
| Conventional directed broadcast | Not available on the link | Last address |
| Address consumption | 2 addresses | 4 addresses |
| Typical use | Point-to-point links | Point-to-point links |
The comparison reveals an important advantage. Both subnet types provide two endpoint addresses, but /31 consumes half the address space. This difference becomes valuable when your network contains many connections. However, the /31 approach depends on correct RFC 3021 support.
How /31 Subnets Save IPv4 Address Space
Address conservation becomes important as network infrastructure grows. Imagine an ISP operating 1,000 router-to-router connections. Using /30 subnets requires 4,000 IPv4 addresses. Using /31 subnets requires only 2,000 addresses. The network saves 2,000 addresses without reducing the number of connections.
| Number of links | Addresses with /30 | Addresses with /31 | Addresses saved |
|---|---|---|---|
| 100 | 400 | 200 | 200 |
| 500 | 2,000 | 1,000 | 1,000 |
| 1,000 | 4,000 | 2,000 | 2,000 |
| 5,000 | 20,000 | 10,000 | 10,000 |
These savings can improve IP address allocation across large enterprise and service-provider networks. Network teams can reserve fewer addresses for transit connections. They can then use the remaining address space for other infrastructure needs.
A private IPv4 network can benefit from this method too. For example, an organization using the Private IPv4 address space may allocate a portion of 10.0.0.0/8 for point-to-point links. Smaller allocations make the addressing plan easier to manage as the network expands.
Performance and Scalability Benefits of /31 Subnetting
One common misunderstanding is that /31 automatically makes network traffic faster. It does not. Both /31 and /30 use standard IPv4 packet forwarding. The main benefit comes from reducing address consumption rather than improving bandwidth or latency.
However, smaller allocations can simplify network planning. Engineers can reserve address blocks for specific WAN regions or routing areas. They can also reduce unused address space in large routing environments. This supports better IP subnet optimization and more consistent network documentation.
For example, a company with offices across the United States may operate hundreds of private WAN connections. Assigning /31 prefixes to supported links helps the network team maintain a predictable addressing structure. It also reduces the amount of address space reserved for infrastructure connections.
When Should You Choose /31 Instead of /30?
Choose /31 when a connection has exactly two IPv4 endpoints and both devices support RFC 3021. It works well for dedicated router links, supported serial connections, and suitable Ethernet segments. It also fits networks where efficient address planning is important.
A /30 subnet may be more suitable when older equipment cannot handle /31 behavior. It can also simplify compatibility with systems that expect traditional network and broadcast address rules. Before changing an existing network, check vendor documentation and test both endpoints.
The best choice depends on your environment. Modern equipment often supports flexible subnetting, but older platforms may have limitations. Always confirm the requirements before changing production addressing.
How to Configure /31 Subnets on Point-to-Point Links

Understanding subnetting is only the first step. You also need to configure both endpoints correctly. A successful WAN link configuration requires matching subnet prefixes and compatible network interfaces. Whether you use Linux or Cisco equipment, the basic addressing principle remains the same. One endpoint receives the first address, while the other receives the second.
Before configuration, choose an available parent network and plan your Subnet allocation. Check that the selected addresses do not overlap with existing networks. Then assign the addresses to both devices and verify communication. These steps help prevent duplicate addresses, incorrect masks, and unexpected routing problems.
Planning and Allocating /31 IP Address Pairs
Good network planning prevents many configuration mistakes. Start by selecting an available IPv4 block for your point-to-point connections. For example, 10.254.0.0/24 provides 256 addresses. You can divide this block into 128 separate /31 subnets. Each subnet provides two endpoint addresses.
The address pairs increase in steps of two. The first pair contains 10.254.0.0 and 10.254.0.1. The next pair contains 10.254.0.2 and 10.254.0.3. This pattern continues throughout the parent network.
| Point-to-point link | Router A | Router B |
|---|---|---|
| Link 1 | 10.254.0.0 | 10.254.0.1 |
| Link 2 | 10.254.0.2 | 10.254.0.3 |
| Link 3 | 10.254.0.4 | 10.254.0.5 |
| Link 4 | 10.254.0.6 | 10.254.0.7 |
| Link 5 | 10.254.0.8 | 10.254.0.9 |
Keep a clear record of every assigned subnet. Document the router names, interface identifiers, and remote endpoints. This makes troubleshooting easier when your network grows. It also helps prevent accidental address reuse across different connections.
Generating /31 Subnet Pairs Using Python
Manually creating hundreds of subnet pairs can become frustrating. Python offers a simple way to automate this task. Its built-in Python ipaddress module handles IPv4 addresses and subnet calculations. The IPv4Network class makes it easy to divide a parent network into smaller prefixes.
The following example performs IPv4 subnet generation using a /24 network. It creates every available /31 pair and displays the first five results. You can change the parent network to match your own addressing plan.
python
import ipaddress
def generate_p2p_links(parent):
network = ipaddress.IPv4Network(parent, strict=True)
for subnet in network.subnets(new_prefix=31):
addresses = list(subnet.hosts())
print(f"{addresses[0]} <-> {addresses[1]}")
generate_p2p_links("10.254.0.0/24")
The script divides the parent network into smaller /31 networks. Each generated subnet contains two usable endpoint addresses. Python correctly treats both addresses as hosts for a /31 prefix. You can also extend this script to export results into CSV files or network inventory systems.
For example, a network administrator could generate 500 link assignments before a planned infrastructure upgrade. The resulting address list can then become part of the deployment documentation. Automation reduces repetitive work and helps prevent manual subnet calculation errors.
How to Configure a /31 Subnet on Linux
Linux provides flexible tools for managing network interfaces. The Linux IP command allows you to assign IPv4 addresses directly from the terminal. You can use it to configure both endpoints of a point-to-point connection. Make sure you have permission to change the network settings.
Suppose two Linux routers connect through their eth1 interfaces. Router A uses 10.254.0.0/31, while Router B uses 10.254.0.1/31. Run the following commands on the corresponding devices.
# Router A
sudo ip addr add 10.254.0.0/31 dev eth1
sudo ip link set eth1 up
# Router B
sudo ip addr add 10.254.0.1/31 dev eth1
sudo ip link set eth1 up
After assigning both addresses, inspect the interface configuration. The following command displays the address and interface details.
ip addr show dev eth1
Next, test communication between the routers.
# Run this command on Router A
ping -c 4 10.254.0.1
A successful response indicates that Router A can reach Router B. However, this temporary configuration may disappear after a reboot. Use your Linux distribution’s network manager to make the address assignment persistent. For additional details, consult the Linux ip-address manual .
How to Configure /31 Subnets on Cisco IOS
Cisco routers support /31 addressing on compatible platforms. The Cisco IOS command-line interface allows administrators to assign IP addresses directly to router interfaces. You need the correct subnet mask and an operational interface on both devices.
For this example, Router A receives 10.254.0.0, while Router B receives 10.254.0.1. Both routers use the same subnet mask. The following example uses a Gigabit Ethernet interface.
! Router A
enable
configure terminal
interface GigabitEthernet0/0
ip address 10.254.0.0 255.255.255.254
no shutdown
exit
Configure the second router with the other endpoint address.
! Router B
enable
configure terminal
interface GigabitEthernet0/0
ip address 10.254.0.1 255.255.255.254
no shutdown
exit
After configuration, check the interface status.
show ip interface brief
show running-config interface GigabitEthernet0/0
show ip route connected
These commands help confirm that the interface has the expected address and operational status. You can then test connectivity using ping 10.254.0.1 from Router A. Interface names may differ across Cisco models, so adjust them according to your hardware.
Verifying /31 Point-to-Point Connectivity
Configuration alone does not prove that a link works correctly. You must perform Network connectivity testing after assigning the addresses. Start by checking the local interface status. Then test communication with the remote endpoint using an ICMP ping request.
If the test succeeds, inspect the routing table to confirm the connected route. You should also check interface counters for errors or dropped packets. For more detailed testing, use traceroute when the connection passes through additional routing devices. Remember that a successful ping confirms basic reachability, not every aspect of network performance.
Compatibility, Limitations and Troubleshooting of /31 Subnets
Although /31 addressing is widely used in modern networking, compatibility still matters. Both endpoints must understand the special addressing rules defined by RFC 3021. A device that treats one endpoint as a conventional network or broadcast address may cause communication problems. Therefore, Network device compatibility should always be checked before deployment.
You should also consider routing behavior, interface types, and existing security policies. Some older platforms may require software updates or different configurations. A careful testing process helps identify these issues before they affect production traffic. Good planning protects your Network infrastructure and reduces unexpected service interruptions.
Which Routers and Operating Systems Support /31 Subnets?
Modern networking platforms commonly support /31 addressing. Linux provides native support through its IPv4 networking stack. Cisco also documents 31-bit subnet support for compatible router interfaces. However, exact support depends on the platform and software release.
Some older networking equipment may not recognize both addresses correctly. The Cisco IOS 12.2 release family is often mentioned in discussions of early Cisco support, but you should not treat that version label as a universal compatibility guarantee. Check the documentation for your exact router model and software release.
Cisco’s documentation explains the use of 31-bit subnet masks on supported interfaces. You can review its 31-bit subnet configuration guidance . Always verify both ends of a link before making changes.
Common /31 Subnet Configuration Problems and Solutions
Most /31 problems come from incorrect addressing or incompatible devices. For example, an administrator may assign the same IP address to both routers. Another common mistake involves entering a /30 mask instead of the required /31 mask. Either problem can prevent normal communication.
Interface problems can also interrupt connectivity. A router may have the correct address but remain administratively down. Firewalls may block traffic, while incorrect routing entries can send packets toward the wrong destination. Check the interface state, subnet mask, address assignments, and security rules before changing the configuration.
| Problem | Possible cause | Recommended check |
|---|---|---|
| Ping fails | Incorrect endpoint address | Verify both IP addresses |
| Interface stays down | Interface disabled or physical issue | Check interface status |
| Duplicate address warning | Reused endpoint address | Review the IP inventory |
| Connected route missing | Incorrect mask or interface state | Inspect the routing table |
| One-way communication | ACL or firewall restriction | Review traffic policies |
| Neighbor adjacency fails | Routing configuration mismatch | Check protocol settings |
Does /31 Subnetting Work With OSPF, BGP and Other Routing Protocols?
Yes, RFC 3021 explains that 31-bit prefixes do not inherently prevent normal classless routing protocols from operating. The original RFC discusses successful operational testing with OSPF, IS-IS, BGP, and EIGRP. These protocols can use point-to-point links when the devices and interface configurations support the addressing method.
For OSPF, both routers need compatible interface settings and matching network reachability. BGP peers also need a working IP path between their configured neighbor addresses. A correct /31 subnet provides that addressing foundation. However, routing policies, authentication, timers, and other protocol settings still require proper configuration.
The important point is that /31 does not replace routing configuration. It only changes how the two endpoint addresses are interpreted. Review the RFC 3021 routing considerations when planning a deployment.
Security Considerations and Best Practices for RFC 3021
RFC 3021 also discusses a security benefit related to directed broadcasts. A /31 link does not provide a directed broadcast address for that connection. This removes one possible method of packet amplification on the link. It can slightly improve resistance to certain broadcast-based denial-of-service attacks.
However, /31 addressing is not a complete security solution. You should still configure access controls, secure management protocols, and appropriate routing policies. Monitor interface activity and keep device software updated. Maintain clear records of assigned addresses and test configuration changes before production use.
When Should You Avoid Using /31 Subnets?
A /31 subnet is designed for a link with exactly two IPv4 endpoints. It is not a general replacement for larger subnets. If several devices share an Ethernet segment, a /31 prefix may not provide the addressing behavior they need.
You should also avoid using it when either endpoint lacks proper support. Some legacy equipment may interpret the addresses incorrectly. In such situations, a /30 subnet can provide more familiar behavior. The extra addresses may be worth the simpler compatibility requirements.
Remember that an Ethernet connection does not automatically qualify as a point-to-point link. Cisco documentation notes that /31 can also work on Ethernet interfaces when only two IPv4 addresses are needed on that segment. Confirm the device behavior before applying this design.
How to Test and Troubleshoot /31 Links Before Production
A structured validation process helps you find problems early. First, confirm that both routers have the correct endpoint addresses. Next, verify the subnet masks and interface states. Then perform connectivity tests in both directions. This approach helps separate addressing problems from routing or security issues.
After basic testing, inspect the connected routes and routing protocol neighbors. Review device logs for interface errors or rejected packets. If the link supports monitoring, add it to your network monitoring platform. Keep the results as part of your deployment records.
A practical case study shows why this matters. Imagine a US-based company connecting 50 branch offices through dedicated router links. The engineering team assigns one /31 subnet to each connection. During testing, one branch fails to respond because its interface uses an incorrect mask. Correcting the mask restores connectivity without changing the overall addressing plan.
This example highlights a simple lesson. Efficient addressing works best when paired with careful verification. Test every link before moving traffic through it.
Conclusion: Mastering /31 Subnets for Efficient Network Configuration
Efficient subnetting helps you manage IPv4 addresses without unnecessary waste. RFC 3021 makes this possible by allowing both addresses in a /31 prefix to identify point-to-point endpoints. Compared with /30 addressing, this approach saves two addresses per connection. Those savings become significant in large enterprise and ISP networks.
Mastering /31 Subnets also means understanding device compatibility, routing behavior, and proper configuration. Linux and Cisco equipment can support this approach when the platform and software meet the requirements. Use Python to automate subnet planning and verify every connection before production deployment. With careful planning, you can improve address management and build a more organized network.
For modern network engineers, Mastering /31 Subnets is a useful step toward better IPv4 address management. Start with a small test environment, confirm both endpoints, and expand only after successful validation.
Additional Technical Note: Serial Interfaces and Point-to-Point Links
Traditional Serial interface configuration often uses point-to-point addressing between two routers. RFC 3021 allows compatible serial interfaces to use /31 prefixes instead of /30. This reduces address consumption while preserving normal endpoint communication. Always confirm encapsulation and platform support before applying the configuration.
Important Technical Facts to Remember
| Technical detail | Explanation |
|---|---|
| RFC number | RFC 3021 |
| Publication date | December 2000 |
| Prefix length | /31 |
| Subnet mask | 255.255.255.254 |
| Address count | 2 |
| Address savings | 2 addresses per link |
| Main purpose | IPv4 conservation |
| Suitable connections | Supported point-to-point links |
| Broadcast behavior | No directed broadcast on the /31 link |
Final Recommendation & Next Steps
Treat /31 addressing as a practical tool for efficient IP allocation on point-to-point links, rather than a universal replacement for all subnets. By understanding CIDR limits, endpoint behavior, and device compatibility, you can optimize existing address space and reduce waste across your infrastructure.
However, while /31 subnets help conserve internal links, enterprise network expansion often requires dedicated, clean IP blocks. When subnetting alone isn’t enough to satisfy your growth, partnering with a trusted marketplace ensures seamless scaling.
Need Larger Subnets for Core Infrastructure?
Conserving IP space with /31 links is smart, but core routing demands full address blocks. Explore pre-vetted, clean IPv4 subnets (/24 to /16) available for immediate lease or transfer at IPv4 TradeHub.
A /31 subnet provides exactly two usable IP addresses for its endpoints. Both addresses identify devices on the same point-to-point connection. For example, 192.168.20.0/31 provides 192.168.20.0 and 192.168.20.1. This special behavior follows RFC 3021.
A /31 subnet does not reserve either address as a conventional network or directed broadcast address on the point-to-point link. Both addresses identify endpoints. However, limited broadcast traffic still uses 255.255.255.255 when required. The IP directed broadcast function is unavailable for that specific link.
A /31 subnet uses fewer addresses when connecting exactly two supported endpoints. A /30 subnet uses four addresses to provide the same two host addresses. However, compatibility matters. Choose /31 when both devices support RFC 3021. Otherwise, /30 may provide simpler operation.
Yes, OSPF and BGP can operate over supported /31 links. RFC 3021 explains that classless routing protocols can work with these prefixes. However, both endpoints need correct interface addressing and routing settings. Authentication, neighbor configuration, and routing policies must also match.
No, you should not assume every Cisco router supports RFC 3021. Support depends on the hardware platform and software release. Some older devices may require upgrades or traditional /30 addressing. Check the official Cisco documentation before changing an existing network.