DHCP Option 43 for UniFi AccessPoints

Hi.
We are using more and more UniFi. For this a central UniFi controller with multiple sites.
I have seen that you can set the DHCP option 43. Then you do not have to touch each access point individually.

Does anyone have experience with this? I can’t figure it out. I have no experience with the DHCP options.

Basic idea: Every UniFi device in the LAN should report to my central controller.

For this I have found the following links:
German Link

UniFi Site

If someone has the solution, I would be very happy for a description for dummies!

IP Sample= 189.41.228.220
(http://mydomain.ddns.me)

IPFire is running the standard internet consortium dhcpd daemon for Linux.

In terms of how to encode the option 43, I would guess (meaning, I do not know for certain) it should not be difficult to find a tutorial, as it is the most common implementation of the DHCP protocol. For example, this one and more specifically for the unifi access point, this one.

Concerning how to modify the configuration file in IPFIre, you can add your own directives to the dhcpd server by entering them in /var/ipfire/dhcp/dhcpd.conf.local. After editing the conf file, restart the server by issuing the following command:

/etc/init.d/dhcp restart
2 Likes

You can put it into dhcpd.conf.local as @cfusco indicated

Another option is to try it in the dhcp options section of the wui.

Using the unifi link that @cfusco provided I entered the following values.

First option is the definition

Name - unifi (or whatever you want to call it)
Option value - code 43=string

Then add the global definition (or you can limit it to just the Blue or just the Green subnets)

Name - unifi
Option value - 01:04:c0:a8:01:02

The code there was obtained on the unifi website. I entered 192.168.1.2 for the unifi controller IP and pressed the button and in the pfSense section it then shows the equivalent value. This is basically just the hex value of the IP which is taken as a string input.

Here is what ends up in the wui page.

The order is from the bottom upwards and the values are put into the dhcp.conf file in the reverse order.

This what ended up in the dhcp.conf file just before the first subnet entry

deny bootp; #default
authoritative;
ddns-update-style none;
option unifi code 43=string;
option unifi 01:04:c0:a8:01:02;

The option unifi code 43=string is saying to the dhcp server I am defining a name, unifi, that represents code 43 and the value will be provided in string format.

The option unifi 01:04:c0:a8:01:02 then tells the dhcp server that the option named unifi has a string value in hex of 01:04:c0:a8:01:02

This basically follows the same approach as used for the wpad entry as shown in the wiki page

https://wiki.ipfire.org/configuration/network/proxy/extend/wpad#distribution-via-dhcp-option

Entering the value on the wui page will automatically restart the dhcp server after the options have been added, if they are checked as enabled.

2 Likes

Having had a further think on this and looking at the option table in the IPFire dhcp server wui page it indicates that the code NNN= can also have a value type of ip-address assigned to it.
That would make the entry work even more simple as you wouldn’t have to convert the unifi controller IP address into hex.

So in the first definition entry that would be

Name - unifi
Option value - code 43=ip-address

Then the second entry would be

Name - unifi
Option value - 192.168.1.2 (enter the actual IP address of your unifi controller in here)

2 Likes

I assume that entering the option value as an ip-address would also make unnecessary to precede the IP address with 01:04, which communicates the presence of an IPv4, right?

That is my understanding but I have never used those commands myself in actual usage.

hopefully OP will try and let us know if this works as expected.

1 Like