OPNsense Forum

Archive => 23.1 Legacy Series => Topic started by: tessus on February 18, 2023, 08:58:54 pm

Title: API for DHCP Static Mapping?
Post by: tessus on February 18, 2023, 08:58:54 pm
I would like to set a DHCP static mapping via a script, but I couldn't find an API call to create such a mapping.

How can I automate this? e.g. I want to create a static DHCP mapping for interface ABC.
Title: Re: API for DHCP Static Mapping?
Post by: tessus on March 02, 2023, 07:17:01 am
Anyone?

Is this idea so strange or does nobody know? e.g. how do you set the DHCP mapping after one used terraform to create a VM? I can automate everything, except apparently creating a static DHCP mapping.

Did nobody ever come across the same issue?
Title: Re: API for DHCP Static Mapping?
Post by: tessus on March 23, 2023, 09:33:19 pm
Sorry to bump this again. I am ok with someone telling me that it is not possible, but why does nobody answer?

Does really nobody know? Not even the OPNsense devs?
Title: Re: API for DHCP Static Mapping?
Post by: opnsense-user123 on March 23, 2023, 10:17:05 pm
This might be a bad idea ... but you might be able to export and modify the config file and re-import the required parts to change the DHCP server config.
Title: Re: API for DHCP Static Mapping?
Post by: tessus on March 23, 2023, 11:15:28 pm
Hmm, this might work, iff that applying can be done via an API, otherwise I am back to square one.
Title: Re: API for DHCP Static Mapping?
Post by: Fright on March 24, 2023, 06:54:17 am
@tessus
at the moment there is no api endpoints for dhcp leases (legacy pages are used). but it looks like there are plans for MVC migration (https://github.com/opnsense/core/issues/6380) IIUC. then api endpoints will appear
Title: Re: API for DHCP Static Mapping?
Post by: tessus on March 24, 2023, 11:35:12 pm
Great. Thanks for the info. This is indeed great news.