Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    DHCP on /31 subnet?

    DHCP and DNS
    9
    15
    4.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      CaptainElmo
      last edited by

      If I use DHCP in pfSense to lease out the only usable IP address in a /30 subnet everything works. If I try the same thing with a /31 subnet pfSense complains that the broadcast address cannot be used.

      The usability scenarios in this case should be the same - use DHCP to lease out the only usable IP address in a PtP subnet. From what I understand, in a /31 subnet the traditional network and broadcast addresses aren't supposed to be needed.

      The usage scenario here is a large pool of PtP links which must be isolated onto individual subnets, but preferably using only 2 IP addresses per client instead of 4. DHCP is helpful in this scenario because the client machines are not under my control and the address space could be fluid. Managing a static IP address on each client would be an untenable proposition.

      Is there a way to make pfSense lease the usable client address in a /31 subnet or am I stuck with one of the more unpalatable alternatives?

      Thank you in advance for the assistance.

      JKnottJ 1 Reply Last reply Reply Quote 0
      • T
        technical ownage
        last edited by

        -_-

        Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

        1 Reply Last reply Reply Quote 0
        • M
          muswellhillbilly
          last edited by

          Try running this scenario through an online subnet calculator:

          http://jodies.de/ipcalc?host=192.168.0.1&mask1=31&mask2=

          You'll see that with this subnet the broadcast address and the only available address in that 'range' are the same. A /30 subnet will give you just two addresses - the absolute minimum.

          1 Reply Last reply Reply Quote 0
          • Q
            qwerty
            last edited by

            /31 is a valid subnet mask for point to point links which is what CaptainElmo is doing.

            https://tools.ietf.org/html/rfc302
            http://networkengineering.stackexchange.com/questions/1547/31-point-to-point-bitmasks

            1 Reply Last reply Reply Quote 0
            • DerelictD
              Derelict LAYER 8 Netgate
              last edited by

              DHCP relies on broadcasts.  Not sure how anyone expects that to work without a broadcast address.

              Chattanooga, Tennessee, USA
              A comprehensive network diagram is worth 10,000 words and 15 conference calls.
              DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
              Do Not Chat For Help! NO_WAN_EGRESS(TM)

              1 Reply Last reply Reply Quote 0
              • Q
                qwerty
                last edited by

                @Derelict:

                DHCP relies on broadcasts.  Not sure how anyone expects that to work without a broadcast address.

                DHCP broadcasts do no rely on the subnet broadcast address (how will the client know what the subnet broadcast is before it knows the subnet?).

                DHCP always uses the 255.255.255.255 broadcast address.

                1 Reply Last reply Reply Quote 0
                • DerelictD
                  Derelict LAYER 8 Netgate
                  last edited by

                  Yeah.  Here's another thread:

                  http://www.dslreports.com/forum/r29832727-Mikrotik-DHCP-31-subnet

                  This is probably something that's going to have to shake out before vendors reliably work with one another.

                  You might try manually updating the dhcpd.conf file and seeing if you can get it working that way.  Maybe post your findings and if it requires a validation change in the DHCP config pages to make it work, that's pretty easy.

                  Chattanooga, Tennessee, USA
                  A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                  DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                  Do Not Chat For Help! NO_WAN_EGRESS(TM)

                  1 Reply Last reply Reply Quote 0
                  • C
                    cmb
                    last edited by

                    @Derelict:

                    You might try manually updating the dhcpd.conf file and seeing if you can get it working that way.  Maybe post your findings and if it requires a validation change in the DHCP config pages to make it work, that's pretty easy.

                    Yeah that's my suggestion.

                    Though where the clients aren't under your control, trying to do DHCP on /31s is likely to cause you all kinds of grief. Not sure how many devices will work in that circumstance but I'm sure there are a lot that won't. /31s are really intended for static assignment on point to point links where routers, not clients, are involved.

                    1 Reply Last reply Reply Quote 0
                    • Q
                      qwerty
                      last edited by

                      @cmb:

                      @Derelict:

                      You might try manually updating the dhcpd.conf file and seeing if you can get it working that way.  Maybe post your findings and if it requires a validation change in the DHCP config pages to make it work, that's pretty easy.

                      Yeah that's my suggestion.

                      Though where the clients aren't under your control, trying to do DHCP on /31s is likely to cause you all kinds of grief. Not sure how many devices will work in that circumstance but I'm sure there are a lot that won't. /31s are really intended for static assignment on point to point links where routers, not clients, are involved.

                      I've seen DHCP on /31 used in places so that network changes could be done easily from just the DHCP server… but I'm not sure how much effort it actually saves.

                      Is there a way of getting pfSense to stop overwriting the dhcpd.conf file? I was trying to play around with a DHCP on /31 out of curiosity and I can't get my dhcpd.conf edits to stay.

                      1 Reply Last reply Reply Quote 0
                      • C
                        CaptainElmo
                        last edited by

                        @qwerty:

                        I've seen DHCP on /31 used in places so that network changes could be done easily from just the DHCP server… but I'm not sure how much effort it actually saves.

                        It's not the effort so much as access to the remote client. In some cases I will not have easy access to the client so being able to modify things unilaterally at the head end is a requirement.

                        For now I've resorted to using /30 subnets since that works, but ideally it would be better to have DHCP support /31 as well in order to not waste so many IP addresses. If a DHCP client doesn't like that configuration I can always fall back to a /30 only in those edge cases.

                        1 Reply Last reply Reply Quote 0
                        • jimpJ
                          jimp Rebel Alliance Developer Netgate
                          last edited by

                          It's easy enough to disable our input validation to see if it works. If it does, perhaps we can relax the GUI input validation for that special case.

                          FreeBSD and pfSense only recently gained support for /31 networks so it's no surprise if other areas need to catch up.

                          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                          Need help fast? Netgate Global Support!

                          Do not Chat/PM for help!

                          luckman212L JKnottJ 2 Replies Last reply Reply Quote 0
                          • luckman212L
                            luckman212 LAYER 8 @jimp
                            last edited by

                            Back from the dead: https://www.reddit.com/r/PFSENSE/comments/vaxhcj/dhcp_service_on_a_31_interface/

                            1 Reply Last reply Reply Quote 0
                            • JKnottJ
                              JKnott @CaptainElmo
                              last edited by

                              @captainelmo

                              A /31, with only 2 addresses, does not have a broadcast or network address.

                              PfSense running on Qotom mini PC
                              i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                              UniFi AC-Lite access point

                              I haven't lost my mind. It's around here...somewhere...

                              1 Reply Last reply Reply Quote 0
                              • JKnottJ
                                JKnott @jimp
                                last edited by

                                @jimp said in DHCP on /31 subnet?:

                                FreeBSD and pfSense only recently gained support for /31 networks so it's no surprise if other areas need to catch up.

                                That's only for a point to point link, not a broadcast network.

                                PfSense running on Qotom mini PC
                                i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                                UniFi AC-Lite access point

                                I haven't lost my mind. It's around here...somewhere...

                                JKnottJ 1 Reply Last reply Reply Quote 0
                                • JKnottJ
                                  JKnott @JKnott
                                  last edited by

                                  @jknott

                                  It appears someone needs a refresher on DHCP. In addition to a server and client address, it also uses 0.0.0.0 for the client before it learns it's own address and the broadcast address. By my count, that's 4 addresses, which are hard to squeeze into a /31.

                                  PfSense running on Qotom mini PC
                                  i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                                  UniFi AC-Lite access point

                                  I haven't lost my mind. It's around here...somewhere...

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post
                                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.