Friday, November 1, 2013

/31 : What kind of sorcery is this?!




A few years ago a friend asked me: "Does the /31 (255.255.255.254) subnet mask have a purpose and does anyone even use it?". 


 It turns out this subnet mask is being used to conserve IPv4 addresses in point-to-point links. It even has an RFC: http://tools.ietf.org/html/rfc3021

So what's the fuzz about this weird looking subnet mask? If you recall your basic IP addressing, there are three types of addresses: Network, Host and Broadcast addresses. We all know that Network and Broadcast addresses are not assignable to network devices. In a point-to-point link, the /30 (255.255.255.252) subnet mask is commonly used since it only contains 2 host addresses. What happens to the Network and Broadcast addresses? - Wasted.

Example:

192.168.1.0/30 subnet
Network Address: 192.168.1.0/30 (Not assignable)
Host Addresses: 192.168.1.1/30 and 192.168.1.2/30
Broadcast Address: 192.168.1.3/30 (Not assignable)


This is where /31 comes in. If you use /31(255.255.255.254) as the subnet mask for point-to-point links you save two addresses!

Example:

192.168.1.0/31 subnet
Host Addresses: 192.168.1.0/31 and 192.168.1.1/31

192.168.1.2/31 subnet
Host Addresses: 192.168.1.2 /31 and 192.168.1.3/31

Your eyes do not deceive you. You can actually assign these addresses on your router's interfaces (supported since IOS release 12.2(2))