• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
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.
  • A
    aarcane
    last edited by Jan 31, 2021, 2:30 AM

    So I know I can make DHCP hand out a configured static lease, and I know I can set up a range that is not static, which DHCP hands out. What I want to do is somewhere in between.

    I want to create a 'static range' of DHCP leases, that, whenever a (In my case, virtual) machine requests a lease, it gets an IP address, and then that IP address is permanently allocated to that machine until I go in and manually remove it from the list of static leases in DHCP. Namely, the virtual machine should not be allowed to simply release the IP address, or get another by any means other than me going in and manually releasing it, or choosing to assign their own IP outside of the DHCP system.

    The goal is that I want every VM I spin up to just get it's forever IP without me having to copy the MAC from the Hypervisor, go over to pfsense, configure the static lease, check what the next available IP is, etc, then go back to the hypervisor and start installation or configuration. I just want to click start and then have the machine get it's forever IP.

    C N J 3 Replies Last reply Jan 31, 2021, 4:03 AM Reply Quote 0
    • C
      chpalmer @aarcane
      last edited by Jan 31, 2021, 4:03 AM

      @aarcane said in make all DHCP leases static:

      So I know I can make DHCP hand out a configured static lease,

      I want to create a 'static range' of DHCP leases,

      I assume you mean you can assign each machine a static address.. because what you said you knew that you could do is what you want to do.. Am I reading this wrong?

      Almost every machine on my local network here is given an address assigned to it using my pfSense DHCP server.. As long as the interface MAC address is the same it will always get the address I set for it..

      In the picture below you can see where the top arrow is.. click that.

      Difference is show at the second and third arrow.

      Is that what you are speaking of?

      DHCP.jpg

      Triggering snowflakes one by one..
      Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz on an M400 WG box.

      1 Reply Last reply Reply Quote 0
      • N
        noplan @aarcane
        last edited by Jan 31, 2021, 4:19 AM

        @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 Jan 31, 2021, 4:52 AM

          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 Jan 31, 2021, 8:27 PM Reply Quote 0
          • J
            JKnott @aarcane
            last edited by Jan 31, 2021, 11:51 AM

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

            N 1 Reply Last reply Jan 31, 2021, 12:04 PM Reply Quote 1
            • N
              noplan @JKnott
              last edited by Jan 31, 2021, 12:04 PM

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

              J 1 Reply Last reply Jan 31, 2021, 1:57 PM Reply Quote 0
              • J
                JKnott @noplan
                last edited by Jan 31, 2021, 1:57 PM

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

                N 1 Reply Last reply Feb 1, 2021, 8:45 AM Reply Quote 1
                • A
                  aarcane @serbus
                  last edited by Jan 31, 2021, 8:27 PM

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

                  J 1 Reply Last reply Jan 31, 2021, 8:43 PM Reply Quote 0
                  • J
                    JKnott @aarcane
                    last edited by Jan 31, 2021, 8:43 PM

                    @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 Feb 1, 2021, 5:39 AM Reply Quote 0
                    • A
                      aarcane @JKnott
                      last edited by Feb 1, 2021, 5:39 AM

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

                      G 1 Reply Last reply Feb 1, 2021, 8:34 AM Reply Quote 0
                      • G
                        Gertjan @aarcane
                        last edited by Feb 1, 2021, 8:34 AM

                        @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
                        • N
                          noplan @JKnott
                          last edited by Feb 1, 2021, 8:45 AM

                          @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
                          12 out of 12
                          • First post
                            12/12
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                            This community forum collects and processes your personal information.
                            consent.not_received