make all DHCP leases static
-
@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 ipIf 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 -
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
-
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.
-
@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 ...
-
Yep. IIRC, pfsense won't even allow you to do a static assignment within the pool.
-
@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.
-
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.
-
@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.
- 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!
- 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
- 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.
-
@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.
-
@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