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

    make all DHCP leases static

    Scheduled Pinned Locked Moved DHCP and DNS
    12 Posts 6 Posters 1.1k Views
    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.
    • noplanN
      noplan @aarcane
      last edited by

      @aarcane said in make all DHCP leases static:

      I just want to click start and then have the machine get it's forever IP.

      No not gonna work.
      If so wanted use static ip

      If dhcp needed u have to go to pfsense and set
      Static mapping
      Be aware the static mapping ip should be outside the range of ip a that your dhcp server is offering

      1 Reply Last reply Reply Quote 0
      • S
        serbus
        last edited by

        Hello!

        The "rumor" is that the ISC DHCP should accept a default-lease-time/max-lease-time of -1, which would essentially be an infinite lease. I dont know if this would stop the client from releasing the lease and potentially getting a new IP.

        The pfsense gui will not let you set a lease time < 1, but you might be able to set a really large one (157788000) and get a similar effect.

        John

        Lex parsimoniae

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

          @aarcane

          How would a machine know to get one of those static addresses? The normal way is to convert a lease to a static mapping, as described in the message above. On my network only the router LAN interface and main desktop computer have a manually configured static address. Everything else uses DHCP with static mapping.

          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...

          noplanN 1 Reply Last reply Reply Quote 1
          • noplanN
            noplan @JKnott
            last edited by

            @jknott said in make all DHCP leases static:

            Everything else uses DHCP with static mapping

            outside the range the dhcp server provides for dhcp requests

            ... i hope ... 🙄

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

              @noplan

              Yep. IIRC, pfsense won't even allow you to do a static assignment within the pool.

              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...

              noplanN 1 Reply Last reply Reply Quote 1
              • A
                aarcane @serbus
                last edited by

                @serbus said in make all DHCP leases static:

                I dont know if this would stop the client from releasing the lease and potentially getting a new IP.

                The only reason for wanting this provision is because some operating systems have misbehaved on me by releasing their DHCP leases on each shutdown and restart, resulting in a constantly changing IP address. It's a small thing, but I'd like to prevent that.

                I may just try to go with the super-long timeout though, since most of my VMs should behave sanely these days.

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

                  @aarcane

                  Just create a static map in the DHCP server, so that the same IP is always assigned to the same MAC. As I said, I do that here for most devices.

                  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...

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

                    @jknott said in make all DHCP leases static:

                    Just create a static map in the DHCP server, so that the same IP is always assigned to the same MAC. As I said, I do that here for most devices.

                    The problem there is that it takes an extra aside during the VM creation process. After the VM is created and a MAC address is generated, I then need to log into pfsense, pick an available IP manually, go through the three pages of UI to generate a static lease, and then finally, I can start up the VM.

                    1. This isn't that bad on a single VM creation, but if someone is spinning up a half dozen VMs, like I just did yesterday, the overhead adds up!
                    2. It's a management nightmare to have to do this manually, and if I was in a business environment, having someone miss this step could be catastrophic, and
                    3. It seems like a problem that should have been solved long ago, and I'm surprised it isn't possible here.

                    Adding a manual host entry for each VM just isn't a tenable solution for more than a small handful of VMs.

                    GertjanG 1 Reply Last reply Reply Quote 0
                    • GertjanG
                      Gertjan @aarcane
                      last edited by

                      @aarcane said in make all DHCP leases static:

                      The problem there is that it takes an extra aside during the VM creation process. After the VM is created and a MAC address is generated, I then need to log into pfsense, pick an available IP manually, go through the three pages of UI to generate a static lease, and then finally, I can start up the VM.

                      What about starting up all the VM's to get to know the 'random' MAC, or, better : is it possible to see this random mac before ?
                      Anyway : note it down, or copy it directly over to the XML pfsense backed up config file, and add odd for each MAC an entry like this :

                      <staticmap>
                           <mac>00:aa:bb:cc:dd:ee</mac>
                           <cid>The-name</cid>
                           <ipaddr>192.168.x.y</ipaddr>
                           <hostname>Another-name</hostname>
                           <descr>Again  something</descr>
                           <arp_table_static_entry/>
                           <filename/>
                           <rootpath/>
                           <defaultleasetime/>
                           <maxleasetime/>
                           <gateway/>
                           <domain/>
                           <domainsearchlist/>
                           <ddnsdomain/>
                           <ddnsdomainprimary/>
                           <ddnsdomainkeyname/>
                           <ddnsdomainkey/>
                           <tftp/>
                           <ldap/>
                      </staticmap>
                      

                      Take note that there are multiple <dhcpd> entries if you have several dhcp servers.

                      When done, import, import the config, restart pfSense for good measures, and start your VM's.

                      No "help me" PM's please. Use the forum, the community will thank you.
                      Edit : and where are the logs ??

                      1 Reply Last reply Reply Quote 1
                      • noplanN
                        noplan @JKnott
                        last edited by

                        @jknott said in make all DHCP leases static:

                        pfsense won't even allow you to do a static assignment within the pool.

                        never tested it
                        some things they teach you stay forever somehow ;)
                        thx

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