How do I configure the DHCP server on my EdgeRouter such that my UniFi AP can always automatically find the computer on which the UniFi Controller software is installed?
For this to work, your UniFi AP must be set to receive its IP address from the DHCP server, and it should have a static IP reservation. Assuming that your subnet is 192.168.0.0/24, that you want your Unifi AP to be at 192.168.0.254, and that the IP address of the computer running the controller software is192.168.0.10 you need to login to SSH and enter the following commands on your EdgeRouter:
configure set service dhcp-server global-parameters "option unifi-address code 43 = string;" set service dhcp-server shared-network-name YOUR_NETWORK_NAME subnet 192.168.0.0/24 static-mapping YOUR_UNIFI_NAME ip-address 192.168.0.254 set service dhcp-server shared-network-name YOUR_NETWORK_NAME subnet 192.168.0.0/24 static-mapping YOUR_UNIFI_NAME mac-address 11:22:33:44:55:66 set service dhcp-server shared-network-name YOUR_NETWORK_NAME subnet 192.168.0.0/24 subnet-parameters "option unifi-address 01:04:AA:BB:CC:EE;" commit save exit
Adjust the IP addresses and ranges as necessary, replace YOUR_NETWORK_NAME with the actual name of your existing DHCP subnet, replaceYOUR_UNIFI_NAME with the name you want to use to identify your UniFi AP static mapping in the DHCP configuration, and change 11:22:33:44:55:66 to the MAC address of your Unifi AP (if you haven't performed physical installation yet you can find it on the sticker underneath the back cover, otherwise look in the UniFi controller software).
Finally, replace AA:BB:CC:EE with the IP address of the computer running the controller software in the hexadecimal notation — following our example,192.168.0.10 should be written as C0:A8:00:0A. To get the hexadecimal representation of your IP address you can use this IP to hex converter.