DHCP static lease

Started by ddt3, February 14, 2022, 06:55:46 PM

Previous topic - Next topic
Hello,

i am moving from clearos to pfsense and I have a few question regarding DHCP static lease and DNS:
On my lan opnsense dhcp server uses a range from 100 tot 200.
Some of the dhcp leases I would like to make static: in openhab that meant: " use this ip-address every time one is requested by this mac address". In opnsense when I click plus, I get a form pre-filled with the mac-address and am asked to provide an ip-address. The advice says: use an ip-address outside the pool.

But that causes some issues: because the lease in the " pool list"  was just obtained it means the static address will not be used until the lease is refreshed. I find that a bit confusing, is it meant to be like that?

Next to when I have the checkmark that says a static lease needs to by added to DNS too. Which is fine, but is there a way to add hostname aliases to the static lease ? I can get this done of course but that involves" copying" the ip-address and host name from the static lease and create a dns record out of that.

Quote from: ddt3 on February 14, 2022, 06:55:46 PM
But that causes some issues: because the lease in the " pool list"  was just obtained it means the static address will not be used until the lease is refreshed. I find that a bit confusing, is it meant to be like that?
That seems like normal behavior to me. It's up to the client to request a new lease. Just do a release and renew at the client and the updated static IP should be obtained.
Quote from: ddt3 on February 14, 2022, 06:55:46 PM
but is there a way to add hostname aliases to the static lease ? I can get this done of course but that involves" copying" the ip-address and host name from the static lease and create a dns record out of that.
On the same screen where you assign the static IP after pressing the plus button, there is a hostname field. Fun fact: you can assign a hostname there based on the MAC address and leave the IP field blank. In that way, the hostname will resolve to the IP, although the IP will still be dynamic.

Quote from: jp0469 on February 14, 2022, 08:09:41 PM
That seems like normal behavior to me. It's up to the client to request a new lease. Just do a release and renew at the client and the updated static IP should be obtained.
That indeed is normal behavior for DHCP but it is OPNsense not allowing (or at least advising against) to make static a previously "dynamic ip address". Some of these devices are inside a wall (home automation) releasing the lease is done by cutting the power.
Quote from: jp0469 on February 14, 2022, 08:09:41 PMOn the same screen where you assign the static IP after pressing the plus button, there is a hostname field. Fun fact: you can assign a hostname there based on the MAC address and leave the IP field blank. In that way, the hostname will resolve to the IP, although the IP will still be dynamic.
I know that you can provide a host name, (i actually mentioned "copying ip-addres and hostname" my question was about adding aliases (more than one host name referring to the same ip-address). It can be done by adding a record to  dns , but clicking through these webpages, scrolling from top to bottom (because save is at the bottom) and back up if you mistyped a field.. not enjoying that part