Unifi Security Gateway DHCP server stops working
I recently experienced an issue where the DHCP server of my Unifi Security Gateway stopped working. For some reason, clients were not receiving IP addresses anymore. Earlier that day, I had assigned a fixed IP to a host, so maybe that screwed up the configuration at some point, but it's difficult to say for sure.
I power cycled the gateway, but that didn't seem to fix anything.
To further debug the issue, I've set my computer to a fixed IP address and also added other networking settings manually. With the manual settings, I could access my network and the internet without issues.
The Unifi controller reported no related issues, so I browsed to the admin page of the security gateway itself. There I noticed that it had chosen the DNS servers provided by the DHCP of my ISP. Normally, these are set to 127.0.0.1, the gateway's internal DNS proxy, who then proxies to the DNS servers configured in the WAN network defined in the Unifi controller. In my case, these are 2 internal DNS servers. I tried setting the value back to 127.0.0.1, or the internal DNS servers, but the values were never applied.
I logged in on the gateway using SSH, and noticed that the commands that should show DNS statistics and leases were not showing anything:
admin@Gateway:/var/log$ show dhcp leases IP address Hardware Address Lease expiration Pool Client Name ---------- ---------------- ---------------- ---- -----------
Some online searching (see references) told me that turning off DHCP on one of my networks and turning it on might help. I made a screenshot of the configuration of my clients network, turned off DHCP, waited for the change to be provisioned, and then turned it on again. The earlier configuration came back, so the screenshots were not necessary. This did indeed fix the issue, probably by it forcing the controller to rewrite the underlying configuration and reapplying it. The gateway's admin page also showed the correct 127.0.0.1 DNS again, and via SSH I could see DHCP statistics again.
