The use of 31bit subnet masks on point to point links is documented in RFC 3021: http://www.ietf.org/rfc/rfc3021.txt

If you know subnetting, you should know that networks always need a subnet address (all zeroes) and a ‘broadcast’ address. This is why when you generally use a /30 for point-to-point links. 2 addresses used for the routers on each end, then 1 subnet address and 1 broadcast address.

Essentially using a /31 gives you no option to use directed broadcasts. How does this affect routing protocols though? These days most use multicast, but some of the older ones use broadcasts. Let’s run a lab to find out!

I’ve got a simple topology going here. 2 routers connected to each other, each with a loopback subnet advertised in the protocol.

31lab Using /31s on point to point links and their affect on routing protocols

Let’s see what happens!

The first thing I do is to give /31 addresses to both interfaces. Immediately I got the following warning:

R2(config-ip)ip address 10.1.1.4 255.255.255.254
% Warning: use /31 mask on point-to-point interface cautiously

RIPv1:

R1(config)#router rip
R1(config-router)#network 10.0.0.0
R1(config-router)#network 192.168.1.0

R1#sh ip route 172.16.1.1
Routing entry for 172.16.0.0/16
 Known via "rip", distance 120, metric 1
 Redistributing via rip
 Last update from 10.1.1.4 on FastEthernet0, 00:00:13 ago

R1#ping 172.16.1.1
Success rate is 100 percent (5/5)

So it works fine!

RIPv2:

R1(config)#router rip
R1(config-router)#version 2

R1#sh ip route 172.16.1.1
Routing entry for 172.16.0.0/16
 Known via "rip", distance 120, metric 1
 Redistributing via rip
 Last update from 10.1.1.4 on FastEthernet0, 00:00:08 ago

R1#ping 172.16.1.1
Success rate is 100 percent (5/5)

Once again, no problem!

EIGRP

R1(config)#router eigrp 1
R1(config-router)#no auto-summary
R1(config-router)#network 10.1.1.5
R1(config-router)#network 192.168.1.1

R1#sh ip route 172.16.1.1
Routing entry for 172.16.0.0/16
 Known via "eigrp 1", distance 90, metric 156160, type internal
 Redistributing via eigrp 1
 Last update from 10.1.1.4 on FastEthernet0, 00:01:45 ago

R1#ping 172.16.1.1
Success rate is 100 percent (5/5)

So EIGRP has no problems either!

OSPF:

R1(config)#router ospf 1
R1(config-router)#network 10.1.1.5 0.0.0.0 area 0
R1(config-router)#network 192.168.1.1 0.0.0.255 area 0

R1#sh ip route 172.16.1.1
Routing entry for 172.16.1.1/32
 Known via "ospf 1", distance 110, metric 2, type intra area
 Last update from 10.1.1.4 on FastEthernet0, 00:00:45 ago

R1#ping 172.16.1.1
Success rate is 100 percent (5/5)

OSPF is just fine. I guess we can see a pattern emerging here…

BGP

R1(config)#router bgp 100
R1(config-router)#neighbor 10.1.1.4 remote-as 200
R1(config-router)#network 192.168.1.0 mask 255.255.255.0

R1#sh ip route 172.16.1.1
Routing entry for 172.16.1.0/24
 Known via "bgp 100", distance 20, metric 0
 Tag 200, type external
 Last update from 10.1.1.4 00:00:08 ago

R1#ping 172.16.1.1
Success rate is 100 percent (5/5)

Out trusted BGP works just fine

To be honest everything seems to work just fine. I suppose I could test IS-IS and IGRP as well, but who really uses IGRP anymore? (I suppose the same could be said about RIPv1)

IS-IS I suppose would work just fine, but I forgot to test it. I’ll update this post when I do though :)

I’m going to make all my future topologies using /31 on point-to-point links. Not only will it be good practice, but if I ever run into something that ‘doesn’t work’ in the lab, its a better place to not work than in the real world!

If you have any bad experiences with /31′s please let me know in the comments.

Note: I’ve done a new post with some other network OS’s. Check it out here http://mellowd.co.uk/ccie/?p=937

flattr badge large Using /31s on point to point links and their affect on routing protocols
Tagged with:  

12 Responses to “Using /31′s on point to point links and their affect on routing protocols”

  1. dlots says:

    LOL
    I didn’t expect RIPv1 to work cause it propagates via broadcast… but the thing uses the 255.255.255.255 IP instead of the subnet’s boradcast IP.

    Are you doing something odd with V2? its working for me
    uses just mulitcast 224.0.0.9

    R2

    interface Serial0/0
    ip address 10.1.1.5 255.255.255.254
    clock rate 2000000

    router rip
    version 2
    network 10.0.0.0
    network 192.168.0.0

    10.0.0.0/31 is subnetted, 1 subnets
    C 10.1.1.4 is directly connected, Serial0/0
    192.168.0.0/32 is subnetted, 1 subnets
    C 192.168.0.1 is directly connected, Loopback1
    R 192.168.1.0/24 [120/1] via 10.1.1.4, 00:00:04, Serial0/0
    _____________________________________________________
    R1

    interface Serial0/0
    ip address 10.1.1.4 255.255.255.254
    clock rate 2000000

    router rip
    version 2
    network 10.0.0.0
    network 192.168.1.0

    10.0.0.0/31 is subnetted, 1 subnets
    C 10.1.1.4 is directly connected, Serial0/0
    R 192.168.0.0/24 [120/1] via 10.1.1.5, 00:00:01, Serial0/0
    192.168.1.0/32 is subnetted, 1 subnets
    C 192.168.1.1 is directly connected, Loopback1

  2. Darren says:

    Yeah, Ripv2 works just fine. Check the post again :P

  3. Daniel says:

    I’m a bit surprised that that people don’t know about /31 and some people claim it has issues and so on. I worked for a company with thousands of routers using /31 links, you can imagine the number of adresses saved by doing this compared to /30. Use /31 whenever you can :) The company I worked for uses IS-IS so that definately works as well.

  4. Darren says:

    Daniel, absolutely. I’m trying to convince the architect at work to use /31′s as /30′s are just a waste. It works. Its proven to work many times. I guess sometimes it’s difficult to get away from the old school of thought :/

  5. dlots says:

    oopsy
    I am blind :-(

  6. errtime says:

    Nice article!
    In nearest future i have to migrate part of our backbone from private addresses to public. I was thinking to test the /31, is it working also on IGP’s (not only on eBGP where i’ve seen /31′s before). Seems like i will NOT need so much public addresses like i thought in the first place.

  7. ZeroZeroFourteen says:

    Great Post! I had never heard of these before other then a mention of them in a thread over at NF. I will also start using /31′s in my labs.

  8. Colby says:

    I believe ASAs don’t support /31s. Just something to note.

  9. Darren says:

    Colby, your comment got marked as spam :P

  10. I will lab this up later just to make sure I am happy but great post and a great saving on address space – I always use /30

    Roger

  11. filip says:

    i guess you are using cisco-2-cisco setups. what with other brands, e.g. juniper-cisco? when/if i find a test router, i’ll give it a try.

  12. Darren says:

    Good question. When I get the chance I’ll setup a Juniper SSG and do the same on ScreenOS.

    As for JunOS, that may need to wait a while before I can test, but will do so

Leave a Reply

© 2009-2014 Darren O'Connor All Rights Reserved